Gosha The Engineer (ep 4)

Alexey Surkov
2 min readNov 23, 2020

How to write good code

When Gosha was only starting his professional life as a new graduate, he was sure that good code had to mean complex code. That was somehow the takeaway he got from all his college years, from all those courses on algorithms and data structures, seminars about subtleties of compilers and lectures on formal language theory.

It made a lot of sense. Many people could write Javascript code for a website, but only few could implement an algorithm to balance a binary search tree. It seemed reasonable to Gosha that the latter and not the former should be considered better engineers.

After working in many teams and projects, Gosha started to actively dislike complex code. Complex code meant code that only the author understood in its fullness, and in most cases that meant someone who left the company long before Gosha joined the team. Complex code meant bugs that people were afraid to fix, it meant something old and unpleasant. It meant legacy.

Finally Gosha came to the conclusion that good code meant an easy to understand code that was solving a complex problem. People primarily write code for other people who will have to deal with the code after them, not for the computers.

A wise man once said: “Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live”. That made so much sense to Gosha. Unfortunately very few people read that quote.

And yes, Gosha also learned that Javascript code for a website can sometimes be a very, very complex engineering problem.

--

--