Programming Practices – Is Programming All About Algorithms?

programming practices

As a grad student, I find it more and more common for prestigious companies (like Google, Facebook, Microsoft,…) to put algorithm questions in their test and interviews. A few startups I applied to also asked about algorithms. I wonder if algorithms fluency is the most important thing for software developer in those companies?

If the answer being yes, what are the best method or resources for one to learn & practice about algorithms effectively? I can't seem to get interested in solving seemingly too complicated problems found in most textbook or websites. Though easily understand basic algorithms (like quicksort, bubblesort,…), I find it immensely difficult to remember and reuse them later.

Thanks.

P/S: If you ask me what I like, it's building good softwares to solve users' problems innovatively. I suppose that does not necessarily mean the software has to be very complicated.

Best Answer

Algorithms are clear

Here's the beautiful thing about algorithms: The problem space they deal with is well-defined, i.e. your requirements are not only actually known, but usually even formalized much like the metrics for the solution's quality.

So if I tell you to come up with an algorithm, there isn't much potential for communication problems, and measuring your performance is a trivial task. At the same time your performance is a fairly good indicator for your ability to think logically.

Algorithms are an efficient filter

The current problem of the industry (and the education) is the poor average quality of graduates. This has been illustrated with the FizzBuzz test, which is:

Write a program, that will go through the numbers from 1 to 100 and will print "fizz" if the number is divisible by 3, "buzz" if it is divisible by 5 and the number itself if it is divisible by neither.

Apparently, the majority of all Comp Sci graduates fail to solve this problem. Please note that this is an algorithmic question, although of course an embarrassingly simple one. Given this, getting someone who can solve the kind of problems given in Google Code Jam or Project Euler, you're already enjoying the crème-de-la-crème.

Algorithms are a tiny part of software development

The truth is, as soon as you work in the industry, you will not be using your algorithm skills more than 1% of the time.

Before you even start writing code, you must first gather and analyze requirements. Then you must synthesize your design based on them. Then you must implement the design. Then you must evaluate the implementation against the original requirements, then iterate the requirements, then iterate the design, then iterate the implementation and so on.

One of the requirements is sensible performance. If that requirement is not met, you must profile your implementation to track down the bottlenecks and then you can optimize it, which sometimes is a matter of straight forward micro-optimization (which is rather easy to do), but sometimes is a matter of using better algorithms (which is not always easily done afterwards). Therefore:

Algorithms are critical

The better your grasp of algorithms, the bigger is the chance that you get it right the first time. Otherwise, you're not only likely to run into a problem that can only be solved by implementing a better algorithm, but also you will be unable to actually solve it.
So while you almost never need this skill, it presents a single point of failure in your development methodology and if you don't have the skill, you can only hope that the necessity never arises, or that someone else jumps in to fix it for you.

What is really important is to get a feeling for computational complexity and how to keep it low, as I also explained in response to a similar question. Or to specialize in things where this simply isn't important, such as GUI development, but then again almost everybody hates it ... for a reason!