Code less create more (or less the same)

My wife just started to learn programming for fun, so I told her to start with Java, because it’s simple and quite straight forward. After she managed her first “Hello World” she was disappointed as no application popped up but the message was printed in a terminal. Well, I told her that these are the basics and she should be patient for what’s to come.

So, today I thought of preparing a GUI “Hello World” for her: A nice Button saying “Hello World” and when you click it, the app will quit. Simple, though, but what UI toolkit should I show her: Swing or SWT? I decided to go for both. Well, and, being a fan of Qt for more than a decade, I couldn’t resist preparing a Qt Hello World too. To my surprise, now I’m a little worried about having told her to start with Java, but count the lines of code and judge for yourselves:

Three way compare of Swing, SWT and Qt

Alright, I didn’t need a header file yet, but still, it’s the implementation code that counts, don’t you think?

2 comments to Code less create more (or less the same)

  • Jörg Ohnheiser

    But Lines of Code are not a good indicator for good Code for Beginners. I think the Swing code is easy to understand the qt is a more Vodoo or Magic for me. I would like to see a Example in GWT too.

    PS: if Lines of Code would count the old Visual Basic 6 would win, i think it’s 5-6 Lines of Code (1 -2 Line without declaration)

    • robert

      I agree that lines of code might not be the best indicator, but what’s so voodoo magic about creating a “push” button and connecting its “clicked” signal to an applications “quit” slot. I can’t think of anything more intuitive than that, maybe a better syntax, alright, but the semantic is superior to the observer pattern in my opinion. Its already half the way of the MOVE pattern.

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>