S4|E5 these prompts aren’t that fun anymore


One of the most important things that was highly emphasized in the earlier years of school, was that we had to keep our code clean. Although this was taught in later stages of my freshman year, I could remember coding my first Python assignment. There was more than 1000 lines, and it looked like a huge block of words. There was nothing clean about it. I’ve recently read about clean-code principles and stumbled upon something that I would love to do more often. The phrase at question was: “The question to ask when you’re writing code is “can this be written in a simpler way?”. This can be found in https://x-team.com/blog/principles-clean-code/. As a developer, we always want things to be faster, simpler, and better. We emphasize these principles but sometimes dwell on the fact that if a piece of code works, we also don’t touch it in case it breaks. There needs to be a line drawn in the middle somewhere to compliment both these traits, because I myself, have been scared to touch working code to make it simpler.

Another thing that goes hand-in-hand with clean code is “code-smells”. These are the product of bad code, which derives from people making a mess or unnecessary adjustments to the code. In this article by Joydip Kanjilal in https://www.techtarget.com/searchsoftwarequality/tip/Understanding-code-smells-and-how-refactoring-can-help, he mentions the keyword of refractor, in the sense of doing more by subtraction. One thing that I would love to avoid doing, that was talked about in this article, was “renaming methods with ambiguous names”. I have the tendency to name my variables random words or letters, when they can be so much clearer. I would simply have a variable be “x, y, z, x1, x2, etc”. I would love to avoid this habit and get in the habit of naming my variables with clearer and more detailed names. This would clear up my code a ton and hopefully promote code hygiene in my work.

Print Friendly, PDF & Email

Leave a Reply

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