Categories
Uncategorized

Clean Code Blog Post

When it comes to writing clean code, my own journey has been fraught with struggle. Starting out just self teaching I would have little quirks that I personally would like to put in to help “organize” that I have since realized are useless in practice. The most prominent one off the top of my head was compartmentalizing each section of code with single line comments (forming a literal line: ################Function Name############) along with having a comment on every single line of code. Something I have since fazed out as the function name itself with docstrings is often more than enough and lots of code comments are unnecessary. When reading through articles for this blog post I came across this one from Codacy: https://blog.codacy.com/what-is-clean-code One takeaway from this that I personally want to implement into my coding practices is in regards to following established code writing standards. It has a section discussing standards for various languages and brings up PEP8 for Python. I did not learn about this coding standard until I took Software Development II last year, and it enlightened me to the fact it is baked into almost all coding environments as warnings. For example in Pycharm it will underline PEP8 violations in a yellow line noting it as a warning that wont break code functionality, but to double check it. Knowing this now it seems obvious in hindsight but its funny to look back at my old projects and see the copious amount of yellow underlines that I ignored not knowing any better. I also read an article from 8th light regarding some common code smells: https://8thlight.com/insights/common-code-smells I really like a line from the end of it regarding code comments, something I talked about at the beginning of this post. The article says “Rather than adding a comment to clarify a piece of code, think about whether the code can be refactored such that the comment is no longer needed.” I think this is a fantastic line that sums up what being a good efficient coder embodies.