Clean Code: A Handbook of Agile Software Craftsmanship
by Robert C. Martin
Buy on AmazonRecommended by
"This book is going to show you how to write code that is readable by yourself in the future, or by somebody else. Martin wrote it in a very approachable way, and what I liked when I read it is that it starts talking about code right away. It actually starts with the most basic thing, which is how to name objects in your code. When you’re programming, you’re working with objects all the time; so to make your code readable, you need to use proper names for your variables. That’s the first chapter, and this is often overlooked so I was happy to see that. Get the weekly Five Books newsletter The tone of the book is quite conversational. Again, you can sit on the couch and read it; you don’t need to code. You can actually enjoy it if you don’t know how to program at all. Each chapter begins with a little scenario, often a conversation between two people, and it sets the scene for what the chapter will be talking about. That’s very helpful, and it makes it a very nice book to sit down with and read through. Well, I still haven’t been able to convince my students that it’s important! I don’t know if it’s possible. Sometimes even I don’t do it and regret it later. It’s a matter of not doing it, and then coming back to your code weeks later and not remembering what you did, and learning from those experiences! Two of the books I chose focus on making your code readable; so yes, it’s very important. First, well-crafted code is readable code. This means having comments that describe the thought process and what the code is trying to do—not how it’s doing it. Good variable names would also fall under that category. The other part is organising your code. That means using the right amount of classes and functions, and using them in the right away. You don’t want to write too many and over-engineer your code, but you shouldn’t write too few either so that the few you have are complex and not easy to understand. You want to have the right amount to make them useful and reusable. Support Five Books Five Books interviews are expensive to produce. If you're enjoying this interview, please support us by donating a small amount . Those are the two main conditions to perfectly-crafted code. The balance between them is something that you can’t learn on you own so well. That’s where you would need a lot of practice, or working with somebody else, or reading somebody else’s code. Those are great ways to discover bad pieces of code, but also programs that you’ll find perfect and completely understandable. This craftsmanship part is where the creativity comes into programming, what makes it different from being only about math. It’s closer to learning English in this way."
Computer Science and Programming · fivebooks.com