Give Clean Code the Importance it Deserves

What is clean code? Why is it important? How important is a programmer’s native language in all this? How can stakeholders and programmers approach the matter? 

What is good code?

It seems that when we begin our careers, good code is more related to things like performance, reliability, flexibility, etc, but not so much with code’s readability. A couple of years down the road we come to appreciate the importance of writing code that is crystal clear. To me, good code has to be readable code. Don’t take it as a necessary and sufficient condition, readable code can surely be bad, but if the code is unreadable then it can’t be good.

So, what is readable code anyway? Quick answer: code that humans can easily understand. But how do we make it readable? How can we tell when we are writing readable code or not? Truth is, there is no quick answer. In the rest of this article I am going to give you some ideas on how to go about writing readable code and why I think it is so important for programmers and business stakeholders. Let’s begin with the “why”. Why is clean code so important?…

Whose product is it anyway?

In the business of custom software development, each product we create is our client’s product, no doubt about that. They can do whatever they want with it, use it internally or sell it to somebody else, but most importantly they can extend or modify it themselves. To do that, what they need is to have the source code. So when we build software for our clients, we deliver not only the executables but the source code to them.

What if the code we gave them was incomprehensible by any other developer? Will they be able to extend or modify it later? Let’s use an extreme example:

Think about javascript minification. Minification is a process in which a file is transformed into a very compact version of itself, by removing spaces and by replacing variable and function names by shorter character sets like this:

1

var age = getAge(user);

will get transformed into:

1

var a = b(c);

When we release a javascript file into production we want to have it minified, not only because it saves bandwidth (javascript files are shortened when minified) but because it also makes it really hard for others to reuse the logic embedded in the code. The structure of the code is the same as the original, but since we made variable names and method names meaningless, the logic is now almost impossible to understand. So, we are protecting (very basic) the intellectual property of that piece of code by making it unreadable.

The point is, giving our clients unreadable source code for their products can be compared to giving them the minified versions of our files. They wouldn’t be the actual owners of the product, would they? They wouldn’t be able to understand the logic in order to extend or modify it. They would always need us to do any modification or extension to the product.

Even more so, what if the client comes back to us 1 year later to have the product modified and the team that worked on it is no longer available? Will other team be able to work on the product?

Who wrote this?!?

90% of the times a programmer is confronted for the first time with source code written by others, they won’t approve of it. You will find them saying things like: “What is this thing doing here?!?” “What is this for?!?” “Where is this coming from?!?” “Who wrote this?!? I will find you!”

Read full post...

5 Comments

  • Actually, I used to read one particular guy, but your posts are almost good as his.

  • You can use a same-day resume writing service if you're in a hurry to get your resume in front of a possible employer. All you have to do is provide an experienced writer with your current CV and professional details, and they will get to work. Within 72 hours after reviewing your materials, the writer will generate a draft. You can request adjustments if the initial draft does not meet your standards.

  • These days, I feel very good with good weather. But the air is not good because of yellow dust. You should pay attention to your throat care during the change of seasons. You'd better wear a mask.

  • I came here by link while looking at other sites. There were many news articles, so I saw them. I will visit often and get news articles. I hope it will help my writing skills.

  • The Publix Customer Satisfaction Survey gives you a fantastic opportunity to win gift cards worth up to $1,000. It is true that you may enter the <a href="https://publexsurvey.online/">Publix Customer Survey</a> and enter to win up to $1,000 in gift cards simply by sharing your thoughts about the company's customer service.

Add a Comment

As it will appear on the website

Not displayed

Your website