I'm primarily a server programmer, but I still end up doing UI work every once in a while, and that's been true for the majority of the last three weeks. Not being an experienced old hand at UI design, I find myself falling back on first principles and decade-old books. I'm mostly happy with the results, but the code that results in implementing the interface... well, it's not the kind of code that I like to write.
One of the basic principles of interface design1 is coherence:
Internal consistency means that the program's behaviors make "sense" with respect to other parts of the program.... One should strive towards the principle of "least surprise".
If one part of your interface shows that your sword gives you a skill bonus, everything that displays information on skills should incorporate that bonus.
Put another way, each individual part of the user interface that displays information will grow to depend on both the information it ostensibly displays, plus what every other part of the interface ever displays. Very little code is left loosely coupled to the interface: data hiding obstructs coherence, singletons and global variables spring up, even the code that takes actions based on user input gets more context-sensitive (making it hard to avoid keeping that code loosely coupled and non-repetitive), and so on.
Is this bad? Nah, not really. It's just one of the many pressures that (in the short term) pushes against loose coupling, DRY code, and good code architecture. A good UI is an important aspect of good software, including games. But sometimes... sometimes, the things I do to the code in the name of users just seems awful. :-)
EDIT: Edited for clarity based on early feedback.
1. Per A Summary of User Interface Design Principles. See? All my references are a decade old...


The previous post about UI design vs. code architecture has been heavily edited. I try not to edit posts after they've gone out, but I got a lot of feedback that I was rambling and the subject of the post wasn't at all clear. Plus nobody commented here
Tracked: Sep 05, 21:23