41
24
Your boss asks you to write a "hello world" program. Since you get paid for lines of code, you want to make it as complex as possible. However if you just add nonsense lines, or obviously useless or obfuscating stuff, you will never get it through code review. Therefore the challenge is:
Write a "hello world" program which is as complex as possible under the condition that you can give a "justification" for every complexity in the code.
The required behavior of the program is to just output a single line "Hello world" (without the quotes, but with a newline at the end) and then exit successfully.
"Justifications" include:
- buzzword compatibility ("Modern software is object oriented!")
- generally accepted good programming practices ("Everyone knows that you should separate model and view")
- maintainability ("If we do it this way, we can more easily do XXX later")
- and of course any other justification you can imagine using (in other situations) for real code.
Obviously silly justifications will not be accepted.
Also, you have to "justify" your choice of language (so if you choose an inherently verbose language, you'll have to justify why it is the "right" choice). Fun languages like Unlambda or Intercal are not acceptable (unless you can give a very good justification for using them).
The score of qualifying entries is computed as follows:
- 1 point for each statement (or whatever the equivalent to a statement is in your language of choice).
- 1 point for each definition of a function, type, variable etc (with the exception of the main function, where applicable).
- 1 point for each module use statement, file include directive, namespace using statement or similar.
- 1 point for each source file.
- 1 point for each necessary forward declaration (if you could get rid of it by rearranging code, you have to "justify" why the arrangement you've chosen is the "right" one).
- 1 point for each control structure (if, while, for, etc.)
Remember that you have to "justify" each single line.
If the chosen language is different enough that this scheme cannot be applied (and you can give a good "justification" for its use), please suggest a scoring method which most closely resembles the above for your language of choice.
Contestants are asked to calculate the score of their entry and write it in the answer.
any points for complex building needs? like different build files for each (self made modular) library – ratchet freak – 2012-02-04T23:11:01.837
3
I've seen this before: http://stackoverflow.com/questions/2052137/code-bowling-on-hello-world
– ChristopheD – 2012-02-05T00:51:48.3577Somehow, these 'gimme more, more, more' - challenges only look interesting for 5 minutes. Let's do a ProxyPoolFactoryPoolFacadePoolProxyFactory (Pool)! You need a restriction like: Finish in 20 minutes from now! Another problem is 'silly justifications will not be accepted'. It's not only subjective, it is void from the beginning, since we know, that the whole thing is silly. Okay - instead of a ProxyPoolPool, let's use something less silly, a PoolProxyProxy probably? – user unknown – 2012-02-05T07:05:24.387
1@ChristopheD: While I didn't know that SO question, there's a twist in mine which is not in that one: You have to "justify" your choices (i.e. just making it more complex doesn't suffice, you'll have to give a good reason for the complexity). – celtschk – 2012-02-05T08:34:57.083
@ratchetfreak: An additional build file is an additional file. Therefore it will give an additional point as of the rules as stated. Provided you can "justify" that complexity, of course. – celtschk – 2012-02-05T08:36:37.080
1@userunknown: There is such a restriction: You have to "justify" each choice. You'll have a hard time to justify your
ProxyPoolFactoryPoolFacadePoolProxyFactory(Pool)
. – celtschk – 2012-02-05T08:39:41.133@userunknown: Another point: Note that overly long or complicated variable names do not give you points. – celtschk – 2012-02-05T08:45:12.407
Genetic Algorithm FTW! – elssar – 2012-02-05T08:53:57.107
@elssar: Given that it's not an optimization problem, I think it will be very hard do provide a not obviously silly justification for it (see the requirements). Of course you are free to try. – celtschk – 2012-02-05T09:04:43.753
@celtschk isn't optimization a buzz word? – elssar – 2012-02-05T12:13:50.227
@elssar: There's a big difference between optimizing your code and coding an optimization. Hmmm ... thinking about it, if the genetic algorithm is part of your build environment (to get optimal "Hello world" code) it might be justifiable. But no silly things like genetically "optimizing" the output string. You have to be able to argue that it makes the resulting executable better than the straightforward way (it doesn't need to actually make it better, of course, but it should at least look as if it could). – celtschk – 2012-02-05T12:34:25.823
3I'm not sure that the "not obviously silly" restriction on the justification can be made to agree with the FAQ where it says "All questions on this site [...] should have [... an] objective primary winning criterion". – dmckee --- ex-moderator kitten – 2012-02-05T17:15:15.350
21
It seems hard to beat GNU Hello World (http://www.gnu.org/software/hello/) - the source code for version 2.7 is a 586 kB download as a compressed archive, complete with automatic tests, internationalization, documentation etc.
– han – 2012-02-06T16:04:32.057Java programmers won't have to try very hard for this one :) – Nathan Osman – 2015-11-02T23:41:11.163
Makes me think of a youtube video: Mortgage-driven Software Development
– Sylwester – 2013-12-30T19:30:36.003Related: article includes a Hello World in audible Morse code, generated from Python: http://thelivingpearl.com/2013/01/08/morse-code-and-dictionaries-in-python-with-sound/
– Paul – 2014-01-01T11:14:17.390I am surprised nobody did a DCOM or CORBA version so that you could run hello world from anywhere. Something like: http://www.codeproject.com/KB/COM/HelloTutorial7.aspx
– Jerry Jeremiah – 2014-10-22T21:14:04.837