October 4, 2010

Agile development's special place

What’s so special?
For a software development approach to justify having its own name, it needs to differentiate itself somehow. For agile development this special property is the fast delivery of business value: the goal of an agile software development approach is to deliver a subset of software features into production business operation, followed by another subset, and so on, in shorter timeframes than other approaches could achieve. In a nutshell: closely-spaced incremental production releases. 

The higher level business objective, of the sponsor of the development, is to either:
  • Gain business capability urgently, either to avoid missing short-lived opportunities in the market or to solve problems that have severe business impact or very tight timeframes (maybe externally imposed), or
  • Deal with the uncertainty of new ways of operating the business, via the tactic of learning what IT features and business procedures are really required, by operating a software release in a live business setting.
A project that doesn’t deliver increments of software into production, but is iterative and uses techniques such as unit testing or continuous integration, is not particularly novel and hardly warrants a special name. These techniques have been around for years and have succeeded in spite of the hype of methodologies. Without agile development’s key value proposition of fast business value, the techniques may be beneficial, or they may be more trouble than they are worth. It depends on the context. There’s certainly no justification for conflating a specific technique and the achievement of business agility. Quickly delivering working software that fits into the business depends on a whole lot more than one technique or even several techniques.

But let’s look into the implications of delivering business value quickly, for which good reasons have been given in the two cases above.

Hello real world

In the first of these cases an agile development project takes advantage of the things the business learned while it operated with the partial solution provided by the first few releases. In developing subsequent releases of the system, the development project is influenced by real world feedback such as re-prioritisation and refinement of user requirements. This influence occurs earlier than it would in a non-incremental approach, and this is beneficial because more of the project is conducted with the improved understanding of requirements.

If the development is fast enough to justify being called something special, rather than just the usual good practice iterative development, then the speed is likely to be at the expense of full functionality and some of the qualities the system needs. Subsequent iterations will rework some of the software already developed, to add functionality and bring the quality up from bare minimum to a level that will sustain business operation. This rework occurs in all projects to some extent, but is kept to a minimum. This is because rework can easily degrade the integrity of the code, and it slows the convergence of design fragments into a coherent whole that reduces technical risk and enables productive development. Embracing necessary change is something that professional developers take in their stride; causing unnecessary change by skimping on analysis or imposing inappropriate techniques is simply reckless.

In the second case the dependency on business feedback is much greater – the business vitally depends on the development team incorporating the feedback to identify the features that are really required and the priority order that they are required in. Incorporating this feedback may involve reworking a substantial amount of software that has already been developed. Agile approaches justify this rework on the basis that the uncertainty of how to operate the business can only be resolved by gaining an understanding through using the features of new software. Apparently even highly competent and efficient business analysis wouldn’t enable the business people to envisage a future mode of operating.

Repeat what?

In each of the cases above, the extent of iteration is different. Iterate means repeat, but rarely are people clear about why they are repeating and what they are repeating. In fact, you perform a repeat examination of different parts of the problem space and the solution space:
  • In the first case you repeat the activities of analysing business needs, deciding on a suitable set of behaviour (user “requirements”) for the system, designing and developing software. You repeat these for a different subset of business needs and the result is mainly additional software.
  • In the second case, the expectation is that much of the behaviour already developed for the system will have to be revisited because the purpose of the software release was to confirm new ways of working, and change whatever doesn’t work.
    Rethinking the system’s behaviour can lead to a large amount of development rework.  Some people advocate that rework is not such a great penalty because a smart development team has techniques and tools to specifically deal with rework to minimise its effects.  More about that later!
Your risks or mine?
As with any approach, the agile approach is only valid in situations where the benefit outweighs the liabilities, i.e. where the type and size of the risks of an agile approach are more appropriate than the type and size of the risks of a different approach. Agile approaches are weighted towards addressing the risk that an IT system will not meet the business needs that exist at the time the system goes into production. The premise is that other approaches that are not fast enough and sufficiently engaged with the business will not produce production software soon enough, and the software that is produced will ‘miss the boat’. The software is designed to meet the business needs that existed way back when the project was initiated, but have since changed.  

It is quite common for the perceived business needs to change substantially over a period of time, because the needs are quite unclear at the beginning or they are likely to change significantly due to the length of time that the business is exposed to a volatile business environment and rapid evolution in the business’s people, processes, information domain or technology. Other approaches attempt to address this risk in other ways, not always successfully. All the approaches address a mixture of risks that exist to a greater or lesser extent in all business contexts. In a given context, some approaches are a better fit than others.

Because an agile approach brings its own risks of failing to produce an adequate solution, due to excessive rework for example, or applying unsuitable tactics and techniques, an agile approach is justifiable only where the need to meet the business objectives is so great that the risk is worth taking. In other words the alternative approaches (or doing nothing) are actually more risky, or are even fatal for the business.
 
Do the means support the end?
The tactics and techniques used to produce the solution must serve the goal of producing a series of production software releases that meet the business and IT development objectives over the whole life of the series and beyond. The choice of iteration length, the timing and depth of analysis and design work, the scope of each role on the project, the form of collaboration, the extent of developer testing and the amount of development rework must ensure that the project achieves the outcome of business-workable production software releases. Any tactics or techniques that do not contribute positively to the outcomes do not have a place in the development project, no matter what the methodologists say. For example:
  • Making user stories tiny, just so they can meet the arbitrary project management constraint of two-week iterations, is not a justifiable tactic if it produces only non-production releases and it prevents the team from seeing enough of the big picture to create building blocks that require little rework.
  • Just-in-time requirements investigation is not a justifiable tactic if it provides such a narrow view that it prevents the team from producing software that fits properly into the business at every production release.
Favourable outcomes will only be achieved if the various tactics complement each other in the context of the particular project. To follow methodology-prescribed practices out of context is counter-productive and harmful, to put it mildly.

Only valuable if usable
What does it mean for software to “fit properly into the business at every production release“? If there is an old system to be replaced or supplemented, then any production release of a new IT system will only be acceptable if the business capability-enablers (people, process, information and IT systems) in the new configuration ‘work’. This means the business can either stop using the old system and start using the new system, or use both old and new systems, and the people have the required knowledge, skills and information to interact with the systems, the systems produce information that is accurate and sufficient, and the business procedure work-arounds and swivel-chair integration are sustainable. 

As Jeff Patton said  
"What you have is fine, but there’s not enough here for me to get my job done. I still have to do much of my work manually. I have to transfer information from my paperwork to the software and back again. Sometimes I can’t even figure out a paper workaround. I’ll wait for the next release to see if you get farther along"
Most businesses will endeavour to tolerate messy operating procedures for a short period of time, but if the new system is so functionally incomplete or lacking in quality characteristics such as data integrity and reliability that it is unsafe or grossly inefficient to use in business operations, then the approach that produced it is invalid and harmful.

So an agile development approach, defined as one which puts a subset of final features into production, is only valid if the business can successfully operate with a subset of the features, i.e. without having all the features that are scoped for the IT solution. 

Agile’s home turf: greenfield business
The ‘it must work’ criterion is likely to be present immediately in many greenfield business areas, because there is little or no business practice to fit into and no IT system usage to disrupt. There is little to lose. However in existing business areas, fitting new business practices and IT system features into the business operations will be much more difficult to achieve.

Success by design

The fit between IT system features, information flows, system interfaces and business procedures will not just 'evolve'. To paraphrase Charles Darwin, evolution is OK if you have a few aeons and don’t mind a lot of casualties, weeded out by failure. But that’s hardly fast delivery of business value. The level of casualties amongst the business sponsors and developers won’t be sustainable either. Developing incremental business solutions involves business design and software design, lots of it.

You might not write up all the software design decisions, but they’re still design and some of them are architectural design. Although any developer can reorganise some code with a few clicks, rework of any significance requires refactoring across a significant portion of the code, according to some design goals, which of course requires a design. Refactoring safely doesn’t just depend on having the safety net of verification techniques such as unit tests and integration tests, it depends on having a design that you can reason about making sensible changes to.

Designing the business changes so that business operations benefit rather than suffer from the increments of software features will require some highly competent business analysis, to ensure that every production software release ‘fits’ into the people, process, information and IT system landscape.

If you have this level of competence with business analysis and software development and have good commitment from business people, then you’re cleared for take-off. With these capabilities and commitment you can use the iterative development approaches that have seen a lot of success over the years. You could even use the agile flavour of iterative development if that provides a better match to the project risk profile. If you don’t have these skills and the business commitment to engage at a detailed level, then neither approach will succeed. No amount of project management, process, tools or favourite techniques can support business agility unless there is a strong cause-and-effect relationship between business commitment, business design, software design, complementary  techniques, team experience, team behaviour and software releases that fit the business.

Prepare the business to receive the software in increments.  Do the discovery and analysis at the earliest opportunity at which a solid understanding can be achieved. Design the software so that it can be released into the prepared business in increments without much rework.  Choose a development process that copes with some late discovery, employs techniques that are beneficial, and delivers the production releases.  Project management practices and parameters such as iteration length and user story size come last in this chain of logic - they are there to serve not to rule.

May 5, 2010

Business information state transitions – complementary to process flows

At the intersection of business analysis and IT solution design, business information state and process flows are two sides of the same coin.

Many business processes are ways of managing the life cycle of items of business information. For example a Fulfil Sales Order process could be the way of managing a Sales Order from creation through various steps to its fulfilment.

You may even consider that the business information entities, their allowed states and the business events that can cause transitions to other states, are more fundamental and stable than business processes, which are relatively arbitrary business-level solutions designed to enact the information life cycles.

There is really nothing new in here, just modern notation and ‘service’ talk. Who else remembers Event Partitioning or Entity Life Cycle Analysis?

If life cycles sound like a useful approach, a business state machine is a complementary technique for modelling the state- and event-based business behaviour. A business state machine can define the reaction that should occur (in the business or in a process automation orchestration) for each state a Sales Order (for example) can be in when each type of business event occurs.

For business analysis of the state- and event-based rules that constrain the sequence of activities, a business state machine can optionally complement a BPMN process diagram. It can be used to verify the integrity of the process diagram with regard to business entity life cycle rules:
  • conformance – the process does not break the life cycle rules by performing illegal state transitions.
  • coverage – the process covers all the states and transitions.
For design of orchestrations in a business process engine, a business state machine is an alternative to a BPMN process diagram (or tool-specific diagram).

For example, IBM recommends (with caveats) that business state machines are useful for modelling processes that involve in-flight modifications or cancellations (e.g. to Sales Orders - modifications or cancellations are events that can occur at any point in the order’s lifecycle), and timeouts. Modelling these event-at-any-point situations with process flow diagrams would result in a mesh of sequence flows that would be easy to get wrong.

[Business State Machine is an IBM term, from WebSphere Process Server].

Whether they are defined through business analysis or not, business events, states and transitions are particularly important to architects designing services in a business-focussed SOA, because:
  • A service contract includes a set of messages exchanged to communicate the business events; the meaning and form of the messages must be agreed between service consumer and provider.
  • The exchange of messages must occur in certain patterns, i.e. a business protocol (a ‘choreography’ in BPMN).
  • The production and consumption of messages by any participant’s activities is governed by the participant’s state- and event-based rules, organised into an orchestration.
  • Orchestrations explicitly manage state information.
"It is the resource lifecycle events that are important when trying to identify the services that your business process will depend on. The business events advance the business data through a state machine until the end of the business process. ... it is the business events and their message and data (documents) that are the key artefacts in your modeling efforts when creating a service-oriented architecture."
"Semantically, a Web Service is just a ... state transition request on a target resource.... semantic equivalence can always be found between Web Services operations, an event, an action and a state transition of a resource, provided that the resource is clearly identified."

Various Business Process Management tools can use the state machine paradigm:
  • IBM WebSphere Process Server: business state machine
  • MetaStorm Designer: stages & actions
  • Vitria BusinessWare: state model
Microsoft .NET Workflow Foundation (WF) also provides a state machine view.

Example – Sales Order
Diagram 1: Sales Order entity - Allowed states and transitions
UML State Machine Diagram
(click diagram to view)
The diagram above shows the fundamental life cycle of a Sales Order, regardless of any business process that might be put in place to achieve it.

The next diagram shows a possible choice of business behaviour that conforms to these life cycle rules and covers the full life cycle. The business behaviour is in the form of actions performed on transitions between states or activities performed when entering or exiting a state.

It has been annotated as follows, to identify equivalent elements appearing in this diagram and the next one:

M: message flow in BPMN (incoming ones) = event in state machine
S: state in state machine = implicit in some start/end events in BPMN, or no explicit model element
T: transition in state machine = implicit transition in BPMN (no explicit model element)
A: action or activity in state machine = task in BPMN

Diagram 2: Sales Order entity - With actions and activities
(click diagram to view)

This sequence of actions and activites is shown in the familiar process flow view in the following diagram. Note the equivalence to Diagram 2.

Diagram 3: A Task Flow that would achieve the Life Cycle
BPMN Process Diagram

(click diagram to view)

March 25, 2010

March 17, 2010

Applied SOA (book)

Authors: Michael Rosen, Boris Lublinsky, Kevin Smith & Marc Balcer, Pub: Wiley 2008

Enterprise Integration Patterns (book)

Authors: Gregor Hohpe and Bobby Woolf, Pub: Addison Wesley 2004
Designing, building and deploying messaging solutions

Distributed Applications Engineering (book)

Authors: Wijegunaratne and Fernandez, Pub: Springer 1998
Building new applications and managing legacy applications with distributed technologies

Release It! (book)

Author: Michael Nygard, Pub: Pragmatic Bookshelf, 2007.
Subtitle:  Design and Deploy Production-Ready Software.
Publisher's site

As you'd expect from The Pragmatic Programmers, Michael Nygard provides a very readable and highly relevant account of the common failings in system stability and performance, and how to avoid them by good design.  Specifically he covers the design of server software (particularly web applications) and its deployment connectivity, load balancing and clustering.

The technologies in the war stories and guidelines include TCP, HTTP, web servers, AJAX, DNS, the JEE ecosystem and relational databases,but the principles explained are equally applicable to other technologies.

Highly recommended reading for:
  • developers and software architects - to design decoupled software to minimise blocked threads and chains of tightly-coupled synchronous callers, achieve scalable object sharing and caching, and keep within a sustainable memory budget.
  • system and solution architects - to design the system deployment to provide runtime qualities such as stability, performance, scalability, high availability, and operability through transparency (for system monitoring and diagnosis). 
  • performance engineers - to understand capacity issues and the potential causes of system stability, performance and scalability problems.