    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>ACCU  :: Smarter, Not Harder</title>
        <link>https://members.accu.org/index.php/articles/2282</link>
        <description>Professionalism in Programming</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Administrator</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.xaraya.org" /> 
        <admin:errorReportsTo rdf:resource="mailto:webeditor@accu.org" />
       <sy:updatePeriod>hourly</sy:updatePeriod>
       <sy:updateFrequency>1</sy:updateFrequency>
       <docs>http://backend.userland.com/rss</docs>




<div class="xar-mod-head"><span class="xar-mod-title">Programming Topics + Process Topics + CVu Journal Vol 28, #4 - September 2016</span></div>

<table border="0" cellpadding="1" cellspacing="0">
    <tbody>
    <tr>
        <td valign="top">
            Browse in :
       </td>
       <td valign="top">

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c13/">Topics</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c65/">Programming</a>
<br />

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c13/">Topics</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c221/">Process</a>
<br />

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c76/">Journals</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c77/">CVu</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c365/">284</a>
<br />

                                            <a href="https://members.accu.org/index.php/articles/c65-221-365/">Any of these categories</a>

                    -                        <a href="https://members.accu.org/index.php/articles/c65+221+365/">All of these categories</a>
<br />
</td>
   </tr>
   </tbody>
</table>




<div class="xar-error">
   <p>
 <strong>Note:</strong> when you create a new publication type,
the articles module will automatically use the templates
<em>user-display-[publicationtype].xt</em>
and <em>user-summary-[publicationtype].xt</em>.
If those templates do not exist when you try to preview or display a new article,
you'll get this warning :-)  Please place your own templates in themes/<em>yourtheme</em>/modules/articles . The templates will get the extension .xt there. </p>
</div>
<div class="xar-norm xar-standard-box-padding">
   <h1><strong>Title:</strong>&nbsp;Smarter, Not Harder</h1>
<p><strong>Author:</strong>&nbsp;Martin Moene</p>
<p>
<strong>Date:</strong> 07 September 2016 16:15:20 +01:00 or Wed, 07 September 2016 16:15:20 +01:00</p>
<p><strong>Summary:</strong>&nbsp;Pete Goodliffe tries to solve the right problems the right way.</p>
<p><strong>Body:</strong>&nbsp;<p class="quote">Battles are won by slaughter and manoeuvre. The greater the general, the more he contributes in manoeuvre, the less he demands in slaughter. <br />~ Winston Churchill</p>

<p>Life in the software factory can be hectic and fast-paced, with many unreasonable demands. â€œMake it super-elegant.â€ â€œMake it feature-rich.â€ â€œMake it bug-free.â€ â€œAnd make it <em>now</em>!â€ With the pressures of unrealistic deadlines and tricky coding tasks looming over your head, it can be easy to lose focus, and deliver the wrong thing, or fail to deliver at all.</p>

<p>Thereâ€™s a trick, or is it an art, or is it simply a learned <em>skill</em>, to doing the <em>right thing</em> at the <em>right time</em>; to knowing how to solve the <em>right</em> problem; and to do as much (that is, as <em>little</em>) work as required to get to the <em>right</em> solution.</p>

<h2>The wrong thing, the wrong way</h2>

<p>Let me tell you a story. Itâ€™s true. A colleague, working on some UI code, needed to overlay pretty rounded arrows over his display. After he struggled to do it programmatically using the drawing primitives provided, I suggested he just overlay a graphic on the screen. That would be much easier to implement.</p>

<p>So off he went. He fired up Photoshop. And fiddled. And tweaked. And fiddled some more. In this, the Rolls-Royce of image composition applications, there is no quick-and-easy way to draw a rounded arrow that looks halfway decent. Presumably an experienced graphic artist could knock one up in two minutes. But after almost an hour of drawing, cutting, compositing, and rearranging, he still didnâ€™t have a convincing rounded arrow.</p>

<p>He mentioned it to me in frustration as he went to make a cup of tea.</p>

<p>On his return, tea in hand, he found a shiny new rounded arrow image sitting on his desktop ready for use.</p>

<p>â€œHow did you do that so quickly?â€ he asked.</p>

<p>â€œI just used the right tool,â€ I replied, dodging a flying mug of tea.</p>

<p>Photoshop <em>should</em> have been the right tool. Itâ€™s what most image design work is done in. But I knew that Open Office provides a handy configurable rounded arrow tool. I had drawn one in 10 seconds and sent him a screenshot. It wasnâ€™t elegant. But it worked.</p>

<p>The moral?</p>

<p>There is a constant danger of focusing too closely on one tool, or on a singular approach to solve a problem. Itâ€™s tantalisingly easy to lose hours of effort exploring its blind alleys when thereâ€™s a simpler, more direct route to your goal.</p>

<p>So how can we do better?</p>

<h2>Pick your battles</h2>

<p>To be a productive programmer, you need to learn to work <em>smarter</em> rather than <em>harder</em>. One of the hallmarks of experienced programmers is not just their technical acumen, but how they solve problems and pick their battles.</p>

<p>Good programmers get things done quickly. Now, they <em>donâ€™t</em> bodge things like a shoot-from-the-hip cowboy coder. They just work smart. This is not necessarily because they are more clever; they just know how to solve problems <em>well</em>. They have an armoury of experience to draw from that will guide them to use the correct approach. They can see lateral solutions â€“ the application of an unusual technique that will get the job done with less hassle. They know how to chart a route around looming obstacles. They can make informed decisions about where best to invest effort.</p>

<h2>Battle tactics</h2>

<p>Here are some simple ideas to help you work smarter.</p>

<h3>Reuse wisely</h3>

<p>Donâ€™t write a lump of code yourself when you can use an existing library, or can re-purpose code from elsewhere.</p>

<p>Even if you have to pay for a third-party library, it is often far more cost effective to take an off-the-shelf implementation than to write your own. And test your own. And then debug your own.</p>

<p class="lesson">Use existing code, rather than writing your own from scratch. Employ your time on more important things.</p>

<p>Overcome <em>â€˜not invented hereâ€™</em> syndrome. Many people think that they can do a much better job themselves, or fashion a more appropriate version for their specific application. Is that <em>really</em> the case? Even if the other code isnâ€™t designed exactly how you prefer, just use it. You donâ€™t necessarily need to rewrite it if itâ€™s working already. Make a facade around it if you must to integrate into your system.</p>

<h3>Make it someone elseâ€™s problem</h3>

<p>Donâ€™t work out how to do a task yourself if someone already knows how to do it. You might like to bask in the glory of the accomplishment. You might like to learn something new. But if someone else can give you a leg up, or complete the job much faster than you, then it may be better to put the task in their work queue instead.</p>

<h3>Only do what you have to</h3>

<p>Consider sacrilege: Do you <em>need</em> to refactor? Do you <em>need</em> to unit test?</p>

<p>Iâ€™m a firm advocate of both practices, but sometimes they might not be appropriate or a worthwhile investment of your time. Yes, yes: refactoring and unit testing both bring great benefits and should never be tossed aside thoughtlessly. However, if youâ€™re working on a small prototype, or exploring a possible functional design with some throwaway code, then you might be better off saving the theologically correct practices for later.</p>

<p>If you do (laudably) invest time in unit tests, consider exactly <em>which</em> tests to write. A stubborn â€˜test every methodâ€™ approach is not sensible. (Often youâ€™ll think you have better coverage than you expect). For example, you need not test every single getter and setter in your API. (Itâ€™s another issue whether you <em>should</em> have getters and setters in your APIs in the first place.) Focus your testing on usage, not methods, and pay particular attention to the places you would likely expect brittleness.</p>

<p>Pick your testing battles.Â </p>

<h3>Put it on a spike</h3>

<p>If youâ€™re presented with multiple design options and youâ€™re not sure which solution to pick, donâ€™t waste hours cogitating about which is best. A quick <em>spike</em> solution (a throw-away prototype) might generate more useful answers in minutes.</p>

<p>To make this work well, set a specific Pomodoro-like time window within which you will perform the spike. Stop when the time elapses. (And in true Pomodoro style, get yourself a nice hard-to-ignore windup timer to force you to stop.)</p>

<p>Use tools that will help you backtrack quickly (e.g., an effective version control system).</p>

<h3>Prioritise</h3>

<p>Prioritise your work list. Do the most important things first.</p>

<p class="lesson">Concentrate effort on the most important things first. What is most urgent, or will produce the most value?</p>

<p>Be rigorous about this. Donâ€™t get caught up on unimportant minutiae; itâ€™s incredibly easy to do. Especially when one simple job turns out to depend on another simple job. Which depends on another simple job, which depends on.... After two hours youâ€™ll surface from a rabbit hole and wonder why on earth youâ€™re reconfiguring the mail server on your computer when what you wanted to do was modify a method on a container class. In computer folklore, this is referred to as yak shaving <a href="#[1]">[1]</a>.</p>

<p>Beware of the many small tasks you do that arenâ€™t that important; email, paperwork, phone calls â€“ the administrivia. Instead of doing those little things throughout the day, interrupting and distracting you from your flow on important tasks, batch them together and do them at one (or a few) set times each day.</p>

<p>You may find it helps to write these tasks down on a small â€˜to doâ€™ list, and at a set time start processing them as quickly as possible. Ticking them off your list â€“ the sense of accomplishment can be a motivating reward.</p>

<h3>Whatâ€™s really required?</h3>

<p>When you are given a new task, check whatâ€™s <em>really </em>needed now. What does the customer actually need you to deliver?</p>

<p>Donâ€™t implement the Rolls-Royce full bells-and-whistles version if itâ€™s not necessary. Even if the work request asks for it, push back and verify what is genuinely required. To do this, you need to know the context your code lives in.</p>

<p>This isnâ€™t just laziness. There is a danger in writing too much code too early. <em>The Pareto principle</em> <a href="#[2]">[2]</a> implies that 80% of required benefit could come from just 20% of the intended implementation. Do you really need to write the remainder of that code, or could your time be better employed elsewhere?</p>

<h3>One thing at a time</h3>

<p>Do one thing at a time. Itâ€™s hard to focus on more than one job at once (especially for men with our uni-tasking brains). If you try to work concurrently, youâ€™ll do both jobs badly. Finish one job then move on to another. Youâ€™ll get both jobs completed in a shorter space of time.</p>

<h3>Keep it small (and simple)</h3>

<p>Keep your code and design as small and as simple as possible. Otherwise, youâ€™ll just add a lot more code that will cost you time and effort to maintain in the future.</p>

<p class="lesson">Remember <em>KISS</em>: <strong>K</strong>eep <strong>I</strong>t <strong>S</strong>imple, <strong>S</strong>tupid.</p>

<p>You <em>will</em> need to change it; you can never foretell exactly what the future requirements are. Predicting the future is an incredibly inexact science. It is easier and smarter to make your code malleable to change now than it is to build in support for every possible future feature on day one.</p>

<p>A small, focused body of code is far easier to change than a large one.</p>

<h3>Donâ€™t defer and store up problems</h3>

<p>Some things that are hard (like code integration) should <em>not</em> be avoided because they are hard. Many people do so; they defer these tasks to try to minimise the pain. It sounds like picking your battles, doesnâ€™t it?</p>

<p>In reality, the smarter thing is to start sooner and face the pain when it is smaller. Itâ€™s easier to integrate small pieces of code early on, and then to frequently integrate the subsequent changes, than it is to work on three major features for a year and then try to stitch them together at the end.</p>

<p>The same goes for unit testing: write tests now, alongside your code (or before). Itâ€™ll be far harder, and less productive, to wait until the code is â€˜workingâ€™ before you write the tests.</p>

<p>As the saying goes: <em>If it hurts, do it more often.</em></p>

<h3>Automate</h3>

<p>Remember the classic advice: <em>if you have to do it more than once, write a script to do it for you</em>.</p>

<p class="lesson">If you do something often, make the computer do it for you. Automate it with a script.</p>

<p>Automating a common, tedious task could save you many hours of effort. Consider also a single task that has a high degree of repetition. It might be faster to write a tool and run that once, than to do the repetitive job by hand yourself.</p>

<p>This automation has an added advantage: it helps others to work smarter, too. If you can run your build with <em>one</em> command, rather than a series of 15 complex commands and button presses, then your entire team can build more easily, and newcomers can get up to speed faster.</p>

<p>To aid this automation, experienced programmers will naturally pick automatable tools, even if they donâ€™t intend to automate anything right now. Favour workflows that produce plain text, or simple structured (e.g., JSON or XML) intermediate files. Select tools that have a command-line interface as well as (or instead of) an inflexible GUI panel.</p>

<p>It can be hard to know whether itâ€™s worth writing a script for a task. Obviously, if you are likely to perform a task multiple times then itâ€™s worth considering. Unless the script is particularly hard to write, you are unlikely to waste time writing it.</p>

<h3>Error prevention</h3>

<p>Find errors sooner, so you donâ€™t spend too long doing the wrong thing.</p>

<p>To achieve this:</p>

<ul>
	<li>Show your product to customers early and often, so youâ€™ll find out quickly if youâ€™re building them the wrong thing.</li>
	
	<li>Discuss your code design with others, so youâ€™ll find out if thereâ€™s a better way to structure your solution earlier. Donâ€™t invest effort in bad code if you can avoid it.</li>
	
	<li>Code review small, understandable bits of work often, not large dense bits of code.</li>
	
	<li>Unit-test code from the outset. Ensure the unit tests are run frequently to catch errors before they bite you.</li>
</ul>

<h3>Communicate</h3>

<p>Learn to communicate better. Learn how to ask the right questions to understand unambiguously. A misunderstanding now might mean youâ€™ll end up reworking your code later on. Or suffer delays waiting for more answers to outstanding questions.</p>

<p>Learn how to run productive meetings so your life is not sucked out by the demons who sit in the corners of meeting rooms.</p>

<h3>Avoid burnout</h3>

<p>Donâ€™t burn yourself out working silly hours, leading people to expect unrealistic levels of work from you all the time. Make it clear if you are moving beyond the call of duty, so people learn not to expect it too often.</p>

<p>Healthy projects do not require reams of overtime.</p>

<h3>Power tools</h3>

<p>Always look out for new tools that will boost your workflow.</p>

<p>But donâ€™t become a slave to finding new software. Often new software has sharp edges that could cut you. Favour tried-and-tested tools that many people have used. You canâ€™t put a price on the collected knowledge of these tools available via Google. </p>

<h2>Conclusion</h2>

<p><em>Pick your battles.</em> (Yeah, yeah.) <em>Work smarter, not harder.</em> (Weâ€™ve heard it all before.)</p>

<p>They are trite maxims. But they are true.</p>

<p>Of course, this doesnâ€™t mean <em>donâ€™t work hard</em>. Unless you want to get fired. But thatâ€™s not smart.</p>

<h2>Questions</h2>

<ol>
	<li>How do you determine the right amount of testing to apply to your work? Do you rely on experience or guidelines? Look back over your last monthâ€™s work; was it really tested adequately?</li>
	
	<li>How good are you at prioritising your workload? How can you improve?</li>
	
	<li>How do you ensure you find issues as soon as possible? How many errors or re-workings have you had to perform that could have been avoided?</li>
	
	<li>Do you suffer from <em>not invented here</em> syndrome? Is everyone elseâ€™s code rubbish? Could you do better? Can you stomach incorporating otherâ€™s work in your own?</li>
	
	<li>If you work in a culture that values the number of hours worked over the quality of that work, how can work reconcile â€˜working smartâ€™ with not looking lazy?</li>
</ol>

<h2>References</h2>

<p class="bibliomixed"><a id="[1]"></a>[1]	<a href="http://bit.ly/Y1J0f">http://bit.ly/Y1J0f</a></p>

<p class="bibliomixed"><a id="[2]"></a>[2]	For many events, roughly 80% of the effects come from 20% of the causes. For more on this, see <a href="http://en.wikipedia.org/wiki/Pareto_principle">http://en.wikipedia.org/wiki/Pareto_principle</a></p>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
