Some of you may know that I don’t do a lot of user interface work. Well, in the last couple of weeks I’ve been doing little but user interface work. I thought it might be time to share a few reflections.
Designers
The designer in VS 2005 is actually very good – for a designer. It still has its “thou shalt not touch this bit of code” which of course you then have to touch in order to include some controls which aren’t in the toolbox, but overall it’s pretty reasonable. I particularly like the “GenerateMember” property it uses to decide whether or not to create a member variable for controls. No more silly label variables for no reason!
One day I’ll be able to use WPF/XAML, which is of course another step up again, but until then this isn’t too bad.
TableLayoutPanel
Hooray, a half-decent layout in WinForms. Whatever people may say, just using Dock and Anchor doesn’t give enough control over layout in my view. Lining things up with absolute positioning should have been a thing of the past years ago.
TableLayoutPanel appears to have some significant shortcomings, however. In particular, I was in a situation where it would have been really nice if TLP allocated all the “Absolute” sizes, then gave as much as possible to the AutoSize rows, then gave any spare to the percentage rows. However, it goes top to bottom, left to right. Basically I wanted a couple of buttons below a multi-line label, and for the label to become a scrolling area if there wasn’t enough room for it, with the buttons always present just below the label. Maybe there’s a way to lay this out the way I want, but having sworn over it for most of an afternoon, I’ve given up.
Scrolling is also a pain – it tooks me a long time to get any scrollbars to appear when I wanted, and I still don’t know exactly what triggered it suddenly working. Even now they aren’t quite right, as the appearance of a vertical scrollbar forces a horizontal scrollbar to let you get at the bit of the panel which is now taken up by the vertical scrollbar – even if there’s nothing there! All very frustrating.
Overall architecture
I really suck at this. I’m trying to separate everything out appropriately, but I don’t know enough about it to cope when things get tricky. All the samples of MVC, MVP, Humble Dialog etc are fine when they’re doing relatively simple stuff, but it feels like UI is particularly prone to “I know I shouldn’t have this logic here really, but it’s much easier than doing it properly…” Hmm.
Frustration/Joy
I have really mixed feelings about the satisfaction derived from UI. A lot of the time it seems like very slow work – implementing a small UI feature seems to take a lot longer than implementing a small server-side feature – but when it’s working, it’s very visible. You can show people the results. Just demonstrating hundreds of working unit tests and a few database tables filled with data doesn’t have nearly as much of a pull. I think a prototype UI (not prototyping the real UI, just enough to demonstrate backend features) is possibly the way forward here.
Basically, I suspect I’ll never be a GUI person at my core. I can grow to be passably good at it, but I suspect that you have to keep working at it for a high proportion of your time to know all the gotchas and tricks involved and keep a clean design.
In other news – the book is still coming along. Sorry to have kept so quiet about it, but I’m hoping I’ll be able to announce something properly (and tangibly) fairly soon.