Charlie Harvey

Programming with our communal exocoretex

There was recently a cartoon on xkcd that dealt with ineffective sorts. In the title tag it proposed the stacksort — a sort that searches StackOverflow for sorting functions and runs them until it returns a sorted array. Gregory Koberger liked the idea so much that he implemented stacksort.

Ineffective Sorts

I laughed at both the original title text and at the fact that somebody had taken the time to implement it. Laughter often stems from recognition. In this case for me it was the recognition of a particular approach to programming that has emerged with the internet. The approach is essentially orientated towards gluing together pieces of "found code" that result from a Google search into a new program rather than attempting to generalize existing code or to write from scratch or to write from documentation. Code reuse often happens in an ad hoc fashion rather than using the library or inheritence systems built for the purpose.

I was once asked at an interview how I would find the prime numbers between 1 and a million. The interviewer was disappointed when I said I would Google it. But this was clearly the most efficient solution to the problem; there are loads of lists of prime numbers on the internet and using programmer and computer time to calculate them is expensive and slow.

Alva Couch’s article "Programming with Technological Ritual and Alchemy", from the September 2010 FLOSSUK newsletter, considered this new style of programming saying that he taught "a new generation of students unfettered by my compulsion to understand and, as a substitute, fettered by their own compulsion to do and experience". He talks of his students ritualistic orientation and propensity to repeat behaviours that they didn’t fully understand as being generational and closely tied to the complexity of the software systems that we have built.

I am of the same mindset as Alva, engaging in a compulsive desire to peel back the onion layers until I comprehend everything. But a lot of programmers that I meet, especially youger programmers (with notable exceptions lest I generalize), don’t feel that same strong need to know. Indeed not needing to know has always been one of the tenets of computer science. Information hiding was always a way of controlling complexity. If I can Google a piece of example code and it just works then knowing exactly why, while interesting from a purely intellectual perspective, is of little practical value. Of course, old school programmers (like me) scream in horror and worry about what will happen when something breaks or when you need to solve a problem that is as yet undocumented. Which is a fair point. However, as Alva points out, most of the software systems we work with are now sufficiently complicated as to be beyond our ability to understand them. And Googling an error message often works out as well as digging through the source tree.

I am not at all advocating giving up on understanding, more pointing out that there can be great value in trusting our communal exocortex. Stack overflow will often find a good enough answer to a pressing problem and it will often be quicker to locate the answer that way than by slaving over a text editor. On the other hand there will also be absent answers, incorrect answers and answers that are slow when dealig with large inputs. Those occasions are the ones when you will really appreciate having spent the time acquiring some understanding. The rest of the time


Comments

  • You can use strong, em, code, pre, q and a HTML tags.
  • Comment and email are the only required fields.
  • Be respectful. You may want to read the comment guidelines before posting.

Privacy note: This form will forward your IP address, user agent and referrer to the Akismet, StopForumSpam and Botscout spam filtering services. I don’t log these details. Those services will. I do log everything you type into the form. Full privacy statement.