8

In a stackOverflow question I have read that using a GUI designer program can generate lots of messy code and is considered to be a bad practice unless you're making smaller programs.

My question is why and how. Is it bad to use a GUI designer program? Why?

Additional details:

  • Programming on a Windows platform;
  • Only programming in C++/Java for windows programs.
  • For IDE I've been using visual studio 2010 (Not the express edition) since it comes with the GUI designer.
4
  • Could you post a link to the question you are referring to? Mar 8, 2012 at 19:54
  • 6
    OMG, from the title I had inferred you where talking about the other GUI designers... the people that do GUI design. And to talk about using them as a bad practice, well, was pretty awesome.
    – ZJR
    Mar 8, 2012 at 23:32
  • wow me too ZJR, I'm gonna update that title! Mar 9, 2012 at 6:05
  • Up until ZIR mentioned it I didn't even know there were such things. You learn something new everyday.
    – Bugster
    Mar 9, 2012 at 6:19

5 Answers 5

12

It is not bad practice to use GUI designer to design your forms, GUI. Esp in Visual Studio. They are there for this purpose and are extensively used.

In web development, it is a different story. It is a bad practice to use GUI designer (for example Microsoft Front Page now superseded by WebMatrix). The reason

  • They provide a lot of extra code that you do not really need. They basically create junk.
  • They increase the size of the html document. Which is HIGHLY undesirable for high end site which a large number of hits.
  • They are hard to maintain because of a lot of extra junk code

So as far as your question, it is not bad practice to use GUI in design forms esp in Visual Studio. Not at all.

1
  • I'd say it would be bad practice to NOT use the vs designer for desktop applications.
    – Andy
    Oct 25, 2014 at 0:22
5

For a big and medium project, they should not be used, because the code they generate is not very nice to maintain. Unless you don't plan to clean up the code generated by a GUI designer, you are better without it.

However, they are very good in next cases :

  • to create something quick and dirty (maybe for a prototype)
  • to try new things out, and see how it would look like
12
  • I find that with VisualStudio, it is extremely rare to manually maintain and clean up the generated code. Mar 8, 2012 at 20:18
  • @FrustratedWithFormsDesigner No idea. Never used visual studio. My experience is on linux with qt tools, where the generated code is not that bad, but not good either. Anyway, it is possible to clean it up Mar 8, 2012 at 20:44
  • 4
    You should never ever touch a generated code by hand. Than it does not matter how the code looks, because you maintain it with the designer. Designer that only initially creates the code, but you than need to edit it by hand is not worth it's name and is problem, but all the reasonable ones (e.g. Qt, VisualStuido) generate a separate source that you never touch by hand. Usually the code is not even versioned, but generated as part of the build.
    – Jan Hudec
    Mar 9, 2012 at 7:52
  • 2
    Yes, I do. A tool that generates code and expects you to maintain it manually afterwards is horribly broken and will cause lots of problems, because the code will inevitably have some warts. This applies to any code generator; ORM or UML modeller working like this will cause problem the same way. But that's not the case of modern GUI designers. The .NET and Qt generate the code so that you define the logic in separate source and Gtk does not even generate code, but interprets the designer file at runtime. Most mobile platforms behave similarly.
    – Jan Hudec
    Mar 9, 2012 at 8:47
  • 1
    @PeterTaylor: Going into the version control is not the issue here. Having to edit it is. The WinForms designer generates code that does have to go into version control, because the designer maintains the information directly as C# source. But it does not have to be edited by hand, because it's a partial class and manually written code goes in separate files. Yes, the diffs are as ugly as any other anything-designer-maintained data, but that's not a problem in practice.
    – Jan Hudec
    Mar 12, 2012 at 11:02
4

In general, I don't think GUI designers are a bad practice. The main benefit I think you would get from using a good GUI designer:

  • Faster GUI development and modification time.
  • You get to see what the UI will look like without having to compile and execute the program.

Potential problems you could run into:

  • Dynamic UI elements that are generated/managed at run-time are probably not possible with GUI designers
  • I've had problems with more complex GUI controls such as custom generic Controls in VisualStudio.
  • Generated code could also be a potential source of much pain and problems and if you try to modify it by hand the GUI designer might not be able to let you designe it anymore.

Of course, if you don't know how to properly use such a tool, then it could lead to problems very quickly.

3

It depends a lot, on the tool or programming enviroment, you are going to use.

Most of times, a good GUI designer (a kind of code generator) is good, where allows you to automate as much code as possible, and, at the same times, allows you to code, manually, special code, than cannot be automated.

G.U.I. designers, usually allow you to automate stuff related to position, color, format, style, and leave the logic or programming of the controls to the programmer.

Additional comment: The same goes for O.R.M. tools, they are code generators, too.

1

You need to understand what your code does. If someone comes to you and says "Why does this happen?", "Visual Studio made that for me, I have no idea" is not an acceptable answer. So long as you can find and resolve your own program bugs, there's no issue with a GUI designer, but once you find yourself fighting the program and unable to follow the logic, you need to back away from the WYSIWYG.

Your Answer

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

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