Back for Winter 2024 January 17th, 2024
I am back for Winter 2024, the semester where my team and I work on developing our Secure Password Application. I am excited to work on my project and am confident that we have a good plan in place that will allow us to finish development on time.
For the clean code reading, I chose to read Chapter 1 from Clean Code: A Handbook of Agile Software Craftsmanship by Robert Martin. The first thing that I took away from the reading is the dangers in writing bad code. Writing bad code and deploying it due to time constraints, external pressures, or just laziness can be dangerous to a product. While at first, the code may not impact performance, bug fixing, or overall functionality too badly, after constant bad code practices and application can begin to slow down, and even eventually fail. As Martin mentioned, one company continued to add more and more features with bad code practices and “the code got worse and worse until they simply could not manage it any longer” (Martin 3). Due to bad code, the company failed.
Martin continues his discussion by mentioning many famous programmers who put their own word in on clean code. One of which was Bjarne Stroustrup, the inventor of C++. He mentions that code should be elegant and efficient. This makes perfect sense as C++ is one of the fastest programming languages out there. Elegance, efficiency, and error handling are all key points that Stroustrup mentions when mentioning coding practices.
For my reading on code-smells, I chose to read chapter 3 of Refactoring: Improving the Design of Existing Code by Martin Fowler. The first thing that Fowler mentions to keep an eye out for is duplicated code. This makes perfect sense, why rewrite the same code over and over when a function would do the trick in a much more efficient, and cleaner way. Another bad coding practice are functions, or classes that are too large. As Fowler mentions, “Since the early days of programming people have realized that the longer a procedure is, the more difficult it is to understand” (Fowler 64). Keeping functions short allows for easier understandability, therefore better maintainability. The same applies to classes. Having objects taht are too large increase the likelihood for confusion, and therefore duplication.
Another key issue he mentioned is divergent change. He mentions “When we make a change we want to be able to jump to a single clear point in the system and make the change” (Fowler 66). This is something that have always tried to maintain from when i started out my Computer Science career. While it may be simple at the time of development to input variables manually, even in multiple places, this is a big issue when it comes to changing code. It is dangerous to assume that a codebase will never change. With how technology, coding practices, and even programming languages are changing, it is always key to assume that you will need to update your code. Updating code is something that everyone does due to its necessity in the ever advancing world of technology.
Overall, clean code is essential when development a serious project. It can save time, increase longetivity, and, in some cases, even save a project or application. Clean code is something that I am consistently trying to implement within my own development and reading about specific examples helps me gain a better persective on what I should and should not do while coding.
Citations:
Fowler, Martin. Refactoring: Improving the Design of Existing Code. 2nd edition, Addison-Wesley Professional, 2018.
Martin, Robert C. Clean Code: A Handbook of Agile Software Craftsmanship. 1st edition, Pearson, 2008.
Read the post...