July 27, 2011

GUI

I have to say that over the years I've slowly started to hate programming GUI. It seems every tool and even language has its own way of doing things and very few of them actually line up nicely. Is it really that hard to ask for a common design between them? I've played around with GUI in .NET, Java and C++ (using Qt) and so far Qt has proven to be one of the simplest solutions I've come across to date.

Qt lets you organize and setup your UI to look good and be re-sizable without doing unexpected things. There is a good separation between models and views. The best thing I like about it is how you develop is very sequential, you create your object and then define how it is setup and what it does in response to certain actions. The best part is most of the setting up is done behind the scenes, but gives you the ability to easily code it up yourself without that much effort. Oh did I mention the whole cross-platform compatibility? I'm sure most people who don't know about Qt would laugh at you if they heard you were saying C++ easily supports cross-platform development.

For Java, most of what I've done has been using Visual Editor in Eclipse and also using Netbeans. Netbeans provides a significantly more robust environment for GUI development, but my lack of comfort and familiarity with it has given me a few minor headaches. Overall, it is pretty nice and has that 'advanced' feelings in comparison to Eclipse. I'm pretty sure there are a few people out there that would agree when I say Eclipse has a childish and baby feel to it. (No I'm not a pedophile, its a figure of speech!)

I use a slightly different approach to GUI design inside of my applets. If you want to refer to the MVC model, essentially I have just Model and View, the Controller is basically added to both objects. Basically the View  is responsible for keeping track of its own state and interpreting what the inputs mean locally. Then the Model hooks up to the View and checks to see what 'state' it is in and based on that determines what it should do in response (if anything). I don't use an observer pattern for this because it is a real-time system. The Model has to quickly check the View every loop, personally having your code check the value of a variable every iteration isn't overly costly.

I'm currently in the process of creating a tool to generate serialized objects for use in my projects. The only issue is that I'm learning how Netbeans does GUI so it is a fairly slow process because of the learning. Thankfully, Netbeans really helps the programmer by providing a simple interface for setting up GUI elements and hooking up there actions. So really, don't expect many changes when it comes to my applets, but for the time being I'm planning out what I want to do next with the games anyways.

No comments :

Post a Comment