Saturday, September 13, 2014

FizzBuzz Program to test developers


This is not to be-little anyone, but since I am a Software Engineer and also love writing code, hence I get disheartened and feel sad when I find the truth. I do know it. And also, this has nothing in relation with India IT people because this thing holds true for all the software engineers across the world.

I recently came across a blog post which mentions about the horror that coders cannot program.

And what more, the real problem is that coders cannot write simple program.

What's the simple program which majority of the developers struggle to write?

The "Fizz-Buzz test" is an interview question designed to help filter out the 99.5% of programming job candidates who can't seem to program their way out of a wet paper bag. The text of the programming assignment is as follows:
"Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”."

It took me 5 minutes to figure out this program.

In fact, those who consider this test as easy and a piece of cake, would reflect negative thought that how do they view the work of coding and the development/engineering a software

But why is it so hard?

Before trying to describe that why is it so hard, here's the solution, it is not a scale able though

>>> def FizzBuzz():
...     for i in range(1,100):
...             if (i%3 == 0 and i%5==0): print("FizzBuzz")
...             elif(i%3==0): print("Fizz")
...             elif(i%5==0): print("Buzz")
...             else: print(i)


I have used windows 8 environment. Python must be installed for this.

Now call the FizzBuzz() function from the python interpreter.

The above solution works as we intend to.

As I have mentioned above, many programmers/coders struggle to write this simple program?

What could be the reason?

As a professional programmer, I have realized that many software engineers develop software which involves calling libraries, routines, data processing languages SQL etc. The usage of loops, recursion, solving a problem by designing an algorithm,  using an existing algorithm such as linked list, trees, etc does not happen in the majority of the software development. Barring the biggies, the rest of the software development is either writing an app by calling libraries or customizing ERP package. And we know how dead an ERP application is, it involves zilch amount of technical knowledge.

The only way to improve as a programmer is to write code consistently.  It is not writing code for a day, then coming back to touch it after a week. No art/craft or for that matter, no subject cannot be mastered without practicing, and it is the perfect practice which is required. Yes, in the beginning write code which sucks, then tinker with it, then learn the materials, hit the documents, ask people, but practice the art of coding.

Unfortunately, coding is termed as a dirty job and if things go wrong, then the coders are blamed first. But why is the situation so horrible? Because the bosses of the software industry knows the language of the business and don't know anything about the technology world. Their only viewpoint about technology is that this particular piece of package software is hot, let us put resources on this and mint money. And by the time the technology becomes obsolete, the bosses would have extracted wealth from the resources whose skills becomes outdated in this fast paced technology world. 

Coders must stand up now and fight for their rights. It is coders who bring good things in the IT world. Until and unless coders will de-value themselves, they will always be ruled by the bosses who cannot write 'FizzBuzz' program.

P.S.: If you are a Software Developer/Engineer and stumble upon this post, I will request to solve this FizzBuzz problem. Be honest with yourself, do not look or cram the solutions, and just do an introspect about ourselves, because, even good software engineers do struggle on this. 







No comments: