Agile

The Case for Requirements

RequirementsI was recently reading through some of my backlog of Dr. Dobb’s Journals (a PDF I receive monthly) and came across an article entitled The Requirements Payoff by Karl Wiegers. I’ve archived a copy of the PDF here and it can be found on pages 5-6.

A lot of people seem to equate “requirements gathering” with “big design up front”, which is now often vilified as being antiquated and bloated. Nothing could be further from the truth (about requirements, not BDUF). In the book Agile Principles, Patterns, and Practices in C#, Uncle Bob talks about practicing Agile in a .Net world. In every one of his examples, you have to know what your requirements are ahead of time. The process goes as follows:

  1. Gather requirements
  2. Estimate requirements to determine length of project
  3. Work requirements in iterations
  4. Gauge velocity in coding requirements against estimate
  5. Determine whether your velocity requires you to either cut requirements or extend timelines
  6. Lather, rinse, repeat

You see that the agile process doesn’t work without requirements. In the article, Wiegers says that according to a 1997 study, “Thirty percent or more of the total effort spent on most projects goes into rework, and requirement errors can consume 70% to 85% of all project rework costs”. That is a big penalty to pay for laziness or ineptitude in early requirements gathering. This doesn’t mean that the requirements collected at the beginning are rigid and inflexible. They are just a starting point. However, changing the requirements changes the estimate and also the expected cost in time and resources and can fall under the statistic quoted above.

Requirements are essential to TDD and BDD advocates, as well. The requirements are what a vast majority of the tests are written against. For instance, if the requirement is that the user name is an email address then a programmer will likely write a test (both positive and negative) verifying that the program behaves as expected when presented with an email address or a non-email address, etc. Without that requirement, a test might only be written to ensure the user name wasn’t blank and the stake-holders might be upset when the program behaves differently than they imagined in their heads (and you failed to ferret out in requirements gathering).

It is true that gathering proper requirements in advance costs time. Wiegers sums it up best, however, when he says, “These practices aren’t free, but they’re cheaper than waiting until the end of a project or iteration, and then fixing all the problems. The case for solid requirements practices is an economic one. With requirements, it’s not ‘You can pay me now, or you can pay me later.’ Instead, it’s ‘You can pay me now, or you can pay me a whole lot more later.'”

Code Tips

The Importance of jQuery ajaxSetup Cache

Johnny Cache
Just a quick note to document a “gotcha” that cost me quite a bit of time today. I am currently working on my company’s second Asp.Net MVC 2.0 application. Our first one was a huge success and (to me) MVC is way more fun and productive than WebForms, so doing as much new development using MVC instead of WebForms is a no-brainer.

Being good MVC-ites, we are doing a lot of AJAX calls. Since we are extensively using the jQuery library, we do a lot of $.ajax() and $(someSelector).load() in our code to make calls. Today, I was calling code like the following:

$('#theDivToUpdate').load('/Our/Url/Product/Edit/', {id : ourIdParameter}, function() { /* callback logic */ });

That code will call the Edit action on the ProductController and pass in the id of the product to edit. The controller gets the product details and then returns a partial to the page, which is then inserted into the div. I was trying to debug the controller action, but after I had edited a product once, the breakpoint wouldn’t catch anymore. I figured that I was dealing with a caching issue and the method wasn’t even being called, but I couldn’t find where I even had output caching configured in MVC.

I knew that I wasn’t having this problem in our previous application, so I started comparing files and looking for answers. Nothing was really giving me any clues, and everything appeared to be set up the same way. Finally, in exasperation, I did a “Find in Files” in Visual Studio in the other solution for just the word “cache” since searching for “outputcache” had failed me.

I dug through tons of results and then finally came across this little gem:

$.ajaxSetup({ cache: false });

I had seen that in the last application, had read the documentation on ajaxSetup, but I didn’t really understand all of the ramifications of it.

Apparently, jQuery in all of its awesomeness will actually cache ajax calls for you to speed up your page. That’s definitely awesome, but unexpected caching can certainly screw up your day.

Book Reviews

Contented Cows

Contented Cows Give Better Milk
I got the paperback version of Contented Cows Give Better Milk 8 or 9 years ago when I was working for a large financial institution. It was popular at the time to buy these by the crate and give them to anyone who was responsible for people. So, I did like any responsible employee… and finally got around to reading it this week. Better late than never, right? I want to warn you that this post is going to run a little long because I’m going to include several quotes from the book after I share some general thoughts and before I conclude.

I’m not much of a “business book” guy. In my experience, too often these books are “educationally low fat” and more about stuff that just about everyone already knows. Even this book draws some conclusions that I had already reached, however I know that I’ve worked for many employers that still don’t “get it”. In my opinion, this books deserves the reputation it gained and I think if more employers followed its guidelines, the average worker would be considerably better off. It covers topics like employee hiring and retention, productivity, corporate reputation, and enabling employees to do something great. Let me let the authors speak for themselves. (My thoughts or interjections are in bold italic)

On Hiring

“Contrary to popular belief, there really is an ample supply of conscientious, hardworking, capable, honest people.”  “You can (and must) find others like them.  You’ve got to expend a little effort doing it because ‘eagles don’t flock,’ but they are out there.” – p.37
(I love this quote, especially the notion that “eagles don’t flock”)

On Training

“We have an earnings problem, so we’re going to work out way out of it by ‘dumbing down’ the organization with less skilled, less competent people! Now the only problem will be to find dumb customers to purchase our goods and services and even dumber investors to buy our stock!” – p.154

In talking about an organization’s fading training program for air traffic controllers…
“At some point this practice was amended in favor of a train-to-proficiency approach, and the end result is now that nobody ever gets sent home or, as our friend Alex Nicholas calls it, de-selected.  Instead, you wind up with a situation where people who would have washed out under the old system are still in training and on the job years later, and every day must have their work carefully overseen by an experienced controller.  A competent employee ends up babysitting an inept one, making them both, at best, marginally productive; and both are making the same money!” – pp. 160-161
How many of you have l i v e d this?

“Why is it that no one ever ‘flunks’ a corporate training program?” – p.165

On Corporate Policies

“If you believe that most people who come to work for you are lazy, stupid, untrustworthy, inept, and just downright contrary, that assumption can’t help but show up in the way you run your business.  You’ll have all kinds of rules and regulations designed for numbskulls who couldn’t pour milk out of a boot with the directions printed on the heel.  You’ll no doubt have a supervisor for every six or seven folks, and will inevitably attract just the kind of people who will live down to your assumptions.” – p.35

Talking about how companies make mistakes and how policies can ruin a company:
“We do it through policies that are just plain dumb; systems that treat intelligent people like they’re complete morons; and cultures which ensue that no mistake goes unpunished.” – p.168

“In their private lives outside of work, your employees are heads of families, civic leaders, army reserve officers, mortgage holders, and a host of other things. Day in and day out they somehow manage to feed themselves and their families, pay their bills on time, stay out of jail, and behave normally by most reasonable standards.  In short, they tend to be rather competent individuals with a clear picture of the difference between right and wrong.  Why then, when at work, must they face a continual barrage of not-so-subtle signs of our mistrust in them as individuals?” – p.183

“If you’re unwilling to give credence to the employer/employee covenant by taking this important step, then by all means save your time, money, and breath.  Go out and hire dummies whenever your company has a job vacancy, pay them as little as possible, and don’t even think about training them–just hire a supervisor to stand guard over every two to three people.” – p.192
Wow… I know some places where this is basically the policy!

“There was no correlation between the reviews and terminations.”  Only three out of 986 people let go for poor performance received poor ratings on their prior review. “Incredibly, roughly two-thirds of these same people had also received merit increases in the six months preceding their termination!” – p.101

On Reputation

“Organizations which don’t measure up tend to be viewed as an employer of last resort; nobody with any brains, ability, or motivation wants to work there!  When this occurs, only two things can happen.  Either the organization is forced to pay market-premium wages and salaries in an attempt to secure better applicants, or it must accept the lower quality applicants, or do both” – p. 25

“We submit that inordinately high wages, salaries, and unwarranted benefits not only aren’t the answer, they are often a large part of the problem.  Moreover, they are often used as a counter-balance or way of compensating for serious deficiencies elsewhere in the organization.” – p.93

My Conclusion

Certainly not every developer is going to have an opportunity during their career to define many of these policies at their organization. However, with that said, we should not also have our heads in the sand when it comes to business. We should also remember that a strong majority of us are not paid to make software for software’s sake. We are paid to solve a business problem. These principles can help us find good solid companies to work for as well as making sure that we do our part to make the company great while we are there via the software that we write.

Mentoring

Why Be Passionate?

Malcolm Gladwell - Image from http://en.wikipedia.org/wiki/File:Malcolmgladwell.jpg
“Absent love for your field, you can’t be a genius. You can’t.”– Malcolm Gladwell

Scott Hanselman posted this quote on the Internet last week and it really resonated with me. It is no secret that I work in an industry full of “geniuses” and we were all most likely the smartest kids in our schools and among our relatives. Some of us (full disclosure: I can definitely be guilty here) still like to occasionally hold a somewhat lofty view of ourselves among the ranks of “the geniuses”.

Mr. Gladwell has written some very good books about ideas, intuition, and observation. I generally enjoy his writing and here I believe he is right on. I keep coming into contact more and more with developers who are not passionate about what they do. By not being passionate, they are doing their employers and themselves a disservice by not maxing out their genius potential. There are several reasons for this lack of passion – I’d like to focus on two.

The first group to consider may have at one time been passionate developers, but have since burned out. I know for a fact that this is fairly common and have come close to burnout a few times myself. Preventing burnout is a broad topic for perhaps another post, but it is beyond our scope here. I don’t think that I’m breaking new ground to suppose that burnt-out developers aren’t blazing the genius trail.

Our second group is made up of those developers who only do this because they were pressed into service at their jobs or they entered this profession because it pays well. If these people suddenly became wealthy, coding is not how they would spend their time. What that means is they are likely also not spending their free time on this craft.

I’m not claiming that individuals in either group are bad people. They are not. At the same time, however, I believe that individuals who don’t love their field will never attain guru/ninja/genius status. You cannot just put in your 8 hours and expect to be on that “next level”. This goes for lawyers, physicists, and therapists, too. If you aren’t putting in your own time reading journals, blogs, attending seminars, or just “thinking the big thoughts”, you aren’t going to grow.

The bright side is that this love can be cultivated. Much like marital love, you can rekindle your love for your craft. The same principles even apply. A common recommendation in marriage counseling is that you really get to know your spouse. Find out things about who they are and who they’ve become that you didn’t know. Fall in love all over again.

In development, that means finding out different things about programming that you didn’t know before. For instance, if you’ve only ever done middle tier work, learn the UI. If you’ve only programmed application code, learn the database. If you’ve only ever worked the Microsoft stack, give Open Source technologies a try. Make the field new, exciting, and alive again.

Even if you are someone for whom life or finances has guided toward technology, you also have hope. Much like individuals in arranged marriages can “learn to love” or “grow to love” their spouses, you can learn to love your profession. Like the last group, branch out and find a niche you are passionate about. Computer science is a very broad profession. You may find you love writing compilers, embedded systems, device drivers, mobile applications, web, rich media, etc. However, if you only ever log your hours and go home, you’ll never know what is beyond your 9 to 5.

I don’t want to sound preachy, but I truly felt compelled to write when I read that quote. Remember the old adage that when you point one finger, you have the rest of them pointing back at you. I write as much for my current and future self as I do for my readership. While I am “on fire” and “in love” with programming now, the natural ebb and flow of life may take that away from me. When it does, my natural desire to compete and be great are going to remind me of this post and I will have to heed my own advice and find something new that excites me.

I hope you have something that excites you, too.

Business of Software

Promise and Deliver

Under Promise and Over Deliver from NetworkPerformanceDaily.com
“They” say that you should under-promise and over-deliver. That seems to make good sense, doesn’t it? Why argue with conventional wisdom here? You set the client’s expectations really low and then you “WOW” them. How does that *NOT* make you look like a superhero?

The problem actually sets itself up several ways. First of all, it is extremely hard for your clients to manage their projects that way. If you set a time line of 3 weeks to finish 3 features and the client needs 10 features done in total, budgets are set to that effect and plans are made (including testing plans, marketing, etc) with the expectation that this project will take 10 weeks to finish development at this pace.

However, since you are an “over-deliverer”, you actually get 6 features done in those 3 weeks and the last 4 features done in another week and a half. So now we are less than halfway to the deadline and all the features are done and you even throw in “extra” features that had been cut due to your original estimates. What we are left with is a client with a finished product that they aren’t properly ready to market (remember those extra features?) and a TON of lag until launch day.

Let’s pretend that our situation isn’t even that dire. We can imagine that we had a simple project to do and we decide that we can do it in 3 days, but we pad our estimate to a full week since we love to under-promise. The truth is that we could really do it in 2 days and we do just that. We spend day number three testing the heck out of the thing and hand it over to the client. Their initial reaction might be that they are really surprised and happy.

That happiness might not be too long for this world, though. Your client might notice a pattern when working with you and decides to start pressing you for shorter estimates under the guise of urgency, but really it is because he doesn’t trust you any longer. You are either a terrible estimator, you cut a lot of corners, or you are a liar. Now when you really do need more time for something that is more complex than anticipated, the client fears that you are sandbagging and might make you commit to a deadline that you can’t make, further eroding that trust.

You can just avoid all of that hassle. Become familiar with your own throughput and velocity. Learn what you can and can’t do. Give up being a “superhero” (I know that one is hard, it is my Achilles heel). Learn the skill of Software Estimation and give good estimates and then… Back. Them. Up!

Occasionally, you will over-deliver and that is okay. Those are examples of when you have truly gone above and beyond. However, remember that you are far more valuable to your clients as someone who promises and delivers with such regularity that it is almost boring. You will be a superhero in comparison to others who are not as dedicated to the craft.