In the past, like when I was around 15-16 years old, It was the first time I genuinely started coding, and I choose to start coding with the C++ language. It was definitely a fresh new thing for me, and I had my first macbook at the day, but the learning curve and everything else was way too hard to learn at that point. Although, I was trying to improve each and every day to write better code, but when you look at it, you would see bunch of meaningless lines crambled and get into each other so that it was barely possible to read it. Now when I look back to those days, I could clearly tell the importance of writing “clean code”. In the Martin’s article, he states that if you ever looked at the mess you created that is so grave and took weeks to do it even though it should only took several hours (Martin, 2008, p.5). Even though in my college life, this happened to me more than several times, where the problem was on the surface, but because of the mess I created, it maybe took more than couple days to solve it. I wish I could share what I wrote back in the day, but unfortunately, I didn’t saved the projects that I tried back in the day from my old computer.
In the other hand, writing code over and over, again and again will definitely improve you, and how you write the code. This involves “getting rid of the code smells”. Like how Fowler states in his article, “If it stinks, change it” (Fowler, 2018, as cited in Grandma Beck, n.d., p.85).
The one thing from the articles that I stated which I want to do more often is to precisely try to do whatever it requires me to do for the code, such as code should be functioning well, and also if possible, try to avoid from the code smells, and write a cleaner code. I improved my coding style alot from the past, and I actually started writing clean code with no smells in certain situations, but It is obvious that grind never stops, and I have to improve myself even more with each and every part of writing code.
The one thing that I would like to avoid doing is that I often don’t add comment lines while I am writing the function, then when I skim through the function, I see that the code I wrote even could be a stranger to me. That is definitely something that I want to avoid, which I could avoid it with at least repeating through what it does while I am writing the part, and while repeating it out loud, I could quickly create a comment line, and add the things I spoke. This way, the code would be much more cleaner to me while I try to skim over it once again.
This is currently one of the example codes that I wrote for my portfolio project that is free of code smells, and aimed to be a clean code:
Link: https://www.youtube.com/watch?v=tV7vFc072s0&list=PLOuwshOnMJ07_49hP7zdRr2O6PY_Y0LOr&index=5
References:
Fowler, Martin. Refactoring: Improving the Design of Existing Code. 2nd edition, Addison-Wesley Professional, 2018.
Martin, Robert C. Clean Code: A Handbook of Agile Software Craftsmanship. 1st edition, Pearson, 2008.