On authors and mathematicians

For a long time, computer science was just another branch of mathematics. Today, many computer scientists still think of their profession in terms of mathematical principles. But in the end, software engineering may have more in common with writing a novel than with solving formulas.

Imagining oneself in the chair of a novel author does not only make software development much cooler (Hey, we aren’t geeks any more. We’re authors! We are creative!). It also makes you watch your engineering tasks from a refreshing new perspective. Of course this approach isn’t the only one to programming, but it is a good one to engineering – where the task is to write code that has to be read and modified by other people.

There are quite a few points in engineering with can be easily explained with this metaphor:

Optimisation can be regarded as writing for a completely different audience. If you’re optimising, you’re writing something that’s easy to understand for a processor, but weird to a human. You should have very good reasons for straying from your core audience.

Guidelines are another point: Programmers will often come up with guidelines like “thou shalst not break from loops” or “thou shalst avoid having more than one return statement in thy routine”, or something like that. These are equivalent to authoring guidelines, such as “thou shalst keep thy sentences short”. In general, following those rules will make your prose easier to read. However, if following those rules makes things harder to understand, you should go ahead and break them. Design Patterns are, by the way, just a more advanced incarnation of such guidelines. They should also be viewed with a grain of salt. As should be other sets of guidelines such as “The Principles of Object Orientation”.

Keep in mind that there are many possible ways to tell the same story, and one isn’t neccessarily superior to an other. Like there are different styles of novel writing, there will be different styles of program writing. This is nothing to be concerned about – and it’s certainly nothing to argue about.

Finally, Code Smells are editing rules. They allow you to find the parts which are hard to read, hard to modify or redundantly expressed. If something is clear and easy to understand, it doesn’t smell. And once you’ve found the ill-expressed parts of your story you should refactor, which amounts to editing your novel so that your audience will finally get the point.


Comments are closed.

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: