tag:blogger.com,1999:blog-337770382024-03-19T09:23:12.008+00:00programmer.grrl(copy + paste) code = badprogrammergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.comBlogger42125tag:blogger.com,1999:blog-33777038.post-6814862341241596312011-03-05T15:00:00.001+00:002011-03-05T15:56:07.211+00:00Book Review: Dependency Injection in .NET<p>This isn't so much a review as just a note that I read <a href="http://www.manning.com/seemann/">Dependency Injection in .NET</a> by Mark Seemann and found it pretty helpful in clearing up some of my confusions about dependency injection frameworks.</p><p>I already was aware of the basics of constructor injection, but was experiencing some pain around problems like constructor over-injection and lots of 1-1 mapping between interfaces and implementations. This book explores ways to fix these issues and many others.</p><p>Here are some topics the book covered that I really appreciated:</p><ul><li>DI patterns, including the different types of injection, and Ambient Context
</li><li>DI antipatterns, including Service Locator
</li><li>DI refactorings, including Abstract Factory and dealing with cyclic dependencies
</li><li>Object composition, including implementing the composition root for common types of .NET applications</li><li>Interception</li></ul><p>I particularly liked the way the Interception chapter went over Decorators and how to configure them, and then moved into how to implement and configure interception.</p><p>
</p>programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com61tag:blogger.com,1999:blog-33777038.post-73847571048620521502010-09-05T21:28:00.001+01:002010-09-05T21:28:53.633+01:00A Real-Life Short-Short Story About Software Craftsmanship<p>One day, at the end of my team's daily stand-up meeting, one person said he was cleaning out his garage. He'd found a couple of books that his previous employer gave to all new hires. And that now he would like to get rid of those books to anyone interested.</p> <p>One of the books was <a href="http://my.safaribooksonline.com/0-201-73386-2">Software Craftsmanship</a> by <a href="http://www.improvingwetware.com/">Pete McBreen</a>.</p> <p>One of our managers laughed, saying, "Oh, so now you're all going to be <em>craftsmen</em>."</p> <p>Several other people laughed, too.</p> <p>After they were done laughing, I said that I thought it was a good book and I recommended reading it.</p> <p>There was silence.</p> programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com14tag:blogger.com,1999:blog-33777038.post-66393867112753226462010-07-26T20:39:00.001+01:002010-07-26T20:39:34.748+01:00Does "Software Engineering" Need to be a Profession?<p>[This is Part 2 of a review of Steve McConnell's book <a href="http://www.stevemcconnell.com/psd.htm">Professional Software Development</a>. Read Part 1 <a href="/2010/07/book-review-professional-software.html">here</a>.]</p> <p>In proposing that software development should become a true profession, McConnell points out that for a something to be considered a profession, it must have</p> <blockquote> <ul> <li>A requirement for extensive learning and training. </li> <li>A code of ethics imposing standards higher than those normally tolerated in the marketplace. </li> <li>A disciplinary system for professionals who breach the code. </li> <li>A primary emphasis on social responsibility over strictly individual gain, and a corresponding duty of its members to behave as members of a disciplined and honorable profession. </li> <li>A prerequisite of a license prior to admission to practice. </li> </ul> </blockquote> <p>In discussing licensing, McConnell notes</p> <blockquote> <p>Licensing is a <em>mandatory</em>, legal process that is intended to protect the public, and is typically administered by jurisdictions (states, provinces, and territories).</p> </blockquote> <p>And</p> <blockquote> <p>One of the consequences of being a professional engineer is that you can be held personally liable for the work your company performs under your signature. Courts in the United States have held that only members of a profession can be found guilty of malpractice. Doctors, lawyers, and architects can be guilty of malpractice. Garbage truck drivers, short order cooks, and computer programmers cannot be guilty of malpractice because, legally, they aren't considered to be professionals.</p> </blockquote> <blockquote> <p>No individual engineer will be required to be licensed, but some companies eventually will be required to employ licensed engineers.</p> </blockquote> <blockquote> <p>Professional engineers in these companies will review software engineering work and sign off on the software their companies deliver. To those companies, employing professional engineers will be a legal necessity. If software companies follow other engineering disciplines, the company that hires a professional engineer will pay for liability insurance as part of the professional engineer's employment package, which will minimize that disadvantage of getting your professional engineering license.</p> </blockquote> <blockquote> <p>Professional engineers will gain other benefits. The professional engineers who put their signature and reputation on the line for their companies will have final say over methodology choices, design approaches, and other decisions that affect the quality of the software for which they might be held liable. Without professional standing, your boss can come to you and demand that you commit to an unrealistic schedule, make shortsighted design compromises, or sacrifice quality in order to get the software out the door. With a well-defined profession—consisting of education, a code of ethics, and licensing—you will be able to say, "The standards of my profession don't allow me to shortchange quality in this situation. I could lose my license or get sued." You will have a professional and legal basis for standing up to unenlightened managers, marketers, and customers—a basis that is sorely lacking today.</p> </blockquote> <p>Wow. In some ways, it sounds great to have a legal basis for saying no to bad development practices. In other ways, it sounds very scary to be subject to that liability.</p> <p>Mostly, though it makes me wonder if software development truly needs to have "standards higher than those normally tolerated in the marketplace" and "a primary emphasis on social responsibility over strictly individual gain." It makes me want to know more about what happened to make it generally agreed that in engineering, medicine, and law, public good can't be ensured by the marketplace alone.</p> <p>Because right now, one of the arguments for high standards in software development is that it's a good business decision. "<a href="http://programmer.97things.oreilly.com/wiki/index.php/Speed_Kills">The only way to go fast is to go well</a>," as <a href="http://blog.objectmentor.com/articles/category/uncle-bobs-blatherings">Uncle Bob Martin</a> says. Or, we want to make sure we don't take on the <a href="http://forums.construx.com/blogs/stevemcc/archive/2007/11/01/technical-debt-2.aspx">wrong kind of technical debt</a>, because that will be bad for the company in the long run.</p> <p>But for a profession, these high standards don't have to be justified solely in marketplace terms. Instead, they have been accepted by society as being important for its own public interest.</p> <p>In discussing how engineering came to be a profession, McConnell says:</p> <blockquote> <p>Historically, professional engineering has been established in response to threats to public safety. Although we take the safety of modern bridges for granted, in the 1860s American bridges were failing at the rate of 25 or more per year. Bridge failures and the loss of life they caused precipitated creation of a stricter engineering approach to bridge design and construction.</p> </blockquote> <p>I wonder what sort of disaster would need to happen for society to demand higher standards in software development. Or would a slow build-up of buggier and buggier software be enough? How many times do you need to lose your data, have your computer crash, or just plain not be able to figure out how to do what you want in a user interface before you've had enough? And if you've had enough, can you buy a competitor's software instead, or is it just as buggy?</p> <p>Can the problems of today's software development be fixed by the marketplace, or do they require regulation? Does software development need to be a profession?</p> programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com236tag:blogger.com,1999:blog-33777038.post-67665813530783018672010-07-25T22:16:00.001+01:002010-07-26T20:42:47.799+01:00Book Review: Professional Software Development<p>I can understand how many people sound as though they were disappointed in Steve McConnell's <a href="http://www.stevemcconnell.com/psd.htm">Professional Software Development: Shorter Schedules, Better Projects, Superior Products, Enhanced Careers</a>. It's not a "practical" book—like <a href="http://www.stevemcconnell.com/cc.htm">Code Complete</a>, <a href="http://www.stevemcconnell.com/rdcntnt.htm">Rapid Development</a>, or <a href="http://www.stevemcconnell.com/est-toc.htm">Software Estimation</a>—that you can immediately put into practice and improve your software's code or schedules.</p> <p>But whether or not you agree with McConnell's conclusions about how to "fix" software development by turning it into a profession—like engineering, medicine, or law—it does a good job highlighting some of the ongoing struggles in developing software.</p> <p>Many other reviews point out that the stratification and specialisation advocated by McConnell seem out of touch with agile development, and I agree. On the other hand, agile development encourages "<a href="http://www.agilemodeling.com/essays/generalizingSpecialists.htm">generalising specialists</a>," not straight-up generalists.</p> <p>Other reviewers have also pointed out that the ladder-like professional development program promoted by McConnell also seems overly-regimented, and I agree with that, too. On the other hand, if career progression depends on taking specific classes, publishing articles, or participating in conferences, that might be better than not being allowed time for any learning or professional development at all, which happens at some companies.</p> <p>[To be continued in "<a href="/2010/07/does-engineering-need-to-be-profession.html">Does 'Software Engineering' Need to be a Profession?</a>"]</p> programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com61tag:blogger.com,1999:blog-33777038.post-76188253908378601242010-07-10T09:58:00.001+01:002010-07-10T09:58:50.483+01:00Book Review: Growing Object-Oriented Software, Guided by Tests<p>Recently, I read <a href="http://www.growing-object-oriented-software.com/">Growing Object-Oriented Software, Guided by Tests</a> by Steve Freeman and Nat Pryce. Amongst excellent discussions of other TDD topics, it sheds a lot of light on good ways to use mock objects. </p> <p>Personally, I can remember reading Martin Fowler's <a href="http://martinfowler.com/articles/mocksArentStubs.html">Mocks Aren't Stubs</a> quite a while ago and concluding that I'd be a "classicist." </p> <p>Some time later, I started working with mocks as a way to isolate unit tests from "slow" dependencies, such as databases, trying to make them run more quickly. I didn't have much success, though, because I was still writing my tests in a classicist style. </p> <p>This book helped open my eyes to how the "mockist" style really works, and why it can be a good thing. I absolutely recommend it to any programmer who is doing TDD (or writing unit tests), but who still feels like when it comes to being a mockist, they just don't get it. </p> <p>I also think a great complement to the book is the video of J. B. Rainsberger's presentation <a href="http://www.infoq.com/presentations/integration-tests-scam">Integration Tests Are A Scam</a>. </p> <p>As a note on how to read the book, I got a bit bogged down in the middle section, with the worked example. I ended up skipping to the final section and came back to the middle after. Reading it like that worked just fine. I also think it could be interesting to alternate chapters of the middle section with those of the final section.</p> programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com12tag:blogger.com,1999:blog-33777038.post-59914457100213560132010-04-24T17:13:00.001+01:002010-04-29T21:33:55.900+01:00Do Unit Tests and Quality Code Result in Fewer Bugs?<p>At the end of my team's last release, I set out to prove that unit tests and quality code lead to fewer bugs.</p> <p>Here are the tools I used.</p> <p><strong>Jira</strong></p> <p>The first thing to know is that the team I'm on keeps its features in <a href="http://www.atlassian.com/software/jira/">Jira</a>, and when we commit code to <a href="http://subversion.apache.org/">Subversion</a>, we include the Jira ID in the comments.</p> <p>Below, you'll see how this helped me relate code to features.</p> <p>The second thing to know is when we find bugs in a feature during its development, in Jira we link those bugs back to the parent feature.</p> <p>This allowed me to measure how many bugs had been reported for each feature at release.</p> <p><strong>SvnPlot</strong></p> <p>There's an open source project called <a href="http://code.google.com/p/svnplot/">svnplot</a> that allows you to export the information stored in svn to a <a href="http://www.sqlite.org/">SQLite</a> database. To do this, follow the instructions in Step 1 of the <a href="http://code.google.com/p/svnplot/wiki/Introduction">Quick Start</a>.</p> <p>You end up with a couple tables that include rows for each revision, including the comment and the files that were added, removed, and changed.</p> <p><strong>ANTLR</strong></p> <p>I used <a href="http://antlrcsharp.codeplex.com/">ANTLR C# grammar</a> to help map the files changed to classes.</p> <p><strong>NCover</strong></p> <p>I used <a href="http://www.ncover.com/">NCover</a> to measure unit test coverage of the added and changed classes.</p> <p><strong>NDepend</strong></p> <p>And finally, I used <a href="http://www.ndepend.com/">NDepend</a> to measure code quality of those classes, as well as to query the coverage metrics.</p> <p><strong>Results</strong></p> <p>This is the part where I'd love to show some fancy graphs proving my point. Unfortunately, the results weren't exactly conclusive.</p> <p>I ended up dropping the idea of trying to correlate code quality to number of bugs altogether, because I just ended up with a mess.</p> <p>The results for how unit test coverage related to bugs is sort-of presentable, at least, but they don't show a nice correlation:</p> <table border="1" cellspacing="0" cellpadding="2"><tbody> <tr> <th>Feature</th> <th>LOC Changed / Bug</th> <th>Average Coverage (%)</th> </tr> <tr> <td>1</td> <td>521</td> <td>65</td> </tr> <tr> <td>2</td> <td>290</td> <td>38</td> </tr> <tr> <td>3</td> <td>165</td> <td>0</td> </tr> <tr> <td>4</td> <td>140</td> <td>54</td> </tr> <tr> <td>5</td> <td>125</td> <td>21</td> </tr> <tr> <td>6</td> <td>76</td> <td>25</td> </tr> <tr> <td>7</td> <td>74</td> <td>77</td> </tr> <tr> <td>8</td> <td>59</td> <td>30</td> </tr> <tr> <td>9</td> <td>2</td> <td>80</td> </tr> </tbody></table> <p>I'd like to think I'll try again another day, but given those results, I just don't know. I can come up with many reasons why things didn’t come out the way I'd hoped:</p> <ul> <li>The amount of change for each feature was very diverse. Some features involved lots of code changes and others involved very few, so that the features may not really be comparable in this way. </li> <li>Some features involved mostly changing UI code, where the coverage can't be high, because we don't currently have a good way to unit test our UI code. </li> <li>Some features, especially Feature 9, had high test coverage, but the unit tests were very low on actual assertions. </li> <li>There's just not enough data. </li> </ul> <p>In the end, if my argument to the business is that unit tests and code quality are important because they reduce the number of bugs, results like these won't help me make my case.</p> <p>So, if you know of more persuasive results—either your own or stuff out there in the literature—I'd love to hear about it :-)</p> programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com50tag:blogger.com,1999:blog-33777038.post-77921614309822532052010-03-08T15:10:00.001+00:002010-03-08T15:10:39.693+00:00Using the Windows Findstr Command to Find Text, Files and Folders<p>Currently, I like the <a href="http://technet.microsoft.com/en-us/library/bb490907.aspx"><code>findstr</code></a> command better than other ways to search files in Windows.</p> <p><strong>Prerequisite: Open Command Window Here</strong> <br />For XP, it's part of <a href="http://www.microsoft.com/windowsxp/Downloads/powertoys/Xppowertoys.mspx">Microsoft PowerToys for Windows XP</a>.</p> <p>For Vista and Windows 7, apparently you <a href="http://blogs.msdn.com/tims/archive/2006/09/18/windows-vista-secret-1-open-command-prompt-here.aspx">hold down the hold down the shift key and right click</a>.</p> <p><strong>Finding File Contents</strong> <br />Once you have a command window open at the directory you want to search within, you  can do something like this, which will return all lines containing "MyText" in all subdirectories of the current one, case-insensitive, and only searching files that contain printable characters:</p> <p><code>findstr /s /i /p "MyText" *.*</code></p> <p>It turns out that "MyText" is treated as a regular expression, which is great. But if you don't want it treated as a regular expression, you can use the <code>/l</code> or <code>/c:</code> options. </p> <p><strong>Finding File & Folder Names</strong> <br />Instead of giving <code>findstr</code> files to search, you can pipe text to it from another command, so to search for file or folder names, you can give it the results of the <code>dir</code> command to search:</p> <p><code>dir /s /b | findstr /i "MyFileName.txt"</code></p> <p><strong>Combining the Two</strong> <br />Say you want to find all the lines containing "MyText", except you don't want those that are part of a subversion directory. You can do this, where the <code>/v</code> option means only return lines that <em>don't</em> match:</p> <p><code>findstr /s /i /p "MyText" *.* | findstr /v /l ".svn"</code></p> programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com16tag:blogger.com,1999:blog-33777038.post-32770408831614135012010-02-18T23:30:00.002+00:002010-02-18T23:33:18.894+00:00Software Development Career Paths: Up or Out?<p>Continued from <a href="/2010/02/software-development-career-paths.html">Software-Development Career Paths: Organizational Quality</a>.</p> <p><strong>Moving Up <br /></strong>For this option, mostly I can only repeat the traditional oft-heard worries: your tech skills will get rusty and you'll be stuck in middle-management forever.</p> <p>On the other hand, I don't think developers who like to code should dismiss moving up out of hand. If you get a chance, try it. Who knows, you might like it.</p> <p>There's a nice discussion about staying technical as a manager over on Rands In Repose: <a href="http://www.randsinrepose.com/archives/2007/02/07/technicality.html">Technicality</a>. If you keep your technical skills sharp, then hopefully if it turns out that you hate being a manager, you can still go back to being a developer.</p> <p><strong>Moving Out <br /></strong>Lately I have a new perspective on moving out, thanks to the software craftsmanship movement. How many books and articles have you read lately that use the word "journeyman?" There's a reason the word "jouney" is in there.</p> <blockquote> <p>In parts of Europe… spending time as a journeyman, moving from one town to another to gain experience of different workshops, was an important part of the training of an aspirant master. [Wikipedia, <a href="http://en.wikipedia.org/wiki/Journeyman">Journeyman</a>]</p> </blockquote> <p>Although I don't think it's a perfect book, <a href="http://my.safaribooksonline.com/9780596806842">Apprenticeship Patterns</a> by Dave Hoover and Adewale Oshineye is currently the best reference I know for thinking about different ways to approach a career as a software craftsman from the perspective of an individual developer rather than that of a manager.</p> <p><strong>Another Option: Stay Small, Maybe Even Really Small <br /></strong>Keep in mind that not all organizations force you to choose between coding and managing. Smaller companies often don't have "<a href="http://www.togsblom.com/2010/02/i-just-want-to-be-programmer-but-can-i.html">Eiffel Tower corporate hierarchies</a>." If you're moving around, you might find more satisfaction sticking with smaller companies, especially since that way you're more likely to personally provide value to customers, as described by Cameron Purdy in his great article <a href="http://www.jroller.com/cpurdy/entry/eight_theses">Eight Theses</a>.</p> <p>Don't forget that you can go it on your own. Recently at DDD8, <a href="http://geekswithblogs.net/twickers/Default.aspx">Liam Westley</a> gave <a href="http://vimeo.com/9216563">a talk</a> about owning your own software development company. Of course, the talk assumed that you already "have commercial ideas, clients, or sales leads." I have no idea how to get to that point, but the fact that Liam was there giving the talk is a reminder that people actually do manage it.</p> <p><strong>Staying Motivated <br /></strong>Whether you literally become a journeyman by moving among companies or you stay for a long time at a single company, if you don't want to move up, you may need to look for non-traditional ways to keep yourself up-to-date technically and otherwise generally motivated, especially if you find yourself occasionally working at places that treat you as an interchangeable coding machine.</p> <p><a href="http://my.safaribooksonline.com/9780596806842">Apprenticeship Patterns</a> gives some ideas about how to do this. Obviously, there are always things like learning new languages, participating in either local or virtual developer communities, and in open source projects.</p> <p>Interestingly, all of those things follow a general leadership-followership pattern that's pointed out in <a href="http://my.safaribooksonline.com/9780787996659">The Art of Followership</a>:</p> <blockquote> <p>[An] example, which is becoming increasingly common in developed countries, occurs with employees who have extensive professional education. These employees can often perform their work assignments without relying on technical guidance from their hierarchical superiors. Their education often includes a strong socialization component, instilling in them a desire for autonomous, self-controlling behavior and the tendency to look to their professional colleagues for support and recognition. This often occurs with university professors who are highly educated and tenured. These individuals often view their university as a place to practice their teaching and research skills with little interference by administrators. They work with and obtain feedback from colleagues, they read academic journals for up-to-date information on their field, and they derive intrinsic satisfaction from their publications and recognition at academic conferences. Similar tendencies exist in firms that provide consulting and accounting services. In these instances, professional education and socialization can replace or substitute for a leader's direction and supportive behavior. [Chapter 3, Three Perspectives on Followership by Howell and Mendez]</p> </blockquote> <p>I don't think the software development profession has necessarily quite reached this point yet, but it's an interesting perspective to keep in mind. Ideally, you can get "support and recognition" from your "hierarchical superiors" as well as your peers. Anything else is draining. However, in a pinch, don't forget to look out as well as up to get the sustenance you need to nurture your craft.</p>programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com27tag:blogger.com,1999:blog-33777038.post-90965788207832241002010-02-16T23:09:00.002+00:002010-02-18T23:32:28.197+00:00Software-Development Career Paths: Organizational Quality<p>A developer-friend of mine, <a href="http://www.togsblom.com/">Tom Wessels</a>, recently asked the computer-age-old question:</p> <blockquote> <p><a href="http://www.togsblom.com/2010/02/i-just-want-to-be-programmer-but-can-i.html">I just want to be a programmer. But can I?</a></p> </blockquote> <p>He follows up the question with a great quote from the great and still-relevant book <a href="http://www.amazon.com/Peopleware-Productive-Projects-Teams-Second/dp/0932633439/">Peopleware</a> by DeMarco and Lister, which points the career path encouraged, or at least tolerated, by many organizations: If you're not on your way up, you'd best be on your way out.</p> <p>To be fair, DeMarco and Lister follow up this description with a contrasting one, "The Mentality of Permanence:"</p> <blockquote> <p>Over the years, we have been privileged to work and consult for a few companies with extraordinarily low turnover. You won't be surprised to learn that low turnover is not the only good thing about these companies. Indeed, they seem to excel at many or most of the people-conscious qualities discussed in these pages. They are the best…. In the best organizations, the short term is not the only thing that matters. What matters more is being the best. And that's a long-term concept.</p> </blockquote> <p>DeMarco and Lister go on to describe ways in which these companies invest in their employees, fostering a culture of learning, professional improvement, permanence, and organizational excellence.</p> <p>To answer the question, I think you need to look at your career along a few different dimensions. One of which is the quality of the organizations at which you will work.</p> <p>It might be possible, to get a job at one of these "best organizations" and be comfortable for some time with one of the options Tom presents:</p> <blockquote> <p>You reach a point where you just accept that you're at a good company, you get to write code in a somewhat enjoyable fashion, and you leave it at that.</p> </blockquote> <p>Hooray! Yes, I think it would be good for everyone to at least have that option for a few years at some point in their careers.</p> <p>But a couple things stand in the way. </p> <p>First, it can be hard to get a job at an organization like that, not only because its bar to entry might be pretty high, but also because from the outside, it can be hard even to identify which companies are truly the best. Or maybe you just don't happen to live near the offices of any of those best organizations and aren't able to move.</p> <p>Second, nothing lasts forever, including "being the best." I'm not sure the great organizations DeMarco and Lister use to demonstrate their "mentality of permanence" are still considered to be the best now that it's 10-20 years later: Reader's Digest, Hewlett-Packard, Pacific Bell? Even the lean software development movement's favourite company, Toyota, has recently shown signs of falling off the "being the best" pedestal.</p> <p>In short, the mentality of permanence may not be permanent. If you're lucky enough to find yourself working for one of these best organizations, that's super. Enjoy it while it lasts, or for as long as you're comfortable staying. But don't be shocked if it doesn't last forever.</p> <p>Which brings us to the next dimension. Given that you might find yourself working at lower-quality, "up or out" organizations during your career, should you move up or should you move out?</p> <p>Continued in <a href="/2010/02/software-development-career-paths-up-or.html">Software Development Career Paths: Up or Out?</a></p>programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com53tag:blogger.com,1999:blog-33777038.post-13435719343074258312009-12-06T16:43:00.004+00:002010-03-07T17:43:11.226+00:00A Year Of London Developer Events<p>Today marks a year since I moved to London from Chicago. So far, my favourite thing about being here is <strike>the trains run like clockwork</strike> the vibrant software developer community.</p><p>Here is a list of events I've attended, all of which I highly recommend:</p><ul><li><a href="http://altnetgroup.com/">AltNetBeers and AltNetWorkshops</a> organised by <a href="http://serialseb.blogspot.com/">Sebastien Lambla</a> <a href="http://twitter.com/serialseb"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYKsYow5QwiJjEvOawbJNM4kYbhut-lYhyphenhyphenFJGmKLIrJqIOTWeSe3CcKG5bit_gkCf08rwG0GwJ2MpeP9-sNmK_IzOXPqcThohHWI0Wvcsmavrq-JYkmyhwYWNVvcVRXeViJLoY/s800/twitter_square_blue.gif" class="twitter" alt="Twitter" /></a></li><li><a href="http://www.dnug.org.uk/">London .NET User Group</a> organised by <a href="http://codebetter.com/blogs/ian_cooper/default.aspx">Ian Cooper</a> <a href="http://twitter.com/icooper"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYKsYow5QwiJjEvOawbJNM4kYbhut-lYhyphenhyphenFJGmKLIrJqIOTWeSe3CcKG5bit_gkCf08rwG0GwJ2MpeP9-sNmK_IzOXPqcThohHWI0Wvcsmavrq-JYkmyhwYWNVvcVRXeViJLoY/s800/twitter_square_blue.gif" class="twitter" alt="Twitter" /></a> and <a href="http://www.zimakki.com/blog/">Zi Makki</a> <a href="http://twitter.com/zimakki"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYKsYow5QwiJjEvOawbJNM4kYbhut-lYhyphenhyphenFJGmKLIrJqIOTWeSe3CcKG5bit_gkCf08rwG0GwJ2MpeP9-sNmK_IzOXPqcThohHWI0Wvcsmavrq-JYkmyhwYWNVvcVRXeViJLoY/s800/twitter_square_blue.gif" class="twitter" alt="Twitter" /></a></li><li>Open Source .NET, Architecture & DDD, Agile PM & Scrum, and Agile Testing & BDD events at <a href="http://skillsmatter.com/go/home">Skills Matter</a> <a href="http://twitter.com/skillsmatter"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYKsYow5QwiJjEvOawbJNM4kYbhut-lYhyphenhyphenFJGmKLIrJqIOTWeSe3CcKG5bit_gkCf08rwG0GwJ2MpeP9-sNmK_IzOXPqcThohHWI0Wvcsmavrq-JYkmyhwYWNVvcVRXeViJLoY/s800/twitter_square_blue.gif" class="twitter" alt="Twitter" /></a>. Several of the ones I've been to were organised by <a href="http://gojko.net/">Gojko Adzic</a> <a href="http://twitter.com/gojkoadzic"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYKsYow5QwiJjEvOawbJNM4kYbhut-lYhyphenhyphenFJGmKLIrJqIOTWeSe3CcKG5bit_gkCf08rwG0GwJ2MpeP9-sNmK_IzOXPqcThohHWI0Wvcsmavrq-JYkmyhwYWNVvcVRXeViJLoY/s800/twitter_square_blue.gif" class="twitter" alt="Twitter" /></a></li><li><a href="http://openspacecode.com/">Open Space Coding Days</a> organised by <a href="http://alandean.blogspot.com/">Alan Dean</a> <a href="http://twitter.com/adean"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYKsYow5QwiJjEvOawbJNM4kYbhut-lYhyphenhyphenFJGmKLIrJqIOTWeSe3CcKG5bit_gkCf08rwG0GwJ2MpeP9-sNmK_IzOXPqcThohHWI0Wvcsmavrq-JYkmyhwYWNVvcVRXeViJLoY/s800/twitter_square_blue.gif" class="twitter" alt="Twitter" /></a></li><li><a href="http://www.altnetuk.com/">The Alt.Net UK Conference</a> organised by Alan Dean, Ian Cooper, <a href="http://blog.benhall.me.uk/">Ben Hall</a> <a href="http://twitter.com/ben_hall"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYKsYow5QwiJjEvOawbJNM4kYbhut-lYhyphenhyphenFJGmKLIrJqIOTWeSe3CcKG5bit_gkCf08rwG0GwJ2MpeP9-sNmK_IzOXPqcThohHWI0Wvcsmavrq-JYkmyhwYWNVvcVRXeViJLoY/s800/twitter_square_blue.gif" class="twitter" alt="Twitter" /></a>, and Sebastien Lambla</li><li><a href="http://www.meetup.com/DDD-London/">DDD Meetups</a> organised by Adam Shimali</li><li><a href="http://www.thoughtworks.co.uk/">ThoughtWorks</a> <a href="http://londongeeknights.wetpaint.com/">London Geek Nights</a> organised by <a href="http://rrees.wordpress.com/">Robert Rees</a> <a href="http://twitter.com/rrees"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYKsYow5QwiJjEvOawbJNM4kYbhut-lYhyphenhyphenFJGmKLIrJqIOTWeSe3CcKG5bit_gkCf08rwG0GwJ2MpeP9-sNmK_IzOXPqcThohHWI0Wvcsmavrq-JYkmyhwYWNVvcVRXeViJLoY/s800/twitter_square_blue.gif" class="twitter" alt="Twitter" /></a></li><li><a href="http://xpday-london.editme.com/eXtremeTuesdayClub">eXtreme Tuesday Club</a> <a href="http://twitter.com/extremetuesday"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYKsYow5QwiJjEvOawbJNM4kYbhut-lYhyphenhyphenFJGmKLIrJqIOTWeSe3CcKG5bit_gkCf08rwG0GwJ2MpeP9-sNmK_IzOXPqcThohHWI0Wvcsmavrq-JYkmyhwYWNVvcVRXeViJLoY/s800/twitter_square_blue.gif" class="twitter" alt="Twitter" /></a></li><li><a href="https://wave.google.com/wave/#restored:wave:googlewave.com!w%252Bfn0VOKp-D">#DevBookClub</a> <a href="http://search.twitter.com/search?q=devbookclub"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYKsYow5QwiJjEvOawbJNM4kYbhut-lYhyphenhyphenFJGmKLIrJqIOTWeSe3CcKG5bit_gkCf08rwG0GwJ2MpeP9-sNmK_IzOXPqcThohHWI0Wvcsmavrq-JYkmyhwYWNVvcVRXeViJLoY/s800/twitter_square_blue.gif" class="twitter" alt="Twitter" /></a> organised by <a href="http://holytshirt.blogspot.com/">Toby Henderson</a> <a href="http://twitter.com/holytshirt"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYKsYow5QwiJjEvOawbJNM4kYbhut-lYhyphenhyphenFJGmKLIrJqIOTWeSe3CcKG5bit_gkCf08rwG0GwJ2MpeP9-sNmK_IzOXPqcThohHWI0Wvcsmavrq-JYkmyhwYWNVvcVRXeViJLoY/s800/twitter_square_blue.gif" class="twitter" alt="Twitter" /></a> and <a href="http://www.shift-in.com">Chris Browne</a> <a href="http://twitter.com/shiftin"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYKsYow5QwiJjEvOawbJNM4kYbhut-lYhyphenhyphenFJGmKLIrJqIOTWeSe3CcKG5bit_gkCf08rwG0GwJ2MpeP9-sNmK_IzOXPqcThohHWI0Wvcsmavrq-JYkmyhwYWNVvcVRXeViJLoY/s800/twitter_square_blue.gif" class="twitter" alt="Twitter" /></a></li></ul>programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com6tag:blogger.com,1999:blog-33777038.post-78566580720859229192009-10-27T23:19:00.012+00:002009-10-28T00:19:53.140+00:00Misadventures in DDD With Not-So-Ubiquitous Language<p>Lots of people have been talking about DDD (<a href="http://my.safaribooksonline.com/0-321-12521-5/ch01lev1sec2">Domain-Driven Design</a>) lately, and my friend Tom just discussed it over on <a href="http://www.togsblom.com">his blog</a> in the article <a href="http://www.togsblom.com/2009/10/refactoring-toward-deeper-insight.html">Refactoring Toward Deeper Insight</a>. So, I thought I'd share one way <b>not</b> to do DDD.</p><p>Once upon a time, shortly after the big blue book was published, I saw it in the store and thought it looked interesting. I bought it and read through the first section about knowledge crunching and ubiquitous language. And it all made so much sense—where I worked, the business analysts and software developers already worked together to crunch knowledge into a domain model they both understood (or so I thought). The trouble was, even though when they talked together, they used that language, when the developers actually wrote the code, they used their own. Why? Well, I didn't know—mostly just because we usually thought our names for things were better, I supposed. Trying to keep the language the same just wasn't something we'd thought about much.</p><p>So, I decided that on the project I was working on, we'd start doing DDD by using the names from the business language for the classes in our code. I didn't discuss it with the business people, since I didn't think it involved them much—they didn't need to change their language, we developers just needed to use it.</p><p>Everything went fine for most of the project. Then, a couple days before release, the business decided that they wanted to rename one of our core domain concepts—and that was okay, right, because it was just changing a few labels on a few screens?</p><p>And that's when I learned that if you want to do DDD, it helps to get buy-in from the business.</p><p>So, happy DDD-ing everybody—because I do think lots of the ideas are great and worth exploring—just make sure you let the business know what you're up to and you'll avoid my rookie mistake.</p>programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com0tag:blogger.com,1999:blog-33777038.post-76872353137183133932009-10-26T15:13:00.001+00:002010-09-05T21:45:09.703+01:00Estimating is Like Measuring the Coast of Great Britain<p>Earlier today, <a href="http://lizkeogh.com/">Liz Keogh</a> <a href="http://twitter.com/lunivore/status/5168577622">tweeted this</a>, which I couldn't agree with more, as long as she's saying what I think she's saying: </p> <blockquote>Thinking about fractal estimation—estimates grow as scale shrinks—and wondering what dimension current projects have.</blockquote> A while back, every time I started doing technical estimates for a release, I began to think more and more of the illustrations along the side of this Wikipedia article: <a href="http://en.wikipedia.org/wiki/How_Long_Is_the_Coast_of_Britain%3F_Statistical_Self-Similarity_and_Fractional_Dimension">How Long Is the Coast of Britain? Statistical Self-Similarity and Fractional Dimension</a>. <p></p> <p>The situation was, that as a developer in a waterfall process, when I was trying to estimate how long it would take to code something, even with the requirements supposedly "fixed," unless I examined the code I was proposing to change in so much detail that I was basically writing it—and that's <b>not</b> estimating anymore—I'd always miss things that would make coding take longer than I'd estimated. In essence, there were always craggy little details that upon actually writing the code, became significant or added up with others to become significant. </p> <p>Now, I know that if your architecture and code are clean, this should happen less. But I still think it's generally true that until you actually write the code, you really don't know how long it will take, and the amount of time will usually be longer than you think when analyzing it at higher levels. </p> <p>Then, I thought of this problem again when I attended a talk on <a href="http://programmergrrl.blogspot.com/2009/07/scope-budgeting.html">Scope Budgeting</a>. There, the general issue is that in Agile, if you write a user story, estimate it, put it in your backlog, and only elaborate it when you pull it back out to implement it, you may find that the size of the story grows at elaboration-time. </p> <p>According to Liz's fractal estimation rule, that makes complete sense and should be expected. I agree. Whenever I have worked with user proxies to move from general functional requirements to specifics, the estimate has always increased. The amount of work needed to address all the details we discover always grows beyond the original estimate. If we made commitments based on that estimate, the only way to keep them is to prioritize and remove some of the details. </p> <p>I can think of a few ways to address this problem, if we want to consider it to be a problem:</p> <ol> <li>Just be aware of it and deal with it as needed, which is a lot better than not being aware of it at all. </li> <li>Start measuring it, so you can factor it into your future estimates. This might be taken care of by comparing estimates to actuals and factoring that into future estimates. You'll need to decide whether the time it takes to do this is worth the return, though. </li> <li>Move toward techniques like <a href="http://www.agilemanagement.net/Articles/Weblog/KanbanPlanningandEstimati.html">Kanban that de-emphasize estimation</a>. Whether or not this works for you will depend on your current situation, but it's always worth questioning whether you're estimating because you truly need to or just because that's what you're used to. </li> </ol> <p> <hr /></p> <p>Update Sept, 2010:</p> <ul> <li>Liz also wrote about the fractal nature of estimation as part of <a href="http://lizkeogh.com/2009/11/30/estimation-anti-patterns/">Estimation anti-patterns</a>.</li> <li><a href="http://blog.dannorth.net/">Dan North</a> mentioned it in <a href="http://blog.dannorth.net/2009/07/01/the-perils-of-estimation/">The perils of estimation</a>.</li> <li>Dan also has referenced it more recently in <a href="http://blog.dannorth.net/2010/08/30/introducing-deliberate-discovery/">Introducing Deliberate Discovery</a>.</li> </ul> programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com1tag:blogger.com,1999:blog-33777038.post-17667137814012612922009-09-06T14:50:00.018+01:002009-12-16T18:41:29.560+00:00Pair Programming for Flow<p>
A while ago, I attended the workshop <a href="http://skillsmatter.com/event/agile-testing/debugging-pair-programming">Debugging Pair Programming</a> by <a href="http://blog.mattwynne.net/">Matt Wynne</a> <a href="http://twitter.com/mattwynne"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYKsYow5QwiJjEvOawbJNM4kYbhut-lYhyphenhyphenFJGmKLIrJqIOTWeSe3CcKG5bit_gkCf08rwG0GwJ2MpeP9-sNmK_IzOXPqcThohHWI0Wvcsmavrq-JYkmyhwYWNVvcVRXeViJLoY/s800/twitter_square_blue.gif" class="twitter" alt="Twitter" /></a>.
</p><p>
Matt gave the same workshop at <a href="http://agile2009.agilealliance.org/">Agile 2009</a>. That website has <a href="http://agile2009.agilealliance.org/node/1206">a good write-up</a> of how it worked.
</p><p>
After the first part, where we discussed how to convince <a href="http://blog.mattwynne.net/2009/08/09/personas-for-debugging-pair-programming-session/">different developer personas</a> why they should cooperate with pair programming, we moved on to the second part, where we paired up and interviewed each other about good experiences pair programming or collaborating in other ways.
</p><p>
I was paired with <a href="http://tomtenthij.co.uk/">Tom ten Thij</a> <a href="http://twitter.com/tomtt"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYKsYow5QwiJjEvOawbJNM4kYbhut-lYhyphenhyphenFJGmKLIrJqIOTWeSe3CcKG5bit_gkCf08rwG0GwJ2MpeP9-sNmK_IzOXPqcThohHWI0Wvcsmavrq-JYkmyhwYWNVvcVRXeViJLoY/s800/twitter_square_blue.gif" class="twitter" alt="Twitter"></a>, who said something really interesting about pair programming.
</p><p>
He said that pairing can make it easier to get into flow.
</p><p>
This was completely the opposite of what I'd heard before about pair programming. Before, I'd heard it can be difficult to achieve flow while pairing—that you might even have to give up on flow, but that the increased code quality is probably worth the trade-off.
</p><p>
But Tom's point was that while pairing, you're less likely to procrastinate getting into your coding task. In other words, having a partner helps force the "<a href="http://programmergrrl.blogspot.com/2009/04/writing-unit-tests-should-be-fun.html">activation energy</a>" that flow activities can require.
</p><p>
So, as long as your pair works well together, and you keep everyone engaged by doing something like <a href="http://www.stickyminds.com/sitewide.asp?ObjectId=9101&Function=edetail&ObjectType=COL">ping-pong programming</a>, you might be able to achieve flow after all.
</p>programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com2tag:blogger.com,1999:blog-33777038.post-17198124200953798272009-08-08T19:22:00.020+01:002009-12-16T19:18:29.561+00:00Misadventures In BDD With NBehave<p>
From my previous post, you might have picked up that I like the idea of BDD's given-when-then construct for describing scenarios.
</p><p>
For a while, I've been wanting to use this syntax in unit/integration tests to make them clearer. But I've been hoping to do that without switching languages or unit-testing frameworks. Toward that end, I tried out <a href="http://nbehave.org/">NBehave</a>.
</p><p>
Here's some test code that demonstrates my worst fears about why NBehave might not be right for me:
</p>
<pre class="brush:csharp;">public void Execute()
{
var story = new Story("Search Contacts by Relationship Strength")
.AsA("User")
.IWant("To search on the Strength field")
.SoThat("I can find Contacts who have a given Strength");
Scenario scenario = story
.WithScenario("Find Contacts with Strength of 50");
scenario.Given("The database contains a Contact with a Strength of 50")
.And("a search results view", GivenResultsInfo)
.And("a query for Contacts with Strength of 50",
GivenQueryForContactsWithStrengthOf50)
.When("The search is run", WhenRunSearch)
.Then("The results contain Contacts with Strength of 50",
ThenShouldContainResultsWithStrengthOf50);
}
private void GivenResultsInfo()
{
var resultsView = new ReadOnlyResultsView(
ExtendableEntity.Person, SortType.Ascending,
new[] { Column }, Column);
ResultsInfo = new ResultsInfo(resultsView);
}
private void GivenQueryForContactsWithStrengthOf50()
{
var condition =
new DecimalCondition(Column, ComparisonOperation.EqualTo);
condition.DataField.Value = 5;
_query = TypeHelper.GetAdvancedQuery(_entityType);
_listManager.AddListToAdvancedQuery(_query);
_query.MainConditionGroup.AddCondition(condition);
}
private void WhenRunSearch()
{
ISearchService service = TypeHelper.GetSearchService(_entityType);
ISearchResults results = service.GetResults(_query, ResultsInfo);
_resultsData = results.Results;
}
private void ThenShouldContainResultsWithStrengthOf50()
{
Assert.Greater(_resultsData.Rows.Count, 0);
foreach (DataRow row in _resultsData.Rows)
Assert.AreEqual(5, (decimal)row[Column.Name]);
}</pre>
<p>But for me, creating reports of the text descriptions wasn't the main point. The main point was just to better organize the test. When I started writing the code, I thought maybe I'd just skip the text, but then I thought, "Oh well, I might as well do it."
</p><p>
And that was fine, but when the requirements changed, I had trouble keeping the text synchronized with the code.
</p><p>
After I wrote the initial code, the team decided that instead of having strength on a scale from 0-60, we'd have it on a scale from 0.0-6.0. And when I changed the code, I was in a hurry, since that change hadn't been part of the original estimate, and consequently threatened our timeline.
</p><p>
So I ended up with text that said 50 and code that said 5.
</p>programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com5tag:blogger.com,1999:blog-33777038.post-21054602355312381462009-08-03T21:44:00.028+01:002009-12-16T19:48:39.196+00:00Open Space Coding Day: TDD As If You Meant It and Cucumber With IronRuby<p>
Saturday I was at the <a href="http://www.altnetuk.com/2009-08-01.en.html">Open Space Coding Day</a> that was part of the <a href="http://www.altnetuk.com/2009.en.html">Alt.Net UK Conference 2009</a>.
</p><p>
In the morning, I was in the session on <a href="http://www.parlezuml.com/softwarecraftsmanship/sessions/tdd_as_if_you_meant_it.htm">TDD As If You Meant It</a>. <a href="http://gojko.net/">Gojko Adzic</a> already did a pretty good write up, so I'll point you there to learn more about it: <a href="http://gojko.net/2009/08/02/tdd-as-if-you-meant-it-revisited/">TDD as if you meant it – revisited</a>.
</p><p>
In the afternoon, I was in the session about using <a href="http://cukes.info/">Cucumber</a> and <a href="http://rspec.info/">RSpec</a> with <a href="http://www.ironruby.net/">IronRuby</a>. Mostly, I was interested in this because I keep hearing really good things about Cucumber, but as a non-ruby person, I have never quite discovered what those good things actually look like.
</p><p>
I was also a bit psyched, because I was pretty sure I'd heard that <a href="http://en.oreilly.com/oscon2009/public/schedule/detail/7965">IronRuby was going 1.0 on my birthday</a>. But alas, it seems that article subtly changed since I last looked at it, from saying "IronRuby is 1.0!" to now saying "IronRuby is <i>almost</i> at 1.0!" A slight let-down, but that's okay. We still had a good session, and I'm the first person to understand that software doesn't always magically appear on a certain date just because we want it to.
</p><p>
To install IronRuby, Cucumber, and RSpec, I mostly used these instructions:</p><ul><li><a href="http://weblogs.asp.net/astopford/archive/2009/04/14/bdd-with-rspec-cucumber-ironruby.aspx">BDD with RSpec\Cucumber\IronRuby</a></li><li><a href="http://wiki.github.com/aslakhellesoy/cucumber/ironruby-and-net">IronRuby and .NET</a></li></ul>The process for me went something like this:<ol><li><a href="http://rubyforge.org/projects/rubyinstaller/">Install Ruby</a>.<br /><br /></li><li><a href="http://www.ironruby.net/Download">Install IronRuby</a>. (The day I was doing this, 0.6 was being billed as the current release. It looks like things have moved on.)<br /><br /></li><li>From <a href="http://wiki.github.com/aslakhellesoy/cucumber/ironruby-and-net">IronRuby and .NET</a>, do:</li><ol><li>Installing required gems</li><li>Creating a Cucumber wrapper script for IronRuby</li><li>Running the examples<br /><br /></li></ol><li>Now the examples ran, but there was some weird escape-character output. I didn't find the answer to how to fix this, but another person in the session, <a href="http://www.codegrunt.co.uk/">Lorenzo Stoakes</a> <a href="http://twitter.com/lstoakes"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYKsYow5QwiJjEvOawbJNM4kYbhut-lYhyphenhyphenFJGmKLIrJqIOTWeSe3CcKG5bit_gkCf08rwG0GwJ2MpeP9-sNmK_IzOXPqcThohHWI0Wvcsmavrq-JYkmyhwYWNVvcVRXeViJLoY/s800/twitter_square_blue.gif" class="twitter" alt="Twitter"></a>, did. <a href="http://search.twitter.com/search?q=%23ironruby+%23altnetuk">Here's how that looked on Twitter</a>.<br /><br />For convenience, though, I guess I'll compile that into the single sentence: In your file that corresponds to <code>C:/Ruby/lib/ruby/gems/1.8/gems/cucumber-0.3.92/lib/cucumber/formatter/ansicolor.rb</code>, replace <code>Term::AnsiColor.coloring = false if...</code> with <code>Term::AnsiColor.coloring = false</code>.</li></ol><p>At that point, the examples seemed to sort-of run okay for me. I think Lorenzo and <a href="http://blog.robustsoftware.co.uk/">Garry Shutler</a> <a href="http://twitter.com/gshutler"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYKsYow5QwiJjEvOawbJNM4kYbhut-lYhyphenhyphenFJGmKLIrJqIOTWeSe3CcKG5bit_gkCf08rwG0GwJ2MpeP9-sNmK_IzOXPqcThohHWI0Wvcsmavrq-JYkmyhwYWNVvcVRXeViJLoY/s800/twitter_square_blue.gif" class="twitter" alt="Twitter"></a> got past some warnings that were getting output, but I didn't. I'm also pretty sure Garry also got RSpec to work.
</p><p>
What was the whole point? Well, since I didn't get past the examples, I'll sum it up with one of them.
</p><p>
Say you're developing a calculator. Your business person can specify the addition behaviour in text, like this:</p><pre class="brush:text">Feature: Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
Scenario Outline: Add two numbers
Given I have entered <input_1> into the calculator
And I have entered <input_2> into the calculator
When I press add
Then the result should be <output> on the screen
Examples:
| input_1 | input_2 | output |
| 20 | 30 | 50 |
| 2 | 5 | 7 |
| 0 | 40 | 40 |</pre><p>And you can make that executable by adding some code in a related code file like this, where you're testing a .NET assembly Calculator.dll that contains a Calculator class in the namespace Demo, and the Calculator class has <var>push</var> and <var>Add</var> methods:</p><pre class="brush:ruby">require 'spec/expectations'
$:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project
require 'Calculator' # Calculator.dll
Before do
@calc = Demo::Calculator.new # A .NET class in Calculator.dll
end
Given "I have entered $n into the calculator" do |n|
@calc.push n.to_i
end
When /I press add/ do
@result = @calc.Add
end
Then /the result should be (.*) on the screen/ do |result|
@result.should == result.to_i
end</pre><p>That does look pretty sweet.</p>programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com1tag:blogger.com,1999:blog-33777038.post-43858204996508701542009-07-28T21:10:00.023+01:002009-12-16T18:46:03.317+00:00Scope Budgeting<p>
A while back, I attended the talk <a href="http://www.thoughtworks.co.uk/what-we-say/events/tech-briefing_uk.html">Scope Is Not A Dirty Word</a> given by business analyst Angela Ashworth and delivery manager Mark Coster from <a href="http://www.thoughtworks.co.uk/">ThoughtWorks</a>.
</p><p>
The centre of the discussion was "scope budgeting," which basically boils down to having the developer work with the user to manage scope within an iteration.
</p><p>
In many flavours of agile, the user writes a story, the developer estimates it, and then it goes into the backlog. It's only when the story gets pulled from the backlog and put into an iteration that the user and developer fully flesh out the implementation details. But at that point, they may find they have scope creep—that the implementation will take longer than the original estimate.
</p><p>
At this point, the developer has two options:</p><ol><li>Implement the story, even though it will take longer than originally estimated, pushing out the other stories, potentially dropping some off the end of the release.</li><li>Talk to the user more. Let him know that the estimate has changed and why. See if together they can come up with a way to reduce the scope of the story to get it back down to the estimate.</li></ol></p>Option 2 is scope budgeting.
</p><p>
I have to admit that I was actually very disappointed to hear this from ThoughtWorks.
</p><p>
I have never been part of an agile project, I've only read about it. My agile daydreams included how nice it would be to have the user prioritise stories from the beginning, understanding that not everything would necessarily make it into a release, thus avoiding one of the activities I've come to think of as churn—the developer and user constantly having to re-prioritise and re-think functionality as scope creep happens in order to try to fit everything in or to figure out what is best to leave out.
</p><p>
I suppose I can understand why scope budgeting is a good idea. And I can understand that having all the stories in an unchanging ordered list from the beginning of the project isn't really very agile at all.
</p><p>
But it's still tough to see my daydreams shattered.
</p><p>
The up side is that it highlights that both the developer and the user are in the same boat, working together toward the same goal. In waterfall, each is under pressure to "be perfect." The user should write down every single implementation detail at the beginning of the project and the developer should estimate every one of them down to the minute. Later, when they discover that a requirement was missed, the developer blames the user for blowing the project. When they discover that an estimate wasn't quite right, the user blames the developer for blowing the project.
</p><p>
At least with agile and scope budgeting, the focus changes from blaming to recognising that neither the user nor the developer can make a perfect plan at the beginning of the project—that they need to work together throughout to figure out how to create the most value.</p>programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com1tag:blogger.com,1999:blog-33777038.post-91058862477469614082009-07-27T15:45:00.004+01:002009-12-16T18:47:28.800+00:00My Favorite Technical Books<p>
It's been half a year since I moved from Chicago to London, and there is still an awful lot of stuff that isn't unpacked and is sitting in boxes, including many, many books.
</p><p>
But last weekend, the DH and I added yet another bookcase to the flat, and it's time to take care of the box sitting at my feet, labeled "Amy's favorite computer books."
</p><p>
But wait, I hear you say, if those are your favorite computer books, how can they possibly still be packed away in a box? Don't you need them at your desk every day?
</p><p>
Not so much anymore. A few years ago, I bought a subscription to <a href="http://my.safaribooksonline.com">Safari Books Online</a>, which I can't say enough good things about. Yes, it can be expensive, but if you can scrape together the cash and you love technical books, it's great. Almost all of the books in my box are on there, so I don't need them at my desk.
</p><p>
The other aspect of having these books at my desk was that they were available for my teammates to easily grab and use. But now that I'm in London and those teammates are in Chicago, that doesn't happen anymore.
</p><p>
So, my favorite books have been sitting in their box until now. Now, I have a bookcase with glass doors available, so they won't get dusty. Here they come out of the box:
</p><p>
<a href="http://www.amazon.co.uk/Head-First-Design-Patterns-Freeman/dp/0596007124/">Head First Design Patterns</a>
by Freeman & Freeman
I can't say enough good things about this book. It was the book that made the light go on for me for understanding what design patterns are and why they are useful. I own two copies—one was for work and one for home—plus the poster.
</p><p>
<a href="http://www.amazon.co.uk/Working-Effectively-Legacy-Robert-Martin/dp/0131177052/">Working Effectively with Legacy Code</a>
by Michael Feathers
For when you have to deal with ugly code, old code, code written by someone else long gone from your company, scary code, code without unit tests, or code you wrote last year and now hate.
</p><p>
<a href="http://www.amazon.co.uk/Refactoring-Patterns-Addison-Wesley-Signature-Kerievsky/dp/0321213351/">Refactoring to Patterns</a>
by Joshua Kerievsky
A bridge between patterns and refactoring.
</p><p>
<a href="http://www.amazon.co.uk/Software-Estimation-Demystifying-Demystified-Practices/dp/0735605351/">Software Estimation: Demystifying the Black Art</a>
by Steve McConnell
Sometimes I curse that I read this, because it made my BDUF estimates more accurate. Don't worry, there's lots of other good stuff in there, though.
</p><p>
<a href="http://www.amazon.co.uk/Enterprise-Application-Architecture-Addison-Wesley-signature/dp/0321127420/">Patterns of Enterprise Application Architecture</a>
by Martin Fowler
This was the most-borrowed book in my library before I moved.
</p><p>
<a href="http://www.amazon.co.uk/Pro-2008-NET-Platform-Fourth/dp/1590598849/">Pro C# 2008 and the .NET 3.5 Platform</a>
by Andrew Troelsen
When I can't remember how something .NET 3.5 works, and I have trouble finding it online, this is where I end up.
</p><p>
<a href="http://www.amazon.co.uk/VB-VBA-Nutshell-Language-Languages/dp/1565923588/">VB & VBA In a Nutshell</a>
by Paul Lomax
Because unfortunately, sometimes VBA still happens.
</p><p>
There are two more that I need to mention, even though they aren't in the box. The first, I have on CD, and the second I used to borrow from a work-mate until I got Safari books:
</p><p>
<a href="http://www.amazon.co.uk/Design-patterns-elements-reusable-object-oriented/dp/0201633612/">Design Patterns: Elements of Reusable Object-Oriented Software</a>
by Gamma, Helm, Johnson and Vlissides
</p><p>
<a href="http://www.amazon.co.uk/Refactoring-Improving-Design-Existing-Technology/dp/0201485672/">Refactoring: Improving the Design of Existing Code</a>
by Martin Fowler
</p><p>
But wait? Where is <a href="http://www.amazon.co.uk/Mythical-Month-Essays-Software-Engineering/dp/0201835959/">The Mythical Man-Month</a> by Fred Brooks? Good question. Darn thing is too skinny. It's always getting itself lost.</p>programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com3tag:blogger.com,1999:blog-33777038.post-69348481158282931012009-07-26T14:13:00.010+01:002009-12-16T18:48:02.617+00:00Programmer.Grrl: The Prequel<p>
As I <a href="http://programmergrrl.blogspot.com/2009/06/happy-anniversary-to-me.html">mentioned before</a>, back in high school, I was pre-med. The interesting thing is, when I was about 15, I actually did take a programming class and really enjoyed it. It was BASIC on Apple IIe computers. I remember one of the projects being to code a dice game. What could be more fun that that? Not just playing a computer game—but creating one?
</p><p>
It didn't feel like school, it felt like play. And because it felt like play, and because I didn't know that programming was a real profession, when it came time to sign up for the next semester of classes, I decided I didn't have space in my schedule for Programming II. I needed to take more biology or chemistry or some such thing.
</p><p>
The problem was, where and when I grew up, in a small town out in the country and before the Internet, I didn't have any concept that what I'd done in the programming class was at all useful. I didn't make any connection between it and the software my family bought for our own PC clone—things like WordPerfect and Lotus 1-2-3.
</p><p>
I don't know that it's true, but I hope so, that the Internet has opened childrens' horizons, so that when they think about what they want to be when they grow up, they understand there is more available than the professions they see in their everyday lives. Because when I think about that programming class I took when I was 15, I always wonder what a better programmer I might be if I'd kept with it from way back then.
</p><p>
It also makes me think more about how people end up as programmers in general. One of the original joys of programming when I was 15 was that I was making something. Most of my life, especially my school life, didn't produce anything remotely tangible or useful. It was about completing assignments or studying for tests, where once the assignment was done or the test taken, it was over, and the graded paper or test wasn't useful in any way.
</p><p>
But programming was different. You could tinker around and write some code and have something useful when you were done. Making something—something that other people might even really like—it's a rush. I'm sure there are other programmers out there who got interested in programming because of that. And for us, that's one of the frustrations with Big Design Up Front or with other processes where it's difficult to link end-user value back to our own work. Even if the process works for the organization, it can be tough for the individual.</p>programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com0tag:blogger.com,1999:blog-33777038.post-1424876144673977252009-07-20T20:59:00.016+01:002009-12-16T18:48:47.597+00:00Companies are Addicted to Profit Like Smokers are Addicted to Nicotine?<p>
What I believe and what I'm discussing are two very different things. I absolutely can't agree more with pretty much everything Jim says in <a href="http://www.writebetterbits.com/2009/07/define-success.html">Define success...</a>.
</p><p>
My worry is that if an organization views its projects as successful, the argument that the success isn't sustainable may not be compelling. If so far, using its current methods, the organization has been making money, and as far as its managers can see, will continue to do so in the near future, how do you convince those managers that it needs to change?
</p><p>
It's even more difficult than convincing a smoker that smoking will kill him eventually, and that he should stop—at least in a logical sense. An organization isn't an individual, whose best interests are intrinsically aligned with the longevity of his body. An organization is a collection of individuals, who can leave at nearly any time. If the organization's methods aren't sustainable—if it won't make it through the next 50 years—how many employees really care, as long as they are currently able to cash their paychecks?
</p><p>
It reminds me of Alan Greenspan's <a href="http://en.wikipedia.org/wiki/Alan_greenspan#Late_2000s_recession">testimony about the economic meltdown</a>: "Those of us who have looked to the self-interest of lending institutions to protect shareholder's equity—myself especially—are in a state of shocked disbelief."
</p><p>
Yes, it's a shocker. It turns out that not everyone in an organization cares about its longevity, as long as they get their cash and escape before it implodes.
</p><p>
But let's assume better of employees of software companies, especially since most I've encountered really do seem to care a lot more than that.
</p><p>
It's still hard to convince people to change when the current model is "succeeding."
</p><p>
In organizations where meeting yearly financial targets takes higher priority than continuous improvement, the continuous-improvement conversation can end up working like this variation of being too busy sawing to sharpen the blade:<blockquote>Lumberjack: Say boss, this blade is getting dull. It's getting slower for me to cut down the trees. I don't think we're going to make our quota.
</p><p>
Supervisor: You have a point. How long do you think it will take for you to sharpen the blade?
</p><p>
Lumberjack: I'm not sure. Since I've been working here, we've never sharpened the blades, so it's difficult to estimate how long it would take, because I'm out of practice. Plus, the blades are pretty dull, so it probably would take longer than usual anyway.
</p><p>
Supervisor: Hmmm. I'm not sure we'll be able to make our quota if we don't know how long it will take. We can't risk that. At our current rate of cutting, we can still make the quota if we hire in a few contractor lumberjacks. We'll do that.</blockquote>It's not necessarily that the members of the organization don't want to improve—they may just think they don't have time given their current constraints.
</p><p>
And as far as the greater organization is concerned, they still made their quota. As far as it's concerned, everything is hunky-dory.
</p><p>
So, I'm back to the question. If the organization thinks the project was a success, but some people do not—some people think that success will be unsustainable in the long run—how do those people convince the rest of the organization that change is needed now?</p>programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com6tag:blogger.com,1999:blog-33777038.post-61598758663225447212009-07-19T13:54:00.008+01:002009-12-16T18:49:54.528+00:00What If Your Unsuccessful Project Wasn't?<p>
In <a href="http://www.writebetterbits.com/2009/07/large-scale-project-doesn-equal-large.html">Large-Scale Project Doesn't Equal Large-Scale Development</a>, <a href="http://www.writebetterbits.com/">Jim Fiorato</a> concludes that "The concept of parallelizing development with a large team to deliver a large amount of code for a large project all at once, is in my opinion, well... broke."</p><blockquote>The only successful large projects I've been a part of have consisted of small development releases.</blockquote><p>and</p><blockquote>With the "large scale development" mind set, the odds are stacked against you. You'll find that you've fallen short on what you've envisioned, fallen short on your timeline, and probably done some irreparable damage to your talented team.
</blockquote><p>My concern is, so what? Just because a project fell short of what was envisioned, blew the timeline, or damaged the team, does that mean it wasn't successful?
</p><p>
Did the software release? Did customers pay for it? Is the organization still in business?
</p><p>
And if so, do you think the organization viewed the project as a success or a failure?</p>programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com0tag:blogger.com,1999:blog-33777038.post-63686498422537509342009-07-04T12:10:00.006+01:002010-01-05T21:43:55.020+00:00FireFox 3.5: How To Bring Back "Close Last Tab"<p>
First, in about:config, set <code>browser.tabs.closeWindowWithLastTab</code> to <code>false</code>.
</p><p>
Then, add the following to <code>userChrome.css</code> (via <a href="http://veerasundar.com/blog/2009/07/closing-the-last-tab-in-firefox-35/comment-page-1/#comment-1086">comment on Veera Sundar's blog</a>):</p>
<pre class="brush:css">
.tabbrowser-tabs[closebuttons="alltabs"]
> .tabbrowser-tab > .tab-close-button
{
display: -moz-box !important;
}
.tabbrowser-tabs:not([closebuttons="noclose"]):not([closebuttons="closeatend"])
> .tabbrowser-tab[selected="true"] > .tab-close-button
{
display: -moz-box !important;
}
</pre>programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com0tag:blogger.com,1999:blog-33777038.post-56894174817491454952009-06-16T23:02:00.007+01:002009-12-16T18:51:04.895+00:00IronRuby & rake-dotnet<p>
I'm back from attending <a href="http://skillsmatter.com/event/open-source-dot-net/in-the-brain-of-michael-delaney">a talk</a> on <a href="http://www.ironruby.net/">IronRuby</a> and <a href="http://github.com/petemounce/rake-dotnet/tree/master">rake-dotnet</a>.
</p><p>
I haven't had <span style="text-decoration: line-through;">much</span> any time to play with Ruby, so a lot of what I took away is pretty basic: </p><ul><li style="margin-bottom:1em;">You don't need to use parentheses when calling methods. That contributes to the magic you see when it's used for writing business-facing tests and DSLs.</li><li style="margin-bottom:1em;">IronRuby is much closer to 1.0 than I thought, <a href="http://en.oreilly.com/oscon2009/public/schedule/detail/7965">only about a month away</a>.</li><li>Theoretically, you can use it to do <a href="http://cukes.info">Cucumber</a> and <a href="http://rspec.info">RSpec</a>, though that wasn't quite working in this particular demo at the moment.</li></ul><p>Anyway, it was interesting. Thanks to <a href="http://gojko.net">Gojko Adzic</a> for organizing it, and Michael Delaney and <a href="http://blog.neverrunwithscissors.com">Peter Mounce</a> for presenting.</p>programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com0tag:blogger.com,1999:blog-33777038.post-11405158803443482262009-06-14T19:53:00.010+01:002009-12-16T18:51:57.081+00:00Happy Anniversary to Me<p>
Today marks 10 years since I got my first real job in technology, so I thought I'd share how I ended up where I did.
</p><p>
Once upon a time, I was a high school student and I wanted to grow up to have a well-respected, dependable, well-paying job. So, I started at university on the pre-med track.
</p><p>
I pretty much hated it. But I'm not a quitter, so I only admitted that I wanted a change once I was 3 years into my degree, when I'd completed all of my pre-med requirements.
</p><p>
So, I was ready to switch to something else. But I had no idea what. What was I good at? I wasn't really sure. Maybe I'd try writing.
</p><p>
As luck would have it, a nearby medical technology company was looking for a technical writing intern.
</p><p>
Being a technical writing intern meant helping write user manuals. I didn't like that much. Among other things, it wasn't much fun because you spent a long time laying things out in a desktop publishing program, not really quite exactly sure how they would look in the finished product. You had to wait for every single page of the manual to be done, send things to the print shop, wait a while, and only then finally get to see the real deal.
</p><p>
But the other thing going on at that medical technology company, back in 1997, was that they were starting to provide online access to those user manuals on their website. And that duty fell to the tech writers.
</p><p>
So my boss sat me down with a Laura Lemay book and told me to learn HTML.
</p><p>
And I was amazed. I'd seen all sorts of totally awesome stuff on the World Wide Web. I had no idea it was this incredibly easy to make that stuff.
</p><p>
And quick, too. You could write your HTML and put it up where the whole world could see it immediately—none of that waiting for your manuscript to get printed and distributed.
</p><p>
...
</p><p>
Well, it's getting late, and I realize I don't have time right now to bore everyone with my life's story over the 2 years between when I first discovered HTML and when I graduated from university and got my first job as a Production Assistant, a.k.a. HTML-writer.
</p><p>
Or about how I went from writing HTML to coding in ASP 2.0, to coding in VB6, to coding in .NET C#.
</p><p>
But one of the ironies I reflect on occasionally, is how one of my initial attractions to the web was instant publishing.
</p><p>
And how these days, the projects I work on often take months to go from idea to being live.
</p><p>
Just like those user manuals I wanted to escape back in 1997.</p>programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com1tag:blogger.com,1999:blog-33777038.post-65164591521284680112009-05-04T21:21:00.012+01:002009-12-16T18:52:38.128+00:00Notes from Gojko Adzic's "What is FitNesse and Should I Use It?"<p>
Last week, I went to <a href="http://gojko.net/2009/04/28/slides-from-what-is-fitnesse-and-should-i-use-it/">What is FitNesse and Should I Use It?</a> by <a href="http://gojko.net/">Gojko Adzic</a>.
</p><p>
I was struck by the difference between two of his slides:
</p><p>
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTIIwwz3PYQOMqaihNVMCVeWlTOBGa8ONbv1CQLF68Nocw-7Hyoft2_sV-sIyR1LgY8U5GCRkWv8fAfWgrDsk6NuyoqwvwKEFMFhZm3iPB1mhg_4UPw2G25vy9UiXNBre2Jjo-/s400/WhatIsFitness.jpg" style="border:1px solid black;" />
</p><p>
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3OQOS0OS4Yp5LPNeQPVOkJ1ZCHCUsLwQeaQ2sifXWf0fGQE-gIosxJN36t9ZcPwAoI0q0aXQmt4B-_DrxpiDaNkGPf1uf0mj4PL-arr5ac4oSFOpiiwskoDcT0cWyxeSJIDGk/s400/WhatIsFitness2.jpg" style="border:1px solid black;" />
</p><p>
And a slide from a different talk about FitNesse that I'd attended a week earlier:
</p><p>
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiu2jXxnS5nnyhbmK-LpOYc10-zuvwLRqAOlic5L-3yEp_K3tjlNa0zhBQS28H3-kns1t-ZtqSkCfgnLaipjVuTBjhq6jcxE1qMLar5y4gaAX9mgeQQ3gPP1FfPqkuPWwAQdH-6/s400/HowWeIncorporatedFitIntoOurProcess.jpg" style="border:1px solid black;" />
</p><p>
To be fair, Gojko said that it's very easy to hook lots of different kinds of testing into FitNesse, and he had been as guilty of it as anyone else.
</p><p>
Here are a couple other good things I picked up from Gojko's presentation that I hope to put to use: </p><ul><li>Focus on "what" and not "how". Don't try to translate test scripts into FitNesse—that's "how" and can lead to having a lot of similar or duplicated setup code. In fact, if you find yourself writing many similar tests, you're probably focusing too much on "how".<br /><br /></li><li>To keep your tests as living documentation, separate them into to main categories: tests for the current release and tests for previous releases organized by feature. At the end of each release, move the tests from that release into the other category.</li></ul>programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com1tag:blogger.com,1999:blog-33777038.post-41314488055988553012009-04-26T19:37:00.007+01:002009-12-16T18:53:45.235+00:00Writing Unit Tests Should Be Fun<p>
I picked up on "<a href="http://www.markhneedham.com/blog/2009/04/25/writing-unit-tests-can-be-fun/">writing unit tests can be fun</a>" vs "<a href="http://blog.brodzinski.com/2009/04/when-unit-testing-doesnt-work.html">writing unit tests is boring</a>" over at <a href="http://www.markhneedham.com/blog/">Mark Needham's blog</a>.
</p><p>
Besides excellent points that Mark makes about the <a href="http://www.peterprovost.org/blog/post/The-Pair-Programming-TDD-Game.aspx">pair-programming game</a> and that <a href="http://urilavi.blogspot.com/">Uri Lavi</a> makes about <a href="http://blog.typemock.com/2009/04/unit-testing-is-boring.html#c6428049279930495681">unit-testing code posing many of the same challenges as production code</a>, there's another reason unit testing should be fun: flow.
</p><p>
I think a lot of developers know what it's like to experience flow while coding and know that it's a good thing.
</p><p>
It turns out that two <a href="http://en.wikipedia.org/wiki/Flow_(psychology)#Components_of_flow">factors that help produce flow</a> are clear goals and direct and immediate feedback.
</p><p>
Writing tests first absolutely helps you clarify goals and receive quick feedback when you're coding.
</p><p>
Interestingly, flow activities can also require "activation energy" to get into them. (See Chapter 5 in <a href="http://www.amazon.co.uk/Finding-Flow-Psychology-Engagement-MasterMinds/dp/0465024114/">Finding Flow</a> by <a href="http://en.wikipedia.org/wiki/Mihaly_Csikszentmihalyi">Mihaly Csikszentmihalyi</a>.)
</p><p>
This is one reason why you might find yourself being a couch potato in your free time instead of working on your favorite hobby, even though you know if you got your butt off the couch and did that hobby, you'd actually enjoy yourself more.
</p><p>
Similarly, sometimes when I'm at work and I need to code something, I find it hard to pull together that activation energy needed to write both the tests and the code.
</p><p>
But I can say that when I do, it's almost always totally worth it.</p>programmergrrlhttp://www.blogger.com/profile/08045944515241515020noreply@blogger.com0