Design and architecture must be taken seriously. If you want to know more I recommend you this book:

Syntactic and Semantics

Writing code can be compared to writing text, so we must be aware of some syntactic and semantic rules. When you become a experienced programmer, practicing good code over and over this will feel a natural thing.

Until then you must monitor yourself while coding. Choose variable names, function names, built-in methods to give meaning to your code. Aspire to be a reference in your team. There is nothing more rewarding to a programmer than hearing from a colleague: “Hey what a job, your code is beautiful!”.

I want to give you a example of how semantic can change drastically the readability of your code.

Let’s imagine that we want to build a leaderboard of the most valuable players in the World Cup. We have 3 endpoints to an api:

Get all the team participating

Get the players

Get the goals and passes to goal

Our criteria like you may noticed will be the sum of goals scored and passes to goal effectuated.

You have two options. The first one is to put all inside a function called for example getLeaderBoard(). Imagine the code confusion with all mixed up inside this function, 3 fetch api calls, calculate the score and order the players, what a mess.

The second option is my favourite one.

function getLeaderBoard() {

let teams = getTeams();

let players = getPlayers(teams);

let scores = getScore(players); return scores.sort((firstPlayer, secondPlayer) => {

firstPlayer.score - secondPlayer.score;

});

}

Notice how the semantics and syntax help you to read this functions. Plus everything is isolated in other functions. Easier to maintain and easier to test.

If you want to read more about clean code:

Write Tests, if Possible Embrace Test Driven Development

Tests are often connoted as a waste of time, but they are a time saver. Imagine that you do an awesome system that makes you earn a lot of money. You detect a flaw on it and now you want to change it.

But there is a problem there aren’t any tests in your codebase, what a waste of time.

Writing tests allows you to gain more confidence in your code, it’s the ultimate tool to enslave your code and do whatever you want with it. But there is another benefit in tests, they allow you to use your own code as a third party library.

You will anticipate the pain of your colleagues using what you just developed. Then you are in time to improve and be admired by your colleagues, by the good code you produce.

TDD is the last thing I want to talk about in this section. Test Driven Development, it’s a way of coding where you first develop the tests and see them fail in the first execution.

Now the advantage of TDD is in this point, after you develop the test you develop the minimum code to make the tests pass. And you iterate over the two parts until you reach your solution with a minimal amount of code.

Less code, less problems. If you want to know more about this topic read the book:

Review Your Code, Review the Others Code and do it Again and Again

This last topic is very important. This is one of the most fast ways to improve your coding awareness. First ask if you can among your team to make code reviews. Then every time you finish some task, review your own code.

By reviewing the others code, you can exchange ideas with the authors of the code and absorb good practices.

By reviewing your code, you can improve the quality before it gets reviewed by another person.

Hope you enjoyed this article,

Stupid Gopher