!c !1 Refrigerator Code I was teaching a class in Test Driven Development (TDD) a few weeks ago and I learned this new phrase, “Refrigerator Code.” When I teach TDD, I teach the development cycle as: 1. Write a test or a piece of one. 2. Get the test to compile but still fail. 3. Make the test pass. 4. Make the code resume quality. 5. Repeat. Step 4 requires explanation. Resume quality means that once I get the test passing, I want my code to be so good that I’m willing to take it out on a job interview as an example of my best work. This code would follow the rules of Simple Design, that is: 1. All the tests pass. 2. There is no duplication in either the code or in the tests. 3. It expresses my intent. 4. It minimizes the number of methods and classes. I believe all code written via TDD should be the best code that I’m able to write. There’s really no excuse other than laziness for leaving your code sloppy or hard to understand when it is written using TDD. One of my students used the phrase ''Refrigerator Code'' to describe what I was talking about. What’s that? It’s code that you’re so proud of that you want to take it home and hang it on the refrigerator, right alongside of your children’s drawings. I love it. So from now on, I am committed to only writing Refrigerator Code. --- !* Sun, 23 Oct 2005 17:46:09, Michael Feathers, I like it I like it. Refrigerator code is cool and it stays fresh longer. :) I do like that feeling, that feeling you get when you realize you've made something really cool and you'd like to show it off. Everyone should have that. *! !* Mon, 24 Oct 2005 12:19:42, Gérard Mendes, Really describes my feeling about 'good code' I like it too ! In fact, that's what software craftsmanship is about : creating a quality product both for the customer (external quality, guaranteed by the tests) and for your fellow craftsmen (elegant, understandable code). Something that you can be proud of. *! !* Thu, 1 Dec 2005 14:47:01, John D. Mitchell, Code Naked Definitely a more easily palatable term than my term: [[Code Naked][http://weblogs.java.net/blog/johnm/archive/2005/11/code_naked.html]]. :-) *!
Use alt+s (Windows) or control+s (Mac OS X) to save your changes. Or, tab from the text area to the "Save" button!
Grab the lower-right corner of the text area to increase its size (works with some browsers).