free html hit counter
Posted on: Saturday, April 4, 2015 by Rajiv Popat

Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1?

I recently wrote a book on how we as professionals need to stop whining and start focusing on developing our skills.

One data point that I obtained for the book (but didn't quite include in the book because it was too programmer centric) was based on 22 job interviews for programming positions I conducted for one of my clients over a period of two months.

Though this is hardly a considerable sample size, it did reveal some interesting facts about programmers. There were two seemingly disconnected questions that we asked at completely different moments of time during the interview:

  1. Talk about a few things in your current organization or manager that you don't like / aren't happy with.
  2. Solve a simple programming problem (one that was much easier than the famous Fizz Buzz problem).

The goal was to study the correlation between whining and coding abilities. Here's a subset of the data we collected (of course I wasn't carrying stop watches in the interviews so the minutes have been rounded up to an interval of 1):

Even though there are some exceptions in the above data set if you look at the graph what's evident is that there seems to be a strong co-relation between whining and being able to solve ridiculously simple programming problems.

That was interesting. But what was even more interesting was the actual program the candidates were being asked to solve. If Jeff Atwood wonders why programmers can't program, when they can't solve Fizz Buzz; here's a problem that is much more easier than Fizz Buzz and yet:

  1. About 14% just couldn't solve the problem in less then 10 minutes - which is when we moved on to the next question.
  2. About 40% took more than 5 minutes to solve the problem and / or had to be corrected more than once.
  3. Only about 14% could solve this problem in 2 minutes or less.
  4. About 82% had to be corrected at-least once before they solved the problem. (which means they actually got it wrong the first time around!)

And the problem they were solving?

Print 100 to 1.

That's it.

That was the question.

The Catch?

You need to start with "for(int i=0;" and continue from there - you cannot write anything before "for(int i=0;" and you can't use two loops.

[Update: This is supposed to be a code snippet which already exists inside a function, so you can safely assume that inclusion of headers and declaration of the functions etc. is already done for you and you don't need to worry about that.]

Go ahead. Try it out. The answer really won't take you more than 2 minutes and should not take more than 4 lines of code including the curly braces but you can write as many lines as you want.

If you get the right output without mistakes in a reasonable amount of time we consider the answer correct.

Go on. Try it. And once you've solved it - go on and make it a part of your interview process and see countless programmers fumble, take really long pauses, struggle and even give up on the question.

Personally, I came across two programmers who said they could not do it because the question was too complicated after over 10 minutes of struggling with the problem.

While this little experiment establishes correlation between whining and skills it doesn't establish any causation. In other words the data doesn't really tell us if programmers whine because they just don't have the skillsets to do their job, or programmers don't have the skillsets to do their job because they whine. 

Maybe our programmers are not skilled because they whine a lot or maybe they whine a lot because we've lowered our bars of what we expect from our programmers and don't demand or challenge them enough to even practice the most basic programming skills.

Either ways the sad reality of where the IT industry stands today is that you don't even need Fizz Buzz to differentiate a bad non-programmer from a good one - Just asking them to print 100 to 1 is usually good enough.

[Update: A lot of folks seemed to get an idea that this is a black and white question and that you can make a hiring decision based on this. It's not. But it does give you an important data point to evaluate someone. For example, if someone clears this question and then fumbles at other basics it might be a reason to not hire him / her. At the same time if someone doesn't answer this and go on to answers other complex algorithmic questions really well, you may decide to hire him / her. Putting the candidate at ease is also important here. The candidates should not be asked or pushed to solve the question in less than 2 minutes. The goal here isn't to stress out the candidates. The goal is to watch them think about and solve a simple problem. Merely present the problem to them and watch their approach and time taken. Couple that up with their tendency to whine and the question provides some very useful insights about a person's approach towards solving problems and their ability to ship.]

[Update: Thanks to the folks who were rightly annoyed by the confusing visualization / chart done in the original post and pointed out how confusing that data visualization was. Special thanks to Jacob for creating the scatterplot using the same dataset. Post updated with the scatterplot.]

posted on Saturday, April 4, 2015 8:11:10 PM UTC by Rajiv Popat  #    Comments [65]
Posted on: Saturday, March 28, 2015 by Rajiv Popat

That's Not How Much They Pay. That's How Much They Pay You.

People who work in IT (or for that matter any industry) can be grouped in three categories:

  1. The Builders - folks who actually build stuff and get things done.
  2. The Story Tellers - folks who weave remarkable stories around what's getting built and help sell what builders build.
  3. The Whiners - folks who complain about why they cannot build remarkable products or weave remarkable stories.

A lot of this blog has been about what companies can do to build environments and cultures that seeds and grows builders and weeds out whiners. A good part of what I wrote about back in 2009 was about that.

Then I grew older.

When I look at the software landscape now I realize that in our search for a perfect organization that can keep us motivated and engaged, we as programmers, may have become incredibly demanding and often even unfair about what it takes for a company to make and keep us happy and productive.

As Joel Spolsky puts it in one of his discussion groups:

I still haven't met a great programmer who doesn't have a job. I still can't fill all the openings at my company.

(As programmers) Our pay is great. There's no other career except Wall Street that regularly pays kids $75,000 right out of school, and where so many people make six figures salaries for long careers with just a bachelors degree. There's no other career where you come to work every day and get to invent, design, and engineer the way the future will work.

Despite the occasional idiot bosses and workplaces that forbid you from putting up dilbert cartoons on your cubicle walls, there's no other industry where workers are treated so well. Jesus you're spoiled, people. Do you know how many people in America go to jobs where you need permission to go to the bathroom?

Stop the whining, already. Programming is a fantastic career. Most programmers would love to do it even if they didn't get paid. How many people get to do what they love and get paid for it? 2%? 5%?

I don't get the negativity in here. How did the Joel on Software discussion group turn into a mutual mope-fest for angsty emo girls.

It is one thing to objectively take a stand and disagree with your organization on something or even look for another opportunity if you aren't happy with your current job. It's another to systematically cultivate a depressed attitude towards your work life, take rash decisions and blame your organization for everything that's not quite right in your work life.

"The Times are Bad!"

"There are No good jobs left these days!"

"The economy is struggling!"

"Nobody gets more than a 10% hike now a days!"

"Of course I'm depressed! That's all my company pays!"

Ever heard these statements? Have you ever been the voice behind these statements?

About a year ago, I saw an entire group of genuinely talented programmers inching down this path of negativity and decided that I was going to do research on just how true the above statements are.

The research turned into a book and the response to the last remark - "Of course I'm depressed! That's all my company pays" became the title of the book:

"That's Not How Much They Pay. That's How Much They Pay You!"

The book is a collection of stories from my own life in the High Tech industry and a collection of research and studies done in the field of neuroscience and psychology that shows you the problem with today's work life.

The book builds on the premise that the problem in your work life today is not "the times", "the economy", sadist bosses or evil clients. 

The problem with today's work life is you.

The style of writing used in the book is a tad bit confrontational, but I do hope it brings you face to face with some of the biggest problems in work life today and then gives you the insight, science and tools to deal with those problems like a mature adult so that you can stop whining and start doing what you've always done - build stuff, weave remarkable stories and be happy!

The book is on Amazon.

It is a Kindle book but you can just as easily download it on your mobile device or tablet using the Amazon Kindle App.

I don't want to end up sounding like a cheesy self help guru who claims his book will change your life but I really believe it might give you value which is more than the price you pay for it. 

I'd love to hear your honest feedback and reviews both; on amazon and here. And I do hope that if the book inspires you or adds value to your life, you'll go ahead and spread the word.

posted on Saturday, March 28, 2015 10:52:31 AM UTC by Rajiv Popat  #    Comments [0]
Posted on: Sunday, October 19, 2014 by Rajiv Popat

Safely Disastrous.

Your brain will play tricks with you every time you inch aware from safe:

Doing that would be disastrous!

Let's stick to something which we've done in the past.

Something time tested.

Something... Safe.

There is an old saying that nothing in life is as good or as bad as it seems.

That saying is now supported by rigorous and legitimate... science.

Most of the times "disastrous" isn't as disastrous as you think.

Most of the times "disastrous" is just a figure of expression and all it means is:

Somewhat painful or borderline uncomfortable.

Most of the times safe or harmless is much more Disastrous than Disastrous.

What silent "safe" choices are killing your business or your career? The question isn't if you can identify these choices. The question is, do you have the courage to confront the safe and give disastrous a fair chance?

posted on Sunday, October 19, 2014 12:21:51 PM UTC by Rajiv Popat  #    Comments [0]
Posted on: Saturday, March 15, 2014 by Rajiv Popat

Time To Overcome The Always Mindset.

All Resistance often begins with an always mindset.

This is what we have always done.

What we have always said.

How we have always worked.

What we have always believed.

No doubt your organization isn't morphing like an living organism that adapts, learns, improvises and changes the way your business has always worked. Personal lives are no different:

This is what I have always worn.

What I have always eaten.

How I have always lived.

What I have always done.

The kind of people I have always been friends with.

No wonder your career and life isn't bringing you new and meaningful challenges.

No wonder each today of your life seems like yesterday.

The universe has peculiar way to doing what it has always done.

If you plan on changing the world, start with yourself.

Your team, your organization, your planet and your universe might follow; but only if you dare to move away from what you have always done and try out things that you have never done.

The question isn't can you; the question is will you?

posted on Saturday, March 15, 2014 2:53:37 PM UTC by Rajiv Popat  #    Comments [1]
Posted on: Monday, February 17, 2014 by Rajiv Popat

Minimalistic Artists - Part 1.

Some environments shout out smart.

That young random doctor in that fancy hospital for instance; The chamber, the white coat, the receptionist, the forms you fill before you are allowed to meet the doctor - all work to prime your brain with the belief that your doctor is smart. That you are in safe hands.

Software is no different. The plush offices of that smart product company, the bean bags, the large television screens on the corridor, the huge long passageways, the professionally trimmed grass in the gardens that surround the office - all designed to prime the customers brain to believe that the people who work in the company are really smart.

But what about that talented doctor who runs his own small practice and refuses to get a monthly pay check from that hospital?

What about that young programmer who decides to write his own application and not work for that development shop?

Or that writer who decides to publish on Kindle instead of going with a professional publisher?

Or that artist who sells his own painting instead of showcasing them at a known gallery?

When you decide to give up systems and environments which make your clients believe you are smart, you are left with only one thing that will convince your clients you are indeed smart and will make them keep coming back to your work:

You.

Here is to all individuals who don't need environments and systems to earn respect, attention, business and success.

Respect.

posted on Monday, February 17, 2014 7:19:36 PM UTC by Rajiv Popat  #    Comments [0]
Posted on: Friday, January 31, 2014 by Rajiv Popat

Remapping The Windows Key On Your Keyboard.

My obsession for making a PC look like a Mac dates back to 2006. The quest is just as much about exploring new tools and utilities as it is about the esthetic element of having a Zen like desktop. Here's what my desktop looks like today:

Getting a dock that looks like the Mac doc is easy.

And so is getting a free utility that shows your outlook tasks and calendar items on your desktop.

With the number of folks cribbing about the windows start screen, getting a launcher is even easier.

Most of them will automatically map to your windows key and start off when you hit the windows key on your keyboard.

I however; prefer the Zen like simplicity of Launchy; instead of having an obtrusive start button or a start screen.

It's open source and rather easy to grab and install.

Wouldn't it be amazing if we could just replace the start screen with the simplicity of Launchy when we hit the Windows button on our keyboards?

But Launchy options don't provide any settings to invoke Launchy when someone presses the windows key on their keyboard. For me this is a deal breaker since I'm so used to hitting the window key if I want to start something, learning a different keystroke to launch applications is just insanely difficult and I keep going back to the window key. I could of course disable the Window key but that would just make hitting two keystrokes to launch applications that much more non productive.

Remapping or reprogramming the default windows start screen with Launchy when the window key is pressed seemed like the only valid option if I was to use Launchy.

Launchy may not provide this out of the box but it does provide options where we can map invocation of Launchy to ATL + CRTL + Space; so we do that as the first step.

But we still want Launchy to replace the Windows Start Screen when someone presses the Windows Key on their keyboard.

Enter AutoHotKey.

If you don't know what AutoHotKey is, you should spawn a browser window right now and start reading. It is an amazing little tool that allows you to write tiny scripts for remapping keys and sending keystrokes, messages and do a lot more when specific keys are pressed on the keyboard. This is amazing because it just makes most of us geeks super-productive but what intrigued me was it's ability to capture the window key.

The first thing we do after installing AutoHotKey is Right click the AutoHotKey taskbar icon and click "Edit This Script" menu item. We then clean up the file and add the following line of script:

With AutoHotKey we have the option of sending multiple keystrokes when any key (including the windows key) is pressed, however, after having Goggled for hours on how you can remap the windows key on your keyboard to not show the windows start screen at-all, it seemed like there were no direct solution; until there was a sudden realization that when we hit the escape key the start screen disappears. That's what led to the creation of the above script.

In the above script we're mapping the left window key to first hit escape, then hit the ATL key (indicated by ^) + CRTL Key (indicated by "!") + Space (indicated by {Space}). So we basically hit Escape to hide the default Windows Start Screen and then send keystrokes to invoke Launchy.

After this script is modified you save it,  Right click the AutoHotKey icon and click the "Reload this Script" menu item. Once this is done you hit the windows key and launchy kicks of.  To put simply, you train AutoHotKey to not try to take control of the start screen, just hide it in milliseconds of it showing up.

The takeaway? Well actually there are two:

  1. It's very easy to remap the windows / start key on your keyboard to do anything you want it to by sending Escape key followed by the keystrokes you want to send. The escape hides the default windows start screen. The other keystrokes you send do what-ever it is that you want them to do (in this case it's opening Launchy).
  2. When Google fails; rely on Ocaam's Razor.

And now that you've remapped the windows / start key on your keyboard, have gotten rid of the Windows 8 start screen and have a minimalistic replacement for it, give your self a pat on the back and please get back to work. Oh and of course, spend some time on AutoHotKey - there's some serious damage you can do as a developer / geek when it comes to automating tasks and making yourself more productive with this tool.

Quick aside: The solution of automating the hit of escape key before sending other key strokes isn't full proof in scenarios where the application you are working with also captures the Escape key; but for most cases this should do the trick. If you know of a better way to remap your windows key I'd love to learn. Please drop a line in the comments section and let me know.

posted on Friday, January 31, 2014 9:34:10 PM UTC by Rajiv Popat  #    Comments [0]
Posted on: Saturday, January 25, 2014 by Rajiv Popat

Your Relationship With Your Ideas - Part 1.

Some ideas are demanding. They crystallize in your head and then they grab you by your collar demanding that you work on them. Others are more subtle and silent, gently whispering and seeking your attention. Some show up while you are having a shower and follow you through days, weeks and months occupying a silent calm place in your head. Some even spread like a virus and some have the potential of consuming your head and giving you a gush of dopamine much like Romantic love does.

Like any real life relationship your relationship with your idea also changes with the volume of time you spend with it and the amount of effort you spend on it. Sometimes you feel strongly attached to the idea when you spend more time on it. At times, you need to stop working on  the idea and give yourself a long break, to realize how much the idea meant to you. And some ideas, like some relationships, just don't work out. Some even die because of lack of attention or time.

Your relationship with your idea is just as real as your relationship with your spouse or your loved ones or your colleagues or acquaintances who you bump into.

Some of these "idea-relationships" will fizzle out; some will die a natural death; but given the right environment and encouragement, some of these idea-relationships will grow; so much so that you even end up giving it more importance than your own selfish interest or well being.

So the next time you hush an idea because you're too lazy to work on it or too scared of the consequences of a failure, think about the potential of forming a long term full filling relationship with an idea that can change your whole life and your entire existence. 

Not every acquaintance becomes a close friend and not every idea has to see the light of implementation, but the ones that bring you the promise of a better life, the spark of romance and the pleasure of flow deserve just as much time and attention as important relationships do in your life.

Your being busy with a full time job is not an excuse to ignore your relationships with your loved ones.... and your ideas.

I'm not a fan of new years resolutions. After all, the volume of will power in your brain is limited and will power is often overrated, but if an idea has been occupying a certain part of your brain and has been flirting with you for months, why not start by squeezing out just a couple of hours every weekend and going on a romantic date with that idea?

I'm not saying you have to finish every project you start; but it's also important to realize that your ideas deserve some work and a fair chance before they can start taking a life of their own

Just like any real life relationship, your intent and love isn't enough. Your ideas demand your time, attention, effort and serious work and they may still fail. But if they do take a life of their own, they have a potential of changing your life as well. Is your next idea capable of doing that? Well, the real question is, are you willing to put in the effort to find out?

posted on Saturday, January 25, 2014 8:59:37 AM UTC by Rajiv Popat  #    Comments [0]
Posted on: Sunday, October 6, 2013 by Rajiv Popat

The Fun Begins at Eighty Percent.

We like to imagine an author sitting in front of an empty document when an idea hits him and he starts slapping keys on his keyboard uncontrollably. Or an artist sitting in front of a canvas when he taken over by a jolt of inspiration and he paints his first strokes with a bold sense of certainty; the start of an amazing painting.

We like to think of innovative software products all around us as something that started when a talented programmer woke up in the middle of the night and did a "File / New Project"; then he proceeded to write code the entire weekend to ship something remarkable Monday morning.

Real life creativity however works very differently and anyone who's ever shipped any form of art, be it writing an article, drawing a picture or conceptualizing the developing a software product knows that it is often the start that is the most frustrating.

Start is when:

  1. Flow just isn't there.
  2. Self doubt of not getting anywhere and merely wasting time on an idea that won't materialize is at it's highest.
  3. Most crap is produced (there is a dozen posts with just titles on my live writer cache and over a dozen folders with project names craving attention on my personal hard drive) and thrown.
  4. An idea is tested for it's worth (and it's ultimate destiny).

The first 80% of the project is the riskiest bit where most personal projects get scrapped. And rightly so. Maybe you had to build on 80% of the idea to realize that it won't click. Maybe you had to draw more than half the sketch to realize that it does look hideous after all. Or write most of the article to realize that no-one other than you is going to be interested in reading it. Scrapping something at 80% done isn't wasted effort. It's Net-Practice. Effort invested to see if your idea will stick.

And if you do it long enough, throwing one bad idea after another after brining bits and pieces of it into existence, every once in a while, you are likely to bounce into an idea where you mulishly work on a project surrounded with self doubt and slowly but surely manage to cross the 80% threshold. You aren't utterly disappointed in the output. In fact, you secretly continue to admire it. Something inside nudges you to continue working on the project. This is when your self doubt starts to go down and the idea starts to take shape into something beautiful; something real.

This is where the fun begins.

When you reach the 80% mark, and you begin to see something real taking shape in front of you and you love what you see, magic happens. Suddenly:

  1. You're in flow.
  2. Self doubt of not shipping anything worthwhile starts melting away and eventually disappearing.
  3. The idea has proven itself (at-least to you).
  4. You know that if you push just a little harder you actually might be able to ship and find out if the rest of the world thinks like you do.
  5. You know that in reality you're not 80% done at all; but the end does look achievable and absolutely stunning.

For all you know you might still be shipping crap; but the fear of failing has suddenly given way to the curiosity of finding out how awesome your idea truly is. This is when most creativity thrives, flow happens and one serendipitous thought gives birth to another. True you're not just 20% away from shipping, you just think you are; but this is where you sign that silent unspoken pact with yourself that you will ship this idea. That this idea will come into existence. That you will give it all you can; so that it gets a fair chance at surviving when it is shipped.

Of course; you're nowhere close to shipping; and not even in the same vicinity of "completeness" that you want to be in. But then, 80% done is usually when you can stand back, look at the piece of art, and see is getting born. This mere act results in nothing but pure geek awesomeness. This is where you can stop worrying about the bigger aspects of success (or survival of the idea) and focus on the small intricate details that will make your art amazing.

And yet we spend so much time glamorizing The Start or The End, when in reality 80% done is where most creativity thrives; where most fun begins and the most rewards of intrinsic drive and happiness exist.

posted on Sunday, October 6, 2013 6:31:31 AM UTC by Rajiv Popat  #    Comments [0]