Skip to main content

Posts

Showing posts from January, 2017

Applying clean code principles to Deluge script

Robert Martin's seminal book "Clean Code: A Handbook of Agile Software Craftsmanship" lays out a set of best practices for writing code that is easy to understand and therefore easy to maintain. The examples he uses are for Java code but that does not mean it is not applicable to any other language including Deluge script.

Some of the principles I think are particularly valuable are:

1. Use meaningful variable names
I've worked with quite a few subcontractors who use really weird and indecipherable variable names like "a" and "ref" or "B22". It leads to all kind of problems down the line because only the original programmer has any clue what the single letter variable actually means.

I recently encountered an issue where code was written with Excel cell references based on an Excel specification from the client.

One of the On Input scripts looked like this:

E22 = B26 / B5;

This was exactly what was in the Excel specification but the prob…