I have a friend who has a slightly greater amount of programming experience as me. We were talking about all the different programming technologies we use and Interface Builder came up in conversation.
Being of no programming background except for what I’ve taught myself, I personally believe that IB and all it’s features (IBOutlets
, IBActions
) help coders of my skill level (and all skill levels, for that matter) complete projects of theirs in less time.
His view of IB is a little enthusiastic. He believes that coders that utilize Interface Builder are “cheating” in the fact that they don’t have to lay out interfaces by hand.
Question:
Should using a GUI builder to lay out interface elements be considered “cheating” (since most programming originally required laying interfaces out by hand in code)? Why?
16
It’s not cheating. Programs like IB are tools. Use the right one for the job. There is no need to get dogmatic about it.
If you are more effective using such a tool, use it. The only caveat is that you should learn the trade-offs when making your decisions. Doing layouts by hand give you precise control at the expense of drag-and-drop ease. Drag-and-drop tools let you do many things quick and easy, but may make your code harder to maintain over time.
Personally, I’ve never had success or derived much pleasure from using a drag and drop UI design tool, but that’s just me. I find laying GUIs out by hand is the most effective for me, and yields a code base that is easier to maintain over time. Others have the opposite experience.
4
Programming as a job is not a sport nor a game. So the cheating argument is very thin. If the visual tools increase your productivity you would be stupid to not use them.
My experience is that these get me to spend more time on actual problem solving code without doing the trivial interface stuff over and over again.
Beware though, it’s easy for settings or data to creep into the interface. Be radical about keeping presentation and logic seperated.
It’s only cheating if you’re sacrificing something to get there. Most GUI layouts just generate code that you’d make anyways (and often have to edit by hand since the layout isn’t sufficient).
So basically, no.
All else being equal, any tool that lets you get the same thing done faster is good.
1
Cheating is the name of the game. You should always take the easiest route you can when making any sort of development decision. Call it cheating, call it “being productive”; it makes no difference. You should choose the tool that helps you get the job done with the least amount of effort (of course, do not forget about maintenance and scalability).
Now specifically with IB, you should weigh the time saved by IB vs the cost of having to maintain code that is sloppier and that you are less familiar with. This is really a case by case and person by person sort of decision. In many cases, tools and wizards allow you to get a lot more work done with a low added maintenance cost… and sometimes they introduce slop code and more leaky abstraction than you know what to do with. It sounds like you have made the decision for yourself that IB is worth any costs it adds to development, however, your friend might just as easily find that the tool hinders him more than it helps.
Hell no. Doing it entirely by hand, however, is a clear case of making unnecessary work for yourself.
(Generally I’d lay it out using a builder and if any fine-tuning was needed it tends to – but not always – get done by hand).
3
It’s certainly not cheating, although I would have a little less respect for a developer who couldn’t lay out a GUI without one. IMO, using one is no different from using a system-provided datatype — why implement your own linked list or hash map if you can use one out of the system library?
FWIW I had to implement a UI in Java Swing a couple of months ago. I’d never used it, so I wrote it all by hand so I could get a better understanding of how it worked. Now that I know the basic API, I’ll never write one by hand again if I can help it!
As @Bryan Oakley states, it’s just a tool and not a “cheat”. It all depends on what exactly you’re laying out. If by hand makes it incredibly laborious exercise then you should really look for other alternatives that makes you more productive.
I used to be in the camp of hand coding the interface, but later after a bout of laying out interfaces I took an arrow to the knee and had a different opinion. If I can and it makes me more productive then I’d use a graphic tool to lay out the GUI.
Lately using the MVVM pattern, with the distinction of View and ViewModel, it makes a bit more clear to when you would use graphical tools. Phil Haack discusses this briefly in the Github for Windows episode of Herding Code podcast when asked about the transition from web to application development. It makes more sense to do the ViewModel with coding “by hand”, and let the designer build the View graphically (and wire up the ViewModels accordingly).
One of the great advantages of tools like Interface Builder is that they make it possible to separate the work of design of the UI from the implementation of the program. Someone with minimal coding skill can easily change the layout of the UI, change button and menu captions, translate the UI into a different language, etc.