Ship It! LIVEShip It! LIVE
home about services writing contact

We develop, test, and create fine software products, and design creative solutions to your problems.
The development of software is an intrinsically creative process. We are dedicated to improving our mastery of the art.
Links · RSS Feed
Popular Pages

Do it right from day one or you never will
-Andy Hunt
Quoting Watts Humphrey, "Developers are caught in a victim's mentality." We never think it's our fault, it's always somebody else's.
-Jared Richardson
If your shop has trouble shipping quality software on time -- and let's face it, most do -- then this book is for you. If you're a manager, I'd say that doubly so.
-Ernest Friedman-Hill "JavaRanch Sheriff"

Bob Martin on Clean Code (May 19)
There are running notes on Bob Martin's talk (Clean Code)... it was great and the room was packed. There were literally people sitting in the floor for this one.

----

We always get more done at the beginning of a project because the code hasn't gotten messy yet... so how do we 1) keep our code from getting messy? Or 2) clean it up when we realize it gotten messy?

When a project is late, what does management do? Add developers... who tend to do what? Make more mess!

Write your tests first, or you probably won't. When you change your code, add a test. When you create new code, Test First.

The open/close principle... a program should be open to extension but closed to modification. This is powerful.

In school, when we're learning to write, we're taught to write a first draft, then a second draft, etc. Then we try to write code and do it perfectly the first time. And for some reason we fail. Plan on retooling and refactoring when doing the creative act of coding.

Sixty percent unit test code coverage means that you've forty percent unkown code. What does the untested code do again? You don't know. (Actually, a unit test doesn't tell you what you're code does in the context of the application anyway... this is why you should use more than just unit tests. Integration tests are vital. -jared)

The principle of least surprise... create your programs with this in mind.

Make tiny changes... add/change the tests. Then RUN them. Some IDE tools run them in the background continually. (I'm surprised he didn't mention having a continuous integration system running in the background. -jared)

I love how often he keeps telling us how the one page Ruby example was 8 pages in Java (or some variation on those numbers). One of the reasons to use something like Rails is to get the pre-written, pre-tested code. Don't write tons of code when you can have a generator create clean code for you or when you can use an existing library. The generated or existing code is clean, debugged, etc.

Bad code gets harder to clean as time goes by. You want to clean it up, but you're so busy maintaining it, you don't have time. Don't rewrite, focus on incremental improvements. If you don't clean up a little bit today, you never will. Start today.

Dinner parable... the quickest way to end dinner is to walk away. But when you come back to dinner and the old food has dried to the plates, it'll take you much longer to prepare the next meal. Instead, we clean up the dishes as we go. We don't use up every plate then try to clean up. Do the same w/your code. Make a meal. Eat the food. Then clean up the dishes.

Nothing has a more profound and long-term degrading effect than bad code. Bad code rots and ferments. It becomes an inexorable problem that drags your team down.

Professionals write tests first. Professionals clean their code. Professionals know the only way to move fast... is to go well. This was a great talk!

Category: Rails


© 2007 Agile Artisans.