Beware of Stack Overflow

TLDR; Over-relying on quick solutions via Stack Overflow (or just goggling) will turn you into an addict who cannot solve any problem without a well-and-tested solution already present and served on a plate.

Let’s face it guys: what do you do (almost) every time when:

  • your code doesn’t compile and you can’t find an error in your syntax/logic;
  • you need to find the best library to do regexping, parsing of html/ini/xml/whatever, etc.;
  • your friend told you how important swap-and-exchange function is, and you happen not to know what stuff;

?

Google to the rescue! Probably somewhere on the first page you will find the link to our favorite Stack Overflow, which is definitely a better place than some poor forums (especially those in Chinese!) with low quality answers.

You might ask yourself: what is wrong with this approach? It lets you find answers in a flash (“Look boss, I am so good that I created this nifty function that will solve all our problems”) and probably get a broader spectrum of the whole problem (where several people reply to one question).

The issue with the above approach is that you become addicted, too addicted to answer that is already there. And if there is no answer available (or you can’t find one)? Many developers that I’ve worked with chose the way named hack-your-way-through-the-problem. In other words, they started using friend declarations (C++), macros (C), reflection (Java/C#), allow all (Apache!) and many other things your mother warned you about.

I believe that the need of being quick first, and good later, has given rise to a horrible disease that prevents you from being a good developer. So what is your idea, Einstein – you may ask.

Every problem you face has some roots. There are NO problems that are artificially created and just happen to be there. If you code is slow then it means that you used a bad algorithm, you have problems with cache coherency/locality of reference, you are copying instead of moving, etc. If you had known the intrinsic of every entity you use, most of the problems you face would be trivial.

That is why I propose you the following algorithm of solving your problems:

  1. As crisply as you can, define the problem, NOT the symptom.
  2. Look up in the official documentation (of a product/language) a chapter devoted to the given problem domain.
  3. If you have access, check out books regarding this problem.
  4. Analyze the CONTEXT and fit your problem in the frame you grasped.
  5. Try to find the cause of your problem. If you have succeeded, go to point 8.
  6. Use Google to search pages devoted to this problem.
  7. Search until you find a solution and be sure to understand why the problem appeared and what are other possible solutions.
  8. Rejoice!

Remember:

  • (almost) every programmer can find an answer on the internet;
  • (almost) every programmer can write a code that more-or-less realizes a required business logic;
  • only a good programmer have the will to dive deeper and find the root of the problem;
  • only a good programmer have the intellect to understand the problem;
  • only a good programmer can write good code.
Advertisements

Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: