{"id":586,"date":"2008-04-21T09:26:01","date_gmt":"2008-04-21T08:26:01","guid":{"rendered":"http:\/\/www.itwriting.com\/blog\/?p=586"},"modified":"2008-04-21T09:26:01","modified_gmt":"2008-04-21T08:26:01","slug":"how-to-code-better-new-book-from-thoughtworks","status":"publish","type":"post","link":"https:\/\/www.itwriting.com\/blog\/586-how-to-code-better-new-book-from-thoughtworks.html","title":{"rendered":"How to code better: new book from ThoughtWorks"},"content":{"rendered":"<p>Which is more important: the code you write, or the tools you use? Instinctively I would say it is the code which really counts; but vendors tend to focus on tools because that is what they sell. I found myself thinking about this last week, because while I was engaged in puzzling out the new Application Factories feature in CodeGear&#8217;s <a href=\"http:\/\/www.codegear.com\/products\/jbuilder\" target=\"_blank\">JBuilder 2008<\/a> a book arrived on my desk. It is called The ThoughtWorks Anthology, and subtitled &#8220;Essays on Software Technology and Innovation.&#8221; The title is the worst thing about it, since it sounds like some kind of corporate puffery from <a href=\"http:\/\/www.thoughtworks.com\/\" target=\"_blank\">ThoughtWorks<\/a> (and I suppose it is); but it is also a concise, enjoyable and stimulating read. I found it particularly refreshing as a break from JBuilder, since it it concerns stuff that matters: code, testing, project management, as opposed to stuff that might introduce more problems than it solves: the latest wonder tool which promises to speed development but might end up as just another piece of clutter.<\/p>\n<p>I turned first to an entertaining chapter by Jeff Bay, called Object Calisthenics. Bay sets out nine rules; I don&#8217;t want to steal all his thunder, but here are three of them:<\/p>\n<ul>\n<li>Don&#8217;t use the else keyword<\/li>\n<li>Use only one dot per line<\/li>\n<li>Don&#8217;t use any classes with more than two instance variables<\/li>\n<\/ul>\n<p>Before you scream at him, note that this is an exercise, not a set of rules for live projects, though at the end of the chapter Bay says they can be used as such. It doesn&#8217;t matter whether you agree or not; what counts is that it makes you think about how to improve the design of your code.<\/p>\n<p>Martin Fowler writes about how to write a DSL (domain-specific language) in Ruby. Rebecca Parsons describes how to categorize languages. Neal Ford makes the case for polyglot programming. Erik Doernenburg discusses the use of annotations\/attributes in Java and .NET for application domain metadata. Julian Simpson has a great chapter on refactoring Ant build files, which can easily become hard to maintain. Two final chapters cover test strategy and performance profiling strategy.<\/p>\n<p>I particularly like the way in which the book itself reflects the coding principles it presents. Each chapter is short, clear and focused. A good read for your next transatlantic flight.<\/p>\n<p><em>The ThoughtWorks Anthology (Pragmatic Publishing ISBN 10: 1-934356-14-X)<\/em><\/p>\n<p>Amazon links:<\/p>\n<p>US: <a href=\"http:\/\/www.amazon.com\/exec\/obidos\/ASIN\/193435614X\/itwriting-20\" target=\"_blank\">The Thoughtworks Anthology<\/a><\/p>\n<p>UK: <a href=\"http:\/\/www.amazon.co.uk\/exec\/obidos\/ASIN\/193435614X\/onlyconnectsyste\" target=\"_blank\">The Thoughtworks Anthology<\/a><\/p>\n<div class=\"wlWriterSmartContent\" id=\"scid:0767317B-992E-4b12-91E0-4F059A8CECA8:b70c7357-813b-4176-8e63-7c32bf109fac\" style=\"padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px\">Technorati tags: <a href=\"http:\/\/technorati.com\/tags\/thoughtworks\" rel=\"tag\">thoughtworks<\/a>, <a href=\"http:\/\/technorati.com\/tags\/software%20development\" rel=\"tag\">software development<\/a>, <a href=\"http:\/\/technorati.com\/tags\/dsl\" rel=\"tag\">dsl<\/a>, <a href=\"http:\/\/technorati.com\/tags\/ant\" rel=\"tag\">ant<\/a>, <a href=\"http:\/\/technorati.com\/tags\/java\" rel=\"tag\">java<\/a>, <a href=\"http:\/\/technorati.com\/tags\/.net\" rel=\"tag\">.net<\/a>, <a href=\"http:\/\/technorati.com\/tags\/book%20review\" rel=\"tag\">book review<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Which is more important: the code you write, or the tools you use? Instinctively I would say it is the code which really counts; but vendors tend to focus on tools because that is what they sell. I found myself thinking about this last week, because while I was engaged in puzzling out the new &hellip; <a href=\"https:\/\/www.itwriting.com\/blog\/586-how-to-code-better-new-book-from-thoughtworks.html\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">How to code better: new book from ThoughtWorks<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[80],"tags":[],"class_list":["post-586","post","type-post","status-publish","format-standard","hentry","category-software-development"],"_links":{"self":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts\/586","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/comments?post=586"}],"version-history":[{"count":0,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts\/586\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/media?parent=586"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/categories?post=586"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/tags?post=586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}