This week we talked about clean code. It is a reader-focused development style that produces software that’s easy to write, read and maintain. Knowing how to produce clean code is an essential skill for software developers. Clean code is what someone must do to call yourself a professional. Clean code is clear, understandable, and maintainable. When you write clean code, you’re keeping in mind the other people who will read it and need to interpret the code. Some of the characteristics of clean code is it should have meaningful names for the reader to easily understand and to avoid confusion. Functions are the building blocks of programs so creating easy to read functions makes it easier to understand and modify programs. It is important for programs to have comments because it helps explain your code to other people. Formatting when writing clean code is important like making sure you have white spaces in the program.
There are three principles of clean code which are choosing the right tool for the job, optimizing the signal-to-noise ratio and strive to write self-documenting code. The 10 steps to writing clean code are following conventions. This can be like using a name which keeps things clear and lets you know what you’re working with. Say what you mean is another step to writing clean code. It’s easily frustrating seeing code with variables that are misleading. Whitespace is incredibly powerful so that the code is readable. Remember the power of I as it’s always clear that “I” is your iterator variable. Keep if functional. If a function is doing more than its name suggests, then some of the excess functionality could be split into its own function. Keep it classy can mean keeping code tidy, clear and consistent or if you have a functionality problem, you can separate by creating a class to handle that functionality. I chose this blog post because it talks about some of the essential things needed for writing clean code to be a good programmer. This blog also explains in detail each step that’s important when writing clean code which also helps me understand better what good programmers do to have efficient code. I am an aspiring developer and going through all these steps has helped me have more insight on what I must do and gained some more knowledge. I liked this resource because it has helped me further understand some principles and steps when writing clean code.
References
.https://www.pluralsight.com/blog/software-development/10-steps-to-clean-code
From the blog CS@Worcester – Site Title by lynnnsubuga and used with permission of the author. All other rights reserved by the author.