Learning the language

One way to alleviate the problem with ‘naming’ in programming is to write code using the jargon of your client’s business.

With every new skill, comes a new bundle of terms that separate the complete novice from someone on their way to mastery.

When I was learning guitar for instance, I took the time to learn how to read written music in the form of tabular notation, when to down-pick or up-pick, when to slide down the neck or bend the strings. Learning the shorthand notation of chords and the patterns to major, minor, seventh and diminished chords allowed me to experiment with music and create new melodies.

In the same way that learning the language of music has helped my guitar playing, when I take the time to learn the language of a client’s business, I can communicate with my client on a meaningful level, transforming their business logic directly into the website.

This sounds like a high-level concept, but I like to apply it to code too. They say that one of the hardest problems to solve in programming is naming things — and one way to alleviate this burden is to write code using the terminology of the business.

Here’s a simple example that explains the concept of ‘naming’ for non-technical readers. So if I’d like my cursor to move right, I’d have to write a series of code asking the computer to do this. This piece of code can be grouped together in a function and given any name you choose, so that next time you’d like the cursor to move right, it would do so automatically under this name.

Mike: Learning the language

Let’s fast-forward to high-level coding.

On a more practical level, if I’m knee-deep in writing a Shopping Basket implementation and I find myself adding a Coupon that is defined by a type (fixed discount or percentage discount) that maps to a value discount from the database, then maybe it’s time to rethink and rewrite my code. At the end of the day I want my code to read like a book.

So, a line of code like the below…

Mike: Learning the language

…could be rewritten in a more legible way:

Mike: Learning the language

Once you learn language, you’ll find you’ve opened up a world of resources. The musician’s culture was something I previously couldn’t relate to, but learning the language opened up the door to an entirely less foreign musical mindset where previously illegible articles became understandable, and conversations with other musicians started making sense.

Every business is different and has a different language that has to be learnt before you can hope to contribute to it’s success.