There is no better moment for me than starting a brand new project.
Smells like new project spirit… (Whatever it means)
Starting a new project is funny. Everything seems to be in the right place. But as the projects grow and the deadlines come closer the things begin to boiling.
So, let’s talk about signals that can tell us if our code sucks and we how we can avoid that.
Everyone is afraid of adding or removing stuff
I guess we all have known at least one project that anyone wants to touch, or heard the phrase:
It works, don’t touch it!
Well, that’s not a good signal. I know there are complex projects, big projects, but if nobody in your team can touch it without breaking something, then there is something wrong with that code.
Code is like a garden, it needs to be treat and maintained, if it grows in size or complexity with no control, then will be harder to maintain and easily can get death.
Code grows out of control when there are no conventions to work in it, team practices, even solo practices are important to keep our code under control.
If you see yourself in a scenario where is hard to add things to your project, then you should rethink the whole thing.
Only the creator understands it (Sometimes even the creator can’t.)
If only one person in your team can understand a project, then that’s a problem and hopefully that person never gets sick or goes on vacation.
If you are working by yourself please don’t write overcomplicated code; in my experience simplicity is better; writing code that anyone can read is the right thing to do.
What is clear today may not be that clear in a couple of weeks, even for you.
Use comments on your code. Do not comment on every single line but put enough comments on the complicated and crucial parts.
It is difficult to read
I have to insist on this. Simple is better; there is no need to show anyone how abstract you can be or how much you know the language. Keeping things simple is way much more productive than trying to show off your knowledge and skill.
Keep your code as readable as possible, simple as possible. Clear variable names, descriptive functions names, clear statements. This will save time for you and your team.
A good way to measure how readable your code is is to overcome the necessity of comments. If the code does not need many comments to describe it, then it means the code is readable enough.
The best code is not only the one that is fast and performant; the best code is also the one you enjoy working on. I’ve had nightmares of codebases that I had to work with, and I also have had codebases that I enjoy.
Coding is a team sport, and every member of the team must be able to play the game, so write for the team.
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
– Martin Fowler
In the end, I think everything reduces to how good we are at expressing ourselves through code.
So that’s all folks!
If you want to talk about nerdy stuff, then throw me a line at twitter.