Blog Post 4


Embracing Clean Code and Avoiding Code Smells: A Senior CS Student’s Perspective

As a senior computer science student, I’ve had my fair share of experiences with both well-written and poorly-structured code. Recently, I delved into two influential chapters from renowned software books: Chapter 1 of Robert Martin’s “Clean Code: A Handbook of Agile Software Craftsmanship” and Chapter 3 of Martin Fowler’s “Refactoring: Improving the Design of Existing Code.” These have offered me invaluable insights, and I’d like to share some ideas I plan to adopt and a common pitfall I aim to avoid.

Embracing: Writing Code for Humans

From Robert Martin’s Chapter 1 on Clean Code, the concept that resonated with me the most is writing code as if it’s meant for humans to read, not just for computers to execute. Martin emphasizes that code should be easily understandable by others, and this is something I want to focus on more. As a student, it’s easy to get caught up in just making the code work. However, ensuring that the code is readable, maintainable, and well-documented is equally crucial.

Why It Matters: In group projects, I’ve noticed that readable code makes collaboration significantly easier. It’s not just about the current functionality; it’s about how easily someone else (or future me) can understand and modify the code. Adopting this approach will prepare me for professional environments where code maintainability and team collaboration are key.

Avoiding: Ignoring Code Smells

Martin Fowler’s Chapter 3 on Bad Code Smells has been an eye-opener in recognizing the subtle signs of problematic code. Code smells aren’t blatant errors but indicators of deeper issues. One specific smell I want to actively avoid is the “Long Method” – writing methods that try to do too much.

Why Avoiding It Is Crucial: Long, complex methods are harder to understand, test, and debug. In my early coding days, I often crammed too much logic into a single method, making it a nightmare for anyone (including myself) to revisit. Recognizing and refactoring such code smells will lead to more modular, understandable, and flexible code.

In Conclusion

As I edge closer to a professional career in software development, integrating the practice of writing human-friendly code and being vigilant about code smells are crucial steps in my growth as a developer. It’s not just about writing code that works; it’s about writing code that lasts and is a pleasure for others (and future me) to work with. This mindset shift, inspired by Martin and Fowler’s teachings, is what I believe will differentiate a good coder from a great one.

Print Friendly, PDF & Email

Posted

in

by

Tags:

Comments

Leave a Reply

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