Writing Code

When I first started and researching clean code, I thought it was very unnecessary. Back then, I was a beginner developer and had no idea what I was talking about. I was still making small programs like Fizz Bizz or factorial and thought they were complicated. Over time, I started developing more complex programs and it finally hit me how important and essential clean code truly was. Truth be told, I only understood when I was trying to fix an issue in my program and I had to pull an older code portion that I wrote. I had no idea what the code did or what it affected. It was a very humbling moment but it actually allowed me to understand and appreciate the principles of clean code much more. After that, I started reading a lot of clean code articles to better understand it and help me refactor my code in my project.

I read “The Art of Writing Clean Code: A Key to Maintainable Software“. It was a nice refresher on the best concepts of clean code. I think it is essential for every programmer to understand them, which are selecting meaningful names, simplifying and abstracting function, and writing consistently throughout the code.

Personally, I find the that consistent code is the most important one as consistency will help tremendously down the line. It can help programmers understand and debug better throughout the development. For example, recently I had a class for cloud development and my code was actually very inconsistent. I was writing functions that return promises yet I used 2 different ways to resolve them. The earlier functions used “.then” and the newer ones used “async and await”. This caused me so much headache as debugging and understanding how they both interacted with each other was incredibly difficult. Every function was built on each other and refactoring the code was very challenging. Eventually, I was able to refactor it correctly, which allowed my developing and debugging experience to be much better.

I read “Understanding code smells and how refactoring can help“. I think that as long as someone understands clean code, then they can easily understand code smells. This is due to the fact that they parallel each other nicely, and they have the same principle overall. That is to keep code simple, efficient and concise. However, I will admit that I didn’t know that method calls could be considered code smells. I suppose it does make sense as over time, huge code starts becoming daunting and difficult to work with. I understand why they say that developers are constantly learning as you get to learn something new every single day.

My favorite thing to do in development is creating abstraction and simple functions. This is considered clean code and I will love to keep doing that as it makes my code look much more concise and efficient. Also I will try to stay consistent throughout the code no matter what. If I learn something new while developing, I will also make sure to refactor my prior code to adhere to clean code principles. It is better to refactor old code but pushing new features and functionality.

Print Friendly, PDF & Email

Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *