The only thing worse than generalizing from one example is generalizing from no examples at all.
This is true, and in terms of X-Plane, I think this comes down to "don't add features that aren't needed." When you look at the "cost" of X-Plane in terms of how hard it is to write new code (and in some ways you could say Laminar Research does business by adding new code to X-Plane) our cost goes up with the number of existing features already in place that we have to keep working while we change things.
If a problem is not completely understood, it is probably best to provide no solution at all.
This also is very true for X-Plane. We want to provide long-term compatibility for X-Plane as a platform for airplanes, scenery and plugins. The risk of putting in solutions to problems that we don't understand is that two months later we'll go "ah drat, our APIs aren't quite right" but by that time third parties will be depending on the existing broken behavior.
Provide mechanism rather than policy. In particular, place user interface policy in the clients' hands.
I am critical of X, but you could deflect my criticism by pointing out that it stems from how X is used, which perhaps goes against its original intention. My issues, all stemming from the use of X as the lowest level of window management are:
- By making remote-desktop capabilities a core part of the spec, X11 introduces a complexity cost to desktop UI programming that isn't necessary a lot of the time.
- X is not a complete solution to a desktop environment layer.
The second criticism isn't even remotely fair at all - X isn't a complete solution, and it's meant to have stuff on top of it. I suppose my issue here is: X11 is pretty ubiquitous as the base layer in the Unix world, but what goes on top is open for debate.
And this goes to this third principle. If X11 is only the "bottom half" of a complete UI framework, it makes sense to provide mechanism and omit policy. But....is the bottom half of a complete UI framework useful to clients? It's the lack of policy, encoded in a simple, ubiquitous API that makes simple things easy and hard things possible, that frustrates me about coding on Linux.
So when it comes to X-Plane, I take a very different approach - I treat all of my SDK code as policy work. That is, we try to make it easy to do things we want authors to do and impossible to do things we don't want authors to do. In my experience this is the only reasonably option...given an open platform, users will do, well, everything possible.
Is it fair to be so heavy handed? Call me a techno-fascist but I think it's essential. At the end of the day, third parties count on us to keep the platform stable so that they don't have to waste time updating previous finished products each time we post a new patch to X-Plane. The wider the array of weird behavior that we tolerate, the wider the array of weird behavior we have to treat as backward compatibility cases later. By using technical limitations to require authors to conform to specs the first time, we can avoid compatibility breaks later.
The top half of the desktop is in GTK+ and QT, (or motif, or whatever toolkit) nobody writes large X apps directly on libX11 anymore, and really nobody should.
ReplyDeleteThis is why there's frequently at least two apps for every problem on Linux (one QT, one GTK).
The general policy stuff is being spec'd out by the XDG people at freedesktop.org and slowly GTK/QT/etc are starting work together better (and now both GTK and QT have theme engine backends that make them act like the other so that apps written in either can be made to blend with the users desktop).
I'd also be inclined to argue that X's flexibility is it a strength, and part of the reason it's still around (and relevant) after 3 decades.
However, X-Plane is in a somewhat different situation from a normal desktop app since it's a game and so doesn't use a normal toolkit...