Ed Sumerfield and Chris Nelson of Gaslight Sof...

Ed Sumerfield and Chris Nelson of Gaslight Software presenting "Why Agile Fails" (Photo credit: RubyNuby)

The other day, Travis (@tdietz) and I were talking about how, in the Kansas City market, there are several software outsourcing/staffing companies that claim to be agile. However, upon examination, one finds that they’re about as agile as an iceberg and with similar long-term effects. At the same time, these companies are not being disingenuous; they honestly believe they are “agile,” it’s just that agile to them denotes things that their company does that they consider to be agile.

“We don’t document anything! We’re agile!”

“We don’t have middle managers! We’re agile!”

“We work overtime to get the project done before deadline! We’re agile!”

“We have a well-defined change management process! We’re agile!”

Businesses, of course, have no real way of knowing if the company they choose to work with is actually agile or not, unless they just happen to have someone on staff who knows what’s up. Companies that latch on to this buzzword inevitably deliver an experience roughly the same as every other software company – bad. The business finds another “agile” company, and the same thing happens.

Eventually, being “agile” ceases to mean anything. It appears to businesses to deliver no qualitative difference, because software companies are basically doing what they’ve always done (although maybe real real fast) and calling it agile. This problem is pervasive in the Kansas City market, and it makes it a hard sell for the select few companies actually doing agile development, because it’s very hard to convince a business owner that the reason Agile Company X failed was because they weren’t doing it right.  Oh, and neither were Agile Companies Y or Z. But we’ll do it right. Trust us. Seventh time’s a charm, etc.

Compounding the problem is the mantra that being agile is about principles, not practices. This is 100% true, but the problem is that people assume “agile principles” covers every vague notion they have about improving efficiency. You might do Waterfall, but you limit the Requirements Phase to two weeks, maximum, so now you’re agile, because agile is about principles, not practices, and you just… you know… went faster.  This is also where you refer to the Agile Manifesto, which you have not read, because if you had, you would realize that there are some fairly specific ideas what does and does not count as a principle of agile development, and you’re not evaluating your practices by those principles.

“Principles” becomes a blanket that you pull and stretch, trying to cover all sorts of practices. This article in Forbes demonstrates that you can call just about any company agile if you play with your semantics enough and have no real concept of what you’re evaluating against.

It has been suggested more than once at my company that perhaps the term “agile” has outlived its usefulness in distinguishing our company, and I have often argued that it is still useful. I don’t know, though; I think I might be ready to wave the white flag and just come up with some other term.

I’m thinking: Punctual.

 
Estimating mils using hand and fingers

Image via Wikipedia

Recently, in a discussion about estimation, a very well-intentioned and intelligent PM suggested that developers use the following formula in their estimates:

(Optimistic Estimate + 4(Realistic Estimate) + Pessimistic Estimate) / 6

He noted that doing this was better than “pulling numbers out the air.”

If you buy into the basic presuppositions that undergird an estimating process, then this formula has some things going for it.  For instance, by allowing a team to supply an Optimistic and Pessimistic estimate, they will be less inclined to use those as their actual estimate (which is an extremely common phenomenon). Also, the formula includes the outlying ranges, but gives the most weight to what the team really thinks is the actual estimate.

And so, if you insist on making your teams come up with estimates, this may be better than just everyone agreeing on a number.

But the question I have is: is this really different than “pulling numbers out of the air?”

You’re still basically asking your team to predict the future on the basis of their gut feeling, which is the fatal flaw in all traditional estimating procedures. There is nothing that says their ability to set Optimistic, Pessimistic, and Realistic numbers is any better than just coming up with one number. In fact, you actually get three chances to be wrong. The fact that one of your chances to be wrong is multiplied by four and all your chances to be wrong get divided by six doesn’t make your guesses any more accurate.

One might argue, in fact, that if your team is competent enough to differentiate between an Optimistic, Realistic, and Pessimistic estimate, why not just use the Realistic estimate?

The answer is, of course, that the formula above is a bright, flashing neon sign that says, “People are bad at accurately estimating how long something will take.” And it’s absolutely right. The entire reason someone came up with that formula undermines the value of the formula – it exists because people are bad at guessing future times, and its value depends on people’s ability to guess future times.

This is why, once again, relatively sizing features against each other and measuring the actual time it takes yields a much better result. Are developers better at predicting deadlines, or are they better at telling you the difference between the easy stuff and the hard stuff? If the answer is the latter (and I’m guessing it is for the non-clairvoyant developer population), then you are missing out on a lot of projecting and budgeting accuracy by hinging that process on estimation rather than actuals.

 
Oil latch on Cessna 152

Image by FrancoisRoche via Flickr

Imagine, for a moment, that you are explaining how to change the oil in your car to someone else.  If that’s a stretch for you, just substitute some other activity and change the analogy, accordingly.

After you finish your explanation, your oil-changing padawan says, “What do you do with the old oil after you’ve drained it?”

This is a very good question as it comes out of ignorance – the very issue questions were invented to address.  She obviously understands the basic idea of what you were saying, but is unclear on or missing some of the particulars.  Where should the old oil go?  What tools are the best to use?  Did you say every 3,000 or every 30,000 miles?  There is a lack of knowledge, and this person is going to fill it.

Now, imagine that same scenario, except the person asks, “What do you with the cat after you’ve drained the oil?”

You might blink a few times, then ask for clarification, yourself.

“What do you do with the cat?  I have a cat, and the cat might get oil on himself, so what do I do when that happens?  How can I best use the cat in the oil changing process?  What breed of cat is best to own if I’m going to be changing the oil a lot?”

These kinds of questions betray the fact that the person really has very little clue about what you just said.  At best, such questions reflect mismatched priorities.  What you do with a cat who gets oil on their fur is not particularly relevant or important to the oil-changing process (although I’m sure cats would disagree).  At worst, they reflect a fundamentally incorrect idea of what the whole enterprise of oil-changing is about.  You would probably start to wonder where you went wrong and how much ground you need to retread to straighten this whole cat thing out.

Now, imagine that this person yells across the yard to your neighbor, “Hey!  When you change your oil, what do you do about the cat?”

To your astonishment, your neighbor yells back, “Not sure I have a great answer, but let me tell you some things I’ve tried!”

You realize with growing horror that you are, in fact, in the minority on this one.  With a handful of exceptions, most people around you struggle with the whole issue of how cats relate to oil changing and the various cat-centric problems that arise as a result.  Books are written on the issue.  People ask about it on discussion forums.  Conferences are arranged around the issue of cats and oil changing.

Imagine your feelings at being in such a world.  Some part of you is just frustrated, wanting to scream at everyone, “What the hell is wrong with you people?  Cats have nothing to do with oil changing!  What are you guys doing out there?  What do you think oil changing is?”

But encompassing the creamy center of your anger is the much larger mass of the chocolate coating of mystification.  You are honestly staggered at how anyone could possibly have come up with this understanding of oil changing, and you are genuinely mystified that people as a whole don’t just go, “Hey, have you noticed that we keep asking about cats, but if you think about it, cats don’t really factor in to changing oil that much, if at all.”

This is how I feel 90% of the time when I read agile books, articles, or discussion boards.

 
Waterfall Model

Image via Wikipedia

In recent discussions with groups of agile coaches, mentors, Scrumbots, etc., I’ve noticed a sort of ad hoc dividing line between people who really know what they’re doing and people who are still struggling with it.  It’s not the only line, but it’s one of them, and that line (how many times can I use the word “line” in the opening paragraph?) is this:

Does this person confuse processes with principles and/or value processes over principles?

Businesses love processes because they are comforting.  You can document them, replicate them, measure them, and enforce them.  You don’t have to rely on people thinking very much, because there’s a process.  As much as people might try to deny it, the overwhelming majority of people actually like being told what to do.  It takes a lot of pressure off.  So, I do get the attraction and, for some of the reasons above, I’m not anti-process.

However, a process should always be built around certain principles or goals and critiqued by their effectiveness in maintaining those principles / achieving those goals.  It is never ok to stop asking the question: Is our current process still the best way to accomplish what we’re trying to accomplish?  Once you stop asking that question, the process then becomes an end unto itself.  It is now inherently good to follow the process.

Remember the story about the goose who laid the golden eggs?  The reason you valued the goose wasn’t because geese rock; it was because it laid golden eggs.  What you really valued were the golden eggs, and if the goose ever stopped laying golden eggs, you wouldn’t think anything more about that goose than any other.

This is similar to processes and principles.  What you really value are the principles.  Processes only have value if they effectively deliver on those principles.

This applies to many, many aspects of life, but in software development, it applies a lot to companies putting implicit faith in a process rather than critically examining if the process is actually accomplishing what they wanted in the first place.

A commitment to Waterfall obviously comes to mind, but far more insidious is a commitment to old school, textbook Scrum.

Companies want to be more agile.  Scrum is a process that purports to bring you agility, so companies trade blind dedication to one process for blind dedication to another – something Scrum tends to encourage, incidentally.  You even have a person (the Scrum Master) whose entire mission in life is to make sure everyone is following the process.

Companies don’t want to critically think about why they aren’t agile and what things they might need to correct to get them there – they want someone to tell them what to do.  “Do this stuff, and you will be agile.  You will deliver working software faster.  You will value people over processes, with the possible exception of this one.  You will be able to call your team agile.  All you have to do is follow this process to the letter, and magic will happen.”

Unfortunately, that’s not how it goes.  Enforcing Scrum to become agile is like trying to cure all sickness with penicillin.  You can’t just follow the process and assume faster, higher quality software will be the inevitable result.

I’m not anti-Scrum per se, but I am very much anti-making Scrum the new Waterfall.  Don’t stress about your process.  Don’t stress about the integrity of your process.  Think about your actual goals for your team and constantly correct your course to get there.  Change often.  Improve constantly.  There is no textbook procedure that will guarantee a cornucopia of agility just by virtue of being implemented.

 

If I had the time and the expertise, I’d love to make a 60s style health film about the Select N+1 problem.

This problem arises usually when you need to get related data from more than one database table.

Let’s say I have a Customers table with CustomerId as a primary key.  There is an Orders table that uses CustomerId as a foreign key, and there is an OrderLineItems table that uses OrderId as a foreign key.

On my website, let’s say I have a page where I want to show a customer a list of their orders and the details of those orders.  From a pure SQL standpoint, what I want to do (probably) is do one SQL SELECT statement where I join those three tables together using those IDs to do it.  Makes sense, right?

But imagine this.  Imagine I took my CustomerId, did a SELECT in the Orders table to get all the OrderIds tied to that Customer (that’s one SQL statement), then proceeded to execute a SELECT statement against the OrderLineItems table for each individual OrderId that I’d found.  In other words, instead of something like this:

SELECT * FROM Customers C, Orders O, OrderLineItems OL WHERE C.CustomerId = O.CustomerId AND O.OrderId = OL.OrderId

I did something like this:

SELECT OrderId FROM Customers C, Orders O WHERE C.CustomerId = O.CustomerId

SELECT * FROM OrderLineItems WHERE OrderId = 3

SELECT * FROM OrderLineItems WHERE OrderId = 7

SELECT * FROM OrderLineItems WHERE OrderId = 13

And so on.

That second solution is what we call a Select N+1: instead of doing one join, you’re doing a SELECT over and over to get your data out of each “join id” value individually.

Sometimes, people will do this in raw code or SQL operations, but the problem is far more common when you use ORMs that lazy load.  If my ORM lazy loads by default, then in code, when I do something like this:

foreach(var lineItem in myCustomer.Orders[0].LineItems)

My ORM is going to think, “Ok, I need this customer’s orders.  Ok, I’ll hit the database and load that.  Oh, wait, I also need all the line items.  Better go back and get those.”

For the example above, that’s not that bad because we’re just doing one order, but if we wanted to iterate through all the line items in every order (maybe we want to display if a customer has already ordered an item if they’re viewing it on our website), the odds are very good that your ORM will go back and get the line items by way of using Select N+1.

So, how do you make sure this doesn’t happen?

All the solutions to this problem revolve around eagerly fetching the data that you’re going to use rather than your ORM having to “go back and get it.”  Unfortunately, there’s not a one size fits all solution for every situation.  Even in the exact same application, it might be better to solve the Select N+1 one way in one spot, and take care of it a different way in a different spot.

One solution is to turn off lazy loading.  Most of the time, this is not ideal.  Not only does it typically mean worse performance across the board, it also means your ORM can’t do a lot of its automated magic, and you end up having to do a lot of synchronization in your context, etc.  Sometimes, though, it might be useful to disable this at a property level if you find you are always using the data from a property along with its aggregate root.

Another solution is to specify the things you need to eagerly fetch in your query.  This is usually how I deal with this problem.  In my query, I just tell it, “When you get a customer this time, go ahead and load their orders and line items, too.”  I mean, I don’t say that out loud, but I code that into the query.

Another solution may involve how your object model is laid out.  Maybe you have two entities joining together when, in reality, one is actually a component of the other.  Maybe you’re using a lot of joined entities to get something you could get from a simpler object that just represents the data that you need for that operation (typically, these are DTOs).  Maybe you’re querying an aggregate root when you don’t need anything from it and can query the “child” objects directly.

In any case, using an ORM does not free an application team from having to worry about the SQL.  Even if your mappings are great and your object model is awesome, you can still run into Select N+1 without even knowing it.  Check the SQL your ORM is generating and decide if it needs tweaking.

 
Birth of Jesus Matthew 2:1

Image via Wikipedia

I like Christmas. I wander around singing “Christmas Time is Here” in that high-pitched, indiscernible Peanuts voice, and people hate that. So, I go into my Sleigh Ride \ Girl I Wanna Shake Ya Down medley, which people find equally abhorrent. But it’s a really great combo; I don’t care what you say.

I am a Christian, but I have something of a different take on Christmas, which comes as a shock to absolutely no one. In our historical rush to appropriate pagan holidays, I think we took a wrong turn with making Christmas about the birth of Jesus. It’s not that I don’t think the birth of Jesus has a place in the spirit of the holiday – it just is something that I think needs to be seen against a larger context.

I have theologically interesting ancestors. British Isle pagans. Priscillians. Cathars. Although I do not adopt these belief systems for myself, I’m interested in them and how they affected my progenitors and what wisdom may be present in those old ways that perhaps we’ve forgotten in post-industrialized, Western expressions of worldview and spirituality.

This is the season of Yule – the onset of winter. Before the advent of things like central heating, insulation, and supermarkets, this was a somewhat grim time. This is when most of your friends and family died. This is when you had to dig in your heels and survival became paramount. You spent most of the year preparing for surviving this time. From a mythic perspective, this is when the great hero descends into the Underworld.

For most people, Christmas is sort of an orgy of trying to forget these kinds of things – a sort of modern “Masque of the Red Death.” We smother ourselves in food and material goods – the kinds of things we use to medicate ourselves against suffering.

But for our ancestors, death and suffering were something you had to accept at some level. Winter is always coming. You can’t stop it. You had to accept that these things were part of your reality. That didn’t mean you had to enjoy it, but you had to acknowledge that this was a part of your world and your life, and you were better off accepting and dealing with it than trying to forget it was there.

It wasn’t about being joyless and grim, however. It was just about accepting and enduring. It was also about hope. Spring would come. The daylight would rule, again. You lit candles in the night. You decked your house with greenery that did not die in the winter. You had bonfires. The community came together to remind each other that their survival depended on one another, and they made life worth living. Some of these things have carried over relatively unscathed into modern practice, although I’m not sure how much we think about them.

Which brings us back around to Christianity. Jesus did not turn aside from suffering or death, although this was his first and last temptation. Winter came for him, and he met it with acceptance and endurance, but not despair. He had hope (Heb. 12:2) that kept him going until Spring would come. Until the King emerged from the Underworld.

Jesus’ birth is certainly part of this hope, but Christmas to me is a time when I can grapple with the reality of suffering and death. That is actually more the “spirit of the season,” I think. But it isn’t about despair or being dour or grim – it’s about accepting the fact that winter comes for all of us, and it’s a part of our world no matter what you do. But there is a spring coming, too. There is a small candle flame in the darkness. There is greenery that winter does not kill. I can stare Death in the face and strike a match, knowing that I, like Jesus, will come out the other side.

 
Project Management

Image by acuative.com via Flickr

Although I know PMs who are exceptions to this, traditional project management has boiled down to two, main functions:

  1. Track and report if a project is on schedule / budget
  2. Get at the bottom of why a project is not on schedule / budget and get it back on track

An agile environment tends to resolve both of these issues without the need of a project manager. The schedule is determined by actual production metrics, budgets are done on an incremental time and materials basis, and teams tend to be self-managing in the sense that they identify their own issues and have the tools they need to continuously improve. All the information that is part of this process gets radiated out to the public in the form of Kanban boards, standup meetings, etc.

As a company becomes more lean and agile, project managers may tend to feel threatened, especially because, in my experience, upper management tends to notice fairly quickly that they no longer need a project manager to report progress and govern schedules. Becoming agile has, basically, made the traditional project manager obsolete. Some PMs even become hostile to adopting a leaner way of doing projects for this very reason.

While some might argue that agile teams do not need a project manager, I would argue that they do, but the project manager role needs to evolve and take one different responsibilities.

In my pretend world populated with unicorns, gumdrop houses, and agile project managers, I see PMs taking on the following functions:

  1. Facilitating communication between disparate teams / groups of people who are involved in the same project
  2. Coordinating resource needs cross-team and cross-project
  3. Removing obstacles that happen at a meta-project or meta-team level

In other words, they become actual managers as opposed to a Crystal Report with legs.

There is a real need in agile environments that are large for someone to… well… manage… projects. There is a need for someone who can deal with the issue that the developers on Project A need the DBAs to make a table change, but all the DBAs are fully resourced on Project B. There is a need for someone who can see that the next iteration of the website will be ready for deployment in the next couple of weeks, so the various teams involved in migrating a release will need to be notified. There is a need for someone to analyze the difficulties teams have working on the same project and across different projects and coming up with ways to improve.

To me, an agile environment makes a PM way more important than a traditional PM, and it gives them a very empowering and non-antagonistic way of relating to both the management above them and the project workers with whom they work.

 

At first, I was going to buy this high-quality product for friends and family by virtue of its effectiveness, but what really clinched the deal was the knowledgeable sales staff.

Pay special attention around the 1 minute mark.

 
Image representing Twitter as depicted in Crun...

Image via CrunchBase

According to ancient lore, the Twitter account Horse_eBooks was started by a Russian gentleman who programmed it as a bot to sell horse-related e-books. This account would, eventually, quote snippets from said e-books. These snippets would often be unintentionally hilarious due to their random nature and the fact that tweets can only be 140 characters long.

Horse_eBooks has since expanded its reach with subjects covering virtually anything on the Internet. I admit, this has made it less funny than the early days, but the account has still managed to garner 15,500 followers that enjoy it for a daily dose of surrealism. Roughly every 3 hours, something pops up in the tweet stream from Horse_eBooks that is, more often than not, pretty funny.

Here are some of the more recent ones I’ve enjoyed:

  • ALL POSSIBLE CLAMS
  • Fire At Chicken Plant Sorrow
  • We’ve done hundreds of hours of research to bring you the most delicious and mouth
  • accept spooky objects
  • Father drinks; mother respectable. Fairly educated; at school until 1 1. Met with accident and had to get leg
  • Or, how about this one. Have you ever called one of those so-called
  • I will show you a common household product
  • You’ve heard the sob stories of airline passengers who arrived at their destination
  • Believe me or not, if half of the secrets should not have gone to graves, we human beings would have acquired all the qualities of supper
  • Now, you too can kiss hair
  • Nut Sauce
  • Whatever your motivation for writing a cookbook, the bottom line is writing a cookbook
  • You’re About To Discover A Career Opportunity Where You Will NEVER Be Laid
  • I suffered constipation for over 20 years and was always going to the Chiropractor
  • Suddenly, bauxite was a very good idea
  • You’re About to Learn the Secrets to Throwing
  • You will even find real life examples of women
 
English: Example of a relational database tabl...

Image via Wikipedia

There’s a lot of popular misconceptions about how NHibernate Sessions work, especially things like the Save() and Update() methods, and what the ramifications are for Transactions.

Imagine the NHibernate Session like a container. When you load an object with NHibernate, it gets put into this container. Any change you make to that object anywhere, NHibernate knows about it. Those changes also happen in the container. They aren’t “disconnected.”

Let me say this a different way: If you use an NHibernate Session to Get() or Load() or whatever an object, NHibernate is now aware of that object and all of its changes until the Session is closed.

So, you might end up with two or three different objects or collections of objects in this container.

Most people use an NHibernate Transaction for everything, which is a good practice, considering that NHibernate uses an implicit Transaction for everything whether you specify one or not.

Here’s the kicker.

When your Transaction commits, NHibernate will take your objects in the container and synch up the database with the state of those objects, whether you have explicitly told it to save those objects or not.

This can seriously bite you in the butt if you’re not aware of it.

Trying to save some overhead by not loading an object’s child collections? It goes into the Session without collections, so when the Transaction commits, guess what? NHibernate will delete the child records when the Transaction commits, whether you have explicitly told it to or not.

Did you change some data in your object for display purposes? NHibernate will save that change back to the database when the transaction commits.

Now, the overwhelming majority of the time, NHibernate tracking our changes automatically is very nice and saves us from having to atomically manage every add, update, and delete on every single object. However, it is important to note that these changes will be committed to the database whether or not you have explicitly told NHibernate to do so.

Thankfully, for those times you’d like to manipulate an object and not have those changes synched with the database, NHibernate offers a very simple way to detach an object from the Session.

Session.Evict(yourObjectHere);

And then you can do whatever you want, but keep in mind NHibernate is now effectively “blind” to this object.

If for some reason you need to attach a disconnected object to the Session, you can do that by:

  • Session.Update(yourObjectHere); attaches a changed object
  • Session.Lock(yourObjectHere); attaches an unchanged object
  • Session.Merge(yourObjectHere); if the object exists in the Session, this will merge the changes from the detached object into the one in Session – otherwise, it behaves as Lock().

It’s important to note that this is not the case if the objects are sent over the wire somewhere else, such as via a web service. NHibernate has no way to know what you’re doing to those objects outside that system boundary, so for all practical purposes, your web service acts like a blanket Evict() statement for the client.

© 2011 The Cutting Ledge Suffusion theme by Sayontan Sinha