The need for basic Computer Science

published: Fri, 29-Apr-2005   |   updated: Thu, 27-Oct-2005

(Note: an older version of this article was originally posted on Sunday, 27 June 2004, in the now defunct Falafel Flogs site. This version has been edited for English and brevity and the contained links updated.)

Is it worth the time and effort for a self-taught developer to learn the basics of Computer Science? An unequivocal yes, in my view. Knowledge of the standard structures and algorithms will help anyone; but understanding how to analyze the behavior of your code will, to be frank, enable you to make it run faster and more efficiently.

The trend though in software development is to make things easier. Bolt a few controls together on a form, whack in a few SQL commands, and whammo, an application gets delivered and let's move onto the next. This is, I think, s dangerous trend. We are losing the ability to analyze different strategies or algorithms for implementing our programs, and to select the best one or mix of the better ones.

Unfortunately, there is a counter-trend as well: knowledge of just enough Computer Science to make the developer dangerous. For instance, the developer who believes that quicksort is always faster than insertion sort and so uses it mindlessly is wrong, but subtly wrong.

I am certainly not advocating that developers should get a CS degree before they're given the keys to an IDE. Unfortunately, I'm not a great fan of the average CS graduate's abilities to do commercial software. I've seen too many recent CS grads as interviewees fail at the first hurdle. ("Did you do binary search trees in your CS degree?" "Uh, yes, I think we did them in the first year." "Well, could you describe the essential benefits of a BST versus a sorted array?" "Actually, I don't remember anything about them.")

The books out there don't help too much either since they tend to be biased towards the undergraduate pursuing a degree in CS. In my own book, I tried very hard to pitch the text at someone who wrote Delphi software for a living and who wanted to understand some of the concepts behind good software. I think I succeeded at this in some chapters, whereas others didn't work out too well.

On the web are some bloody good sites that not only show you the data structures and wotnot, but also have some snazzy Java code showing you how the algorithms work in a very visual way. (Check out this page for an example of a Java applet that shows how AVL, red-black, and splay trees work. This even helped yours truly get a better feel for them.) This kind of visual display is amazing and gives you a great feel for the intricacies of binary tree rotations. Another is the Exact String Matching page that discusses a good baker's dozen of algorithms for finding one substring in another.

Despite all this, web sites that discuss algorithms tend to be academic (the latter site I just mentioned gets very mathematical very quickly). This is fine — of course we need to be able to discuss algorithms in a rigorous way — but it scares off the non-academic developer very quickly.

With the .NET Framework and the Java libraries, and especially with the STL, we're given some very high-powered classes, but it's sometimes hard for the untutored-in-CS developer to know which to use, and what the pros and cons of his choice are.

To help the developers reading this who do want to learn some of the basic algorithms of their craft (without delving too much into the mathematics behind them) I'm going to continue writing articles on the subject here on my own web site, and occasionally in The Delphi Magazine. If there's any basic CS topic you'd like to see covered let me know.