Why code is about people and not about computers
May 14, 2021
#teamwork

Why code is about people and not about computers

Itā€™s easy to think programming is for- and by computers. But at itā€™s heart programming is just about people. This sounds obvious, but itā€™s easy to lose sight of the fact that it is actually for- and by people. Weā€™re programming to accomplish goals for people, not computers. At times I need a reminder for this and maybe you do too.

Code makes sense

I personally started coding because I love the logic of it. I definitely have some of the stereotype characteristics; socially-awkard, middle-class white male from the early 90s. Although there was plenty cool stuff to do out there, I always struggled to deal with people. People are not always logical where computers always are. Easy!

When I started I thought code was all about the computer. Making it work as fast as possible, following every single good practice I could find. How wrong was I..

Letā€™s start by asking ourselves; what is the definition of ā€œcodeā€?

In computing, source code is any collection of code, with or without comments, written using[1] a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the work of computer programmers, who specify the actions to be performed by a computer mostly by writing source code. The source code is often transformed by an assembler or compiler into binary machine code that can be executed by the computer.

By just reading at the definition there might already be a clue here. Weā€™re using programming- or code in general to -help- us humans talk to the computer and reach our goals. No shit Sherlock!

Code should help people

When your working on an assignment itā€™s common (I fall for this every single time) to entirely focus on what might lead to best performance for my code or whatā€™s the intended best practice of a language or framework your using. In the core of it, thereā€™s absolutely nothing wrong with that. I mean, your trying to get the best result right?

However have you considered if you colleages will be able to work with this or will they totally stress out by the idea only? Does this also benefit the assignment your programming for?

I have a personal example. For a while now Iā€™ve been trying to get colleages motivated about getting more into the world of JAMstack. Because I think it could add a lot of value for several of our customers.

So I started using it in several projects, but nobody else was really on board just yet. I shared some of the results, people liked it, however they didnā€™t actually understand the working of it.

In the meanwhile I continued working implmenting this in projects and by then I really started finding a way of integrating it nicely within our current projects and workflows.

By now almost a year later several people have to started working on this. And by now I came to realize that nodoby actually has an understanding of whatā€™s going on in those projects. The code is totally fine, but I never really considered how my colleages would use- and understand it.

Only people need to read and understand the code by looking at it

At first there were loads of questions. I didnā€™t really document anything and they had hardly any experience with in the matter.

Well them not understanding is their problem right? They havenā€™t bothered studying whilst you did. Well if your colleages are total dumbasses, sure. However I dare to bet theyā€™re not.

In some cases; yes. Mostly not. Thereā€™s loads of thing I could have done different. I could have documented better; kept the code simpler, etc.

In the end itā€™s way more important that another programmer is able to understand your code as that a computer can. Computers will compile it anyway. As long itā€™s syntactical correct there wonā€™t be an issue here. Iā€™m not saying you should totally forget about good practices and performance. But itā€™s important to make sure everybody is still able to understand whatā€™s going.

What if you donā€™t?

Remember how it feels when you have to debug some elseā€™s project and itā€™s one big jungle, without any structure that makes sense to you? Documentation? Forget it! Some comments maybe? Nope!

Sucks right? So just do it.

Some guidelines

Thereā€™s some really simple things you could do to help others understand you code. Here some examples of things I try to use.

Follow common design principles ā€“ Design principles exist for a reason. If you stick with common patterns it will be easier to understand how code is structured.

If youā€™re using a Framework, stick with itā€™s philosophy ā€“ If your using any type of framework thereā€™s usually a predefined way a project should be structured and some default framework functionality and utilities. Use those, this is the same for everyone and will therefore help others.

Use correct naming for variables, functions, classes, etc. ā€“ Thereā€™s nothing wrong with a long name if it creates clarity on what is/does/contains

Comment your code if somethingā€™s a bit complicated, or for example if youā€™re doing something out of the ordinary. This helps other (and yourself in the future) understand why something is done the way itā€™s done Comment a link to a stackoverflow article if thatā€™s used for some code fragment. Youā€™ll thank yourself later if youā€™re debugging it

Write documentation on what youā€™re building ā€“ It doesnā€™t have to be a full book. Just a few lines, depending on the size of what your building. Also add changes, and why they happened. This should be something that takes a few minutes at most. Donā€™t make it too big. This helps others understand what something is about and how it works. Tip: Use the Wiki on Github/Gitlab.

If your sticking with those simple things, it wonā€™t take much time. Wouldnā€™t you love it if all your colleages would do this?

What else could you do to help others- and not just the computer understand your code?