18

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
  • 32
    Why bark when you can buy a dog to do it for you?
    – jfrankcarr
    Commented Jul 24, 2012 at 3:38
  • 29
    Using a pickup truck is cheating. Real men outrun and tame wild horses in 120 degree weather. They approach them from the back. Obligatory xkcd.com/378
    – Job
    Commented Jul 24, 2012 at 4:22
  • 9
    ask your friend why he doesn't consider using a computer instead of doing things manually as cheating
    – DPD
    Commented Jul 24, 2012 at 6:28
  • 2
    Sounds like your friend has never had an aggressive deadline to meet.
    – MattDavey
    Commented Jul 24, 2012 at 7:03
  • 15
    Considering it cheating is just programmer snobbery.
    – Alan B
    Commented Jul 24, 2012 at 8:46

8 Answers 8

59

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
  • 3
    Just to add, designer tools are just code generators. Generating code is usually a good thing, because it can generate it and you can move on doing what you're meant to do; make the screen actually do something useful. My experience differs; I was much more productive using the designer tools than not.
    – Andy
    Commented Jul 24, 2012 at 16:01
  • As an addendum to Andy's note, the right designer tool makes all the difference in the world. I've used Delphi/Lazarus for GUI development and it was great. I've also been mandated to use MS Frontpage, and you get horrible html out the other end. Commented Jul 24, 2012 at 18:20
  • FWIW, using MFC I use the visual editor to get it close, then hand-adjust to get it right. That seems to be the fastest way for me. Commented Jul 24, 2012 at 19:43
  • I have no problem with using a specialized tool to get work done faster, but to add on: My own preference is for tools that define data-driven models, ie a UI'a layout in XML - rather than code-generators, that will write for you "Button btn54 = new Button(x: 543, y: 782);"
    – Katana314
    Commented Aug 12, 2013 at 17:35
17

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.

10

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
  • I'm firmly in the 'use the available layout tools' camp. The tools save time, even though the generated code often needs some tweaking. The 'it's cheating' guy sounds like someone who hasn't taken the time to understand the generated well enough to edit it. Commented Jul 24, 2012 at 1:57
4

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.

3

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
  • In .Net as of version 2.0 I believe the GUI and the logic is separate thanks to the partial classes - same class is defined in two different files; one is entirely auto-generated, and one is customized by you.
    – Job
    Commented Jul 24, 2012 at 4:38
  • I can't agree with the statement that it's a "clear case of making unnecessary work". It all depends on the tool and the skill of the programmer. For example, I am certain I could code a tcl/tk GUI faster and with better final code by hand than you could using any GUI builder of your choice. OTOH, there's no way I would consider using anything other than Visual Studio if creating a .net desktop app. Commented Jul 24, 2012 at 11:13
  • Since the OP is quite clearly talking about the general case (see bolded text in the question) I can't accept your disagreement with regard to the general case, although I do accept that special cases can and do exist. Twas ever thus. Commented Jul 26, 2012 at 22:34
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!

1

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).

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.