As a programmer, for some time I had a hard time to find a good way to code better, in order to make my code work just fine. Just like an artist who wants his art to be understood and appreciated by other people, we want other programmers to understand my work, especially if I work with others who have to use my code to create new functions.
Lack of standards
We do not have a manual how to code, in addition, each programming language has its characteristics and recommendations to build a project, from its structure to its coding, so we do not have many standards to code, at least in those years, I I have never seen a "philosophy of how to write systems", this turns out to be the responsibility of our experience over time, but since each one has different experiences throughout life, we can have valid encodings with advantages and disadvantages of each other and yet , are very different.
For these reasons, I decided to list some situations that made me improve how I should create my code ...
1. View open source projects on GitHub
See how great projects are done, and how programmers code inside them. There are some people and theories who argue that one way to improve yourself in a sport or some skill is to see how a very good professional in that area or sport acts, in programming is almost the same thing. GitHub helped me a lot with this, I went after some .NET projects that had a strong community and were up to date. View community projects helped me:
- Understand abstract concepts of design patterns , such as SOLID, CQRS, DDD, TDD, Abstract Factory, Singleton. These concepts even help us make better and more cohesive codes.
- Helped me find ready-made functions that are very generic, like sending an email, an SMS, retrieving a password.
- Understand important features of the language paradigm, in case object orientation
- Learn the language resources I use, which I would only find reading through all the documentation.
- Help me understand using the Ubiqua language, which I highly recommend
2. Create your code so the lay person can understand.
The appropriate use of comments is to compensate for our failure to express ourselves through the code- Robert Cecil Martin, Clean code
There are ways and ways of coding, but to say that there are good and bad ways of coding. I always try to think of some rules that prevent another person from looking at my code and thinking "What the fuck is this that I'm reading, I do not understand anything".
It's no wonder that code review is being a very accepted technique among programming communities, to improve the quality of your code, I try to follow some rules:
- Using "CamelCase" to write my code, there are other options, but that's what I like the most.
- Use as little as possible Ctrl + C / Ctrl + v in my code
- Leave my methods with at most 3 ~ 4 if / for / while nested
- Put each statement a comment, saying what I'm doing and what, (projects using the Jupyter Notebooks , are great to understand this, have several in GitHub)
- Have the least documentation, even a readme
3. If you do not know how to start creating a better way to encode, download a program that does it for you.
There are several options in the Plugins market that review your code and propose better solutions for coding, some examples are:
There are other options that can help you write code directly through your IDE, so going after tools and language features can help us create better codes.
[Conclusion]: There are several other ways to develop good ways of coding, after all if you take the time x to make your code and not think about it right, someone will take 2x, 3x, 4x. .. * x to understand your code and fix it if necessary so take good care of your code, and you will be an excellent programmer. And for you, what things makes you code better?:
Top comments (0)