{"id":132,"date":"2009-03-20T13:52:33","date_gmt":"2009-03-20T21:52:33","guid":{"rendered":"http:\/\/zuill.us\/WoodyZuill\/?p=132"},"modified":"2009-03-26T14:20:24","modified_gmt":"2009-03-26T22:20:24","slug":"code-excellence-and-job-satisfaction","status":"publish","type":"post","link":"https:\/\/zuill.us\/WoodyZuill\/2009\/03\/20\/code-excellence-and-job-satisfaction\/","title":{"rendered":"Code Excellence and Job Satisfaction"},"content":{"rendered":"<p>Lately I&#8217;ve been partnering up with Llewellyn Falco doing a presentation we call &#8220;Code Excellence for the Average Programmer.&#8221;\u00a0 The main theme is that using small steps,\u00a0simple techniques, and\u00a0stick-to-itivness\u00a0we can produce code that is pleasant to work with.\u00a0 The bulk of the talk is hands-on where we take a real project (slightly simplified) that has become un-maintainable and transform it into a thing of beauty that is once again a living project. [That is an overstatement perhaps, but it isn&#8217;t far from the intent of our talk]. We&#8217;ve presented it at 4 or 5 developers groups, and at the Fullerton Code Camp. It&#8217;s a lot of fun for me, and hopefully it has been interesting and useful for the people attending.<\/p>\n<p><strong>Happiness On The Job<\/strong><\/p>\n<p>One thing that really struck me during our last presentation at the SDJUG on Tuesday this week is that messy code can\u00a0drastically reduce our level of job satisfaction.\u00a0 Somewhere in the middle of the talk I asked the audience for a show of hands if they enjoy working in the code of their daily job.\u00a0 Almost no one out of 40 or so people raised their hand.\u00a0 That is, nobody was happy.\u00a0 So, I reversed the question and almost everyone raised their hand.\u00a0 That is, almost everyone was unhappy working in the code they spend most of their day with.\u00a0<\/p>\n<p>Of course, we can&#8217;t blame that dissatisfaction entirely on the condition of the code itself, and we can&#8217;t assume that having clean code would make anyone happier.\u00a0\u00a0 For myself, however, I can boldly assert that I am MUCH HAPPIER when working on clean, easy to read, understandable code than I am when the code is an obscure, cluttered, and complex maze of cryptic detail.\u00a0 That has one important motivation for me to learn how to make my code more readable and pleasant to work with. I figure that if I am happier in clean code, then it is likely that others will be happier as well.<\/p>\n<p><strong>Why not be happier?<\/strong><\/p>\n<p>So, this brings up a question (or two): Why do so many developers put up with messy code?\u00a0 Why don&#8217;t we make an effort to fix things and make our life (or at least a small part of it) better?\u00a0 There are certainly some constraints that seem to block us and make us feel we can&#8217;t do much to improve our code.\u00a0 I often hear developers say &#8220;my manager won&#8217;t let me refactor because it is too risky&#8221; or &#8220;my boss says don&#8217;t waste time on improving the code, we need to get this out tonight!\u201d\u00a0 The fundamental problem with these \u201creasons\u201d is that the result is probably not a faster fix or less risk, but the opposite: More testing and fixing, and more risk.\u00a0 Still, these and many other pressures make it hard for us who are writing the code to find the path that leads to code excellence.\u00a0<\/p>\n<p><strong>A few ideas on how to make things better<\/strong><\/p>\n<p>That, of course, brings up the next question: What can we do about it?\u00a0 How can we improve our situation and still produce under the pressures we seem to be under?\u00a0<\/p>\n<p><strong>First: <\/strong>Get Informed. Buy and read Robert Martin\u2019s &#8220;Clean Code&#8221; book.\u00a0 Study Martin Fowler\u2019s \u201cRefactoring\u201d book.\u00a0 Borrow Michael Feathers \u201cWorking Effectively with Legacy Code\u201d and don\u2019t return it until you have memorized it.\u00a0 Get your hands on Joshua Kerievsky\u2019s &#8220;Refactoring to Patterns&#8221;.\u00a0 That is a good start.\u00a0 Get the knowledge and practice\u00a0your skills.\u00a0 Even come to a code camp or dev group meeting where\u00a0someone is doing a session on the subject, or put together your own session and present it at some local group you attend.<\/p>\n<p><strong>Second:<\/strong> Always leave your code in better shape than you found it. Never touch code without\u00a0making it just a bit cleaner and easier to read. Stop allowing the \u201cquick fix\u201d to increase the clutter and complexity.\u00a0 It only takes a second to improve the clarity of your code by formatting it properly, or using an intention-revealing name for a new method (and so on.)\u00a0 Vow to never again add to the mess.<\/p>\n<p><strong>Third: <\/strong>Take baby steps.\u00a0 There are many simple improvements you can make that no boss or manager can complain about.\u00a0 Find out what they are and do them.<\/p>\n<p><strong>Fourth:<\/strong> Find like-minded co-workers and discuss this stuff with them.\u00a0 A whole team working toward cleaner code can bring a more pronounced result.<\/p>\n<p><strong>Fifth:<\/strong> Never give up, Never Surrender.<\/p>\n<p>What do you think?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lately I&#8217;ve been partnering up with Llewellyn Falco doing a presentation we call &#8220;Code Excellence for the Average Programmer.&#8221;\u00a0 The main theme is that using small steps,\u00a0simple techniques, and\u00a0stick-to-itivness\u00a0we can produce code that is pleasant to work with.\u00a0 The bulk of the talk is hands-on where we take a real project (slightly simplified) that has [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,1],"tags":[],"class_list":["post-132","post","type-post","status-publish","format-standard","hentry","category-code-excellence","category-general-stuff"],"_links":{"self":[{"href":"https:\/\/zuill.us\/WoodyZuill\/wp-json\/wp\/v2\/posts\/132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zuill.us\/WoodyZuill\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zuill.us\/WoodyZuill\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zuill.us\/WoodyZuill\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zuill.us\/WoodyZuill\/wp-json\/wp\/v2\/comments?post=132"}],"version-history":[{"count":0,"href":"https:\/\/zuill.us\/WoodyZuill\/wp-json\/wp\/v2\/posts\/132\/revisions"}],"wp:attachment":[{"href":"https:\/\/zuill.us\/WoodyZuill\/wp-json\/wp\/v2\/media?parent=132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zuill.us\/WoodyZuill\/wp-json\/wp\/v2\/categories?post=132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zuill.us\/WoodyZuill\/wp-json\/wp\/v2\/tags?post=132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}