The blog post I selected this week is an article by Sanura Hettiarachchi called “10 Clean Coding Practices”. I chose this article with the homework and the expected lectures coming up this week on coding practices. Prior to reading the article I understand effectively using white space, making comments, and declaring meaningful variable names are practices often recommended. When reading the blog, the article goes through each of practices mentioned in detail as well as other tips. When writing variable names, I often have a hard time making meaningful variable names for long declarations. In the article it provides good examples of condensing these variable names for example, changing
“Person [] peopleFromIndiaWhoCanSpeakFrench;” can be condensed to “indiansSpeakingFrench”. The article also provides bad coding practices with variable names that many without understanding of clean coding may not follow.
In addition the article talks about following correct name conventions corresponding to different coding languages. The example brought up was someone in C# would Pascal Case while someone in Java would use CamelCase and it is important to research practices for a specific language to keep documentation clean.
When writings methods, the article suggests method names that effectively describe its uses but something that stuck out to me when describing practices for methods were keeping parameters to a minimum of three. Often in my practices in Java, I use alot of parameters in my methods which I will not keep into account.
Also described that I found very helpful is where to declare variables, Sanura recommends declaring variables at their point of use instead of at the top of a method so that you don’t have to scroll back and forth to understand the code.
Another really good practice I saw in the article is reducing numbers which can be simplified to a constant variable.
Other practices mentioned include not to leave dead code/commented code, minimizing extensive nested conditions, try not to implement long functions, avoid code duplication.
When reflecting on this blog on it’s use of the course as well as in my career, I can see these coding practices being very useful and something I can always use. In addition, I am expecting to see some of these practices in the upcoming lecture this Tuesday and Thursday coming up. With the project on Markdown to HTML I can see the importance of following clean coding practices especially while working in a group with others to ensure everyone is on the same page.
https://medium.com/swlh/10-clean-coding-practices-e37ac283184d
From the blog CS@Worcester – Anthony Duong CS Blog by anthony duong and used with permission of the author. All other rights reserved by the author.