Clean Code: A Handbook of Agile Software Craftsmanship

Author: Robert C. Martin
4.5
All Stack Overflow 184
This Year Stack Overflow 9
This Month Reddit 11

About This Book

Even bad code can function. But if code isn't clean, it can bring a development organization to its knees. Every year, countless hours and significant resources are lost because of poorly written code. But it doesn't have to be that way.

Noted software expert Robert C. Martin presents a revolutionary paradigm with Clean Code: A Handbook of Agile Software Craftsmanship . Martin has teamed up with his colleagues from Object Mentor to distill their best agile practice of cleaning code "on the fly" into a book that will instill within you the values of a software craftsman and make you a better programmer--but only if you work at it.

What kind of work will you be doing? You'll be reading code--lots of code. And you will be challenged to think about what's right about that code, and what's wrong with it. More importantly, you will be challenged to reassess your professional values and your commitment to your craft.

Clean Code is divided into three parts. The first describes the principles, patterns, and practices of writing clean code. The second part consists of several case studies of increasing complexity. Each case study is an exercise in cleaning up code--of transforming a code base that has some problems into one that is sound and efficient. The third part is the payoff: a single chapter containing a list of heuristics and "smells" gathered while creating the case studies. The result is a knowledge base that describes the way we think when we write, read, and clean code.

Readers will come away from this book understanding

  • How to tell the difference between good and bad code
  • How to write good code and how to transform bad code into good code
  • How to create good names, good functions, good objects, and good classes
  • How to format code for maximum readability
  • How to implement complete error handling without obscuring code logic
  • How to unit test and practice test-driven development

This book is a must for any developer, software engineer, project manager, team lead, or systems analyst with an interest in producing better code.

Comments

by framebit   2018-02-17
2340 (the mandatory group project course) also covered a lot of this stuff, though not in as much detail.

The suggested reading for that course is a book that blew my mind when I first saw it as an undergrad: Clean Code by Robert Cecil Martin. I believe the examples are all Java, but the lessons are applicable to any language. Stuff like naming your variables more carefully than you name your children.

https://www.amazon.com/Clean-Code-Handbook-Software-Craftsma...

by Harpoi   2018-02-16

Clean code - https://toptalkedbooks.com/amzn/0132350882

by Nicholas-DM   2018-02-16

After the MOOC, I'd say that you have a solid foundation.

After the solid foundation, there are a few things that you need to learn-- a two pronged approach would be good. Projects/Experience, and Theory.

Projects

Real projects, where you use what you learn. Here is a list for ideas. Do simple ones. https://github.com/karan/Projects

Post them online on Github, like a portfolio, in their own repositories. Or find a different provider. I recommend Github because it has a massive ecosystem and uses Git.

Find some opensource projects and begin doing simple things for them. Start off with contributing documentation, or a small fix, or something else simple. This is absolutely critical; getting involved and actually coding for stuff that is used by others.

Theory topics

  • Source Version Control: If you ever want to collaborate with other people, you want to be able to do so well. I recommend Git, and specifically git on the command line. https://git-scm.com/ -- And for learning how to use it -- https://git-scm.com/book/en/v2

  • Data Structures: How do you structure data, so that you can access it well and easily, for its purpose? You need to learn how to build data structures, and how to use them. Most importantly, you need to learn when and why you want to use a particular one. This seems like a good intro, but googling and self-study will be important here. https://www.topcoder.com/community/data-science/data-science-tutorials/data-structures/

  • Algorithms: How do you perform tasks on your data? How do you sort it? How do you interact with it? Again, not only do you need to learn how to do the common ones, you also need to know when and why. This seems like a good overview, but someone else is likely able to suggest better resources for algorithms-- searching this very subreddit for algorithms is bound to turn up good results. http://www.csfieldguide.org.nz/en/chapters/algorithms.html

  • Clean Code: You probably don't have great style with what you write. That's okay. Most people don't. But being able to write code that others can read is an art. I recommend this book: https://toptalkedbooks.com/amzn/0132350882 ,


Focus on the above. If you need/want more, then go ahead and check out more.

Once you are beginning to feel comfortable-- if you plan to get a job in this field, I recommend applying at places, even as a near beginner. Try to get a few phone interviews. Go in with the idea that you won't get it, and it's just a learning experience-- you'll figure out how interviews work and you'll get some idea of what different places are looking for. Be honest with your interviewers.

If you want something else-- after you have some understanding of the above topics, this is the time to specialise. Do you want to do android development? Game development? Enterprise Software development? Begin looking into what you want to specialise in, learn their tools, and begin getting familiar with it. Above all else, experience is king.

Good luck! Ask if you have any questions, and I'll do my best to answer them.

by ScottBaiosPenis   2018-02-16

laravel in general and laracasts in specific encourage all sorts of insanely bad practice. i would not take any of their advice seriously in terms of best practices. i would suggest getting a book like clean code (https://toptalkedbooks.com/amzn/0132350882)

by denialerror   2018-02-16

IMO school/university will teach you the CS part but you won't learn anything about how to write actual real-world software. 'Uncle' Bob Martin's Clean Code will show you how code should be written and more importantly, why it should be written that way. It is very opinionated and you have to take some of it with a pinch of salt but I don't know anyone whose code hasn't improved in quality after reading it.

by Medicalizawhat   2018-02-16

Read Clean Code and build a non trivial project using the principles from that book. You'll learn a lot.

Maybe read an Operating Systems book , pick a subsystem you find interesting and try to understand how Linux implements it.

Learn about git and source control.

Contribute to open source projects you find interesting.

Try setting up a server and configuring it to do cool stuff.

Basically, identify something that you don't know much about and dive deeper, or just write lots and lots of code.

by 149244179   2018-02-16

https://toptalkedbooks.com/amzn/0132350882

by anonymous   2018-01-29
@Rogério *"just my extensive real-world experience"* Then it stands against *my* extensive real world experiences as well as of [Robert C "uncle Bob" Martin](https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882) and [Roy Osherove](https://www.amazon.com/Art-Unit-Testing-examples/dp/1617290890) to name two others...
by anonymous   2017-12-11
@AbhinashKumar https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882
by michaelknobloch   2017-12-06

There's a lot of good stuff on this thread. /u/kbo79 posted some great resources and the thread between /u/tempsvdev and /u/nilvon9wo is good stuff.

Just going to add my two cents...

In addition to what's already been said, also research industry best practices. Design Patterns are language agnostic and as you get familiar with them you'll find that the problems they solve come up over and over again. This is more advanced stuff but be on the lookout for them. They're good to know.

Here's the quintessential text on the topic: http://toptalkedbooks.com/amzn/0201633612

It's a bit dry but it's good.

Also just in terms of general code I'm a fan of this book: http://toptalkedbooks.com/amzn/0132350882

My company uses this as our development bible and I think rightly so. It's a great resource.

Ultimately there's so much to learn so just absorb as you go but the one thing I'd implore you to do is learn the best way to do something rather than just how to do something. A lot of the stuff you find on the internet is how to do something but it often isn't well written (poor naming, single large methods/classes, poorly tested).

Take what you find with a grain of salt and think critically about anything you read online regarding SF development as a lot of it wasn't written by experts. Read up on SOLID (https://en.wikipedia.org/wiki/SOLID_(object-oriented_design)) and evaluate what you find in the context of those principles.