Thursday, July 5, 2012

Lean Software Factory

This post is a follow-up to an invited talk that I delivered at CESAMES. That presentation, which is available on the widget on the left, talked about complexity, architecture and lean software development. It started from the question – its title – “How to design information systems?” and ended with an introduction to lean software development. Today I’ll go further and explore the relationship between the (software) product and the (software) factory. The key idea is derived from the Toyota Way: you need a great factory to manufacture a great product. Not surprisingly this will lead to the concept of “Lean Software Factory”. This post is organized as follows. The first section talks about what makes a good software product. I will focus mostly here on software development, but most of what will follow is equally relevant to information systems. The second section deals with the concept of “software factory”. Looking at the “software factory” means taking into account the software manufacturing process into account, and not only the final product. It is also a metaphor that carries the need for automation, engineering methods and industrial discipline. The last section is about “lean software factories”, which add agile development practices and wisdom to the strengths of software factories, together with a continuous improvement and culture geared towards excellence that is inherited from lean management.

1. What makes a good SW product?

There are many expected qualities and assessing a piece of software is a multi-dimensional tasks. Here I will only focus on three of them, because they are both very popular (all books and papers related to software engineering discuss those three) and very important to the value that is produced through a software product:

  • Modularity – “the degree to which a system’s components may be separated and recombined” (Wikipedia) … or the capacity of the architecture to maximize in its decomposition the independence of subcomponents. Modular systems are easier to maintain and to evolve. In the world of software, modularity translates into the minimization of “impacts” when something must be changed.
  • Versability / evolvability – “the property of having many abilities”, that is software that can serve many purposes, together with “the capacity of adaptative evolution” - software may evolve rapidly to support new functions. This combination is often coined as “agility” in the software world.
  •  Openness : for a piece of software, being open may mean many things. It may means that it exposes API (application programming interfaces) so that other software components may interact with it. It may also mean that the code is open to all for scrutiny and collaborative improvement, as in “open source”. It may mean that the piece of software is built as a platform, which is designed to be enriched by subcomponents written and proposed by other developers. Writing software as a platform is at the heart of successful development strategies, such as Google’s or Facebook’s.

These three qualities form a deeply interrelated network (each influences the other). They are also notoriously difficult to achieve, especially in a rapidly changing environment. These qualities are resulting properties of both:

  • Software architecture, that is, design properties which explain how the software product is organized. This part is well understood, albeit difficult: this the art of software architecture. If I follow François Jullien’s distinction between Greek and Chinese strategy, architecture is clearly the Greek, top-down, left brain, goal-oriented part of the strategy for producing modular, agile and open software.
  • The way the product is made (the software development culture). This translates into “genes” which are embedded into the software product. According to the same distinction, software development culture is the Chinese, bottom-up, right brain, emergent strategy for producing modular, agile and open software. This is less understood and even less formalized, it is a form of wisdom transmitted in an oral tradition. It is also controversial since many still believe that once the specification is completed, it doesn’t matter who writes the code …

I am certainly not one of them J. On the contrary, I have found over the years that great software products most often come from companies with great software cultures. It is not a new thought either, even for me. In my first book “Urbanisation, SOA & BPM”, I noticed that modularity and agility are properties that describe the whole lifecycle and not only the development part. Agility in code writing does not do much for you if you cannot run your tests in an agile mode (Chapter 6). Similarly, modularity must translate into modular testing (running fewer tests), modular deployment (deploying fewer components) and modular maintenance (fixing problems faster because the area of investigation is limited to a smaller area).

The remainder of this post is devoted to « the way software products are built », for lack of time but mostly because my previous writings and books have been about software and information systems architecture. You may read the CESAMES slides to get an overview on achieving modularity, agility and openness through architecture. For those of you who don’t read French, here is a “101” summary:

  1.  Model-driven Architecture : architecture should be based on models and part of the development should be derived with semi-automated methods. Models are another form of “genes” for a software product: careful design at the model stage goes a long way to embed “future-proofness” (using scenario/whatif methods)
  2. Data models are critical: from semantics, conceptual analys, ontology to object lifecycle management. Data architecture is the most useful tool to prevent data distribution difficulties which plague most large-scale, heterogeneous information systems.
  3. Layered Architecture : defines abstraction levels and reduces the management complexity, a time-proven “good practice” of software architecture.
  4. Service-Oriented Architecture: defines the service structure so that reuse and sharing is made easier. SOA is also the proper tool to align the different stakeholders so that software fits the enterprise’s strategy. A service architecture is a reification of functional architecture (a service may be seen as the combination of a function – what it does- an interface – how to invoke it – and a contract – so-called “non-functional” properties –), which embodies abstraction and encapsulation.
  5. Process Architecture : defines the “composition grammar” through a recursive/fractal analysis of interactions. Process architecture is to “Business Process Engineering” what SOA is to “writing down a list of exposed services”: there is much more than listing and formalizing, it is about identifying patterns and sub-patterns, and extracting those patterns which will prove stable through time. It is more an art than a science.
  6. Event-Oriented Architecture: identifies “events” as pivots for interaction (which is a subpart of process architecture and a foundation for SOA). Publish/Subscribe is another time-proven pattern for building modular designs, which is built on top of a shared/structured event catalog.

2. Software Factories

Focusing on the way software products are build leads logically to the concept of “Software factory”. The following illustration shows three way of looking at a software system (or an information system):

  • The first step (left-most) is to look at the technical system (leading to what we call IT : Information Technology). This view is concerned with practical components such as databases, software code and computing resources. Processes are defined in the “computer science sense”.
  • Then we step back and add the human into the picture, mostly the user but also other stakeholders (management, administration, strategy,…), leading to Information Systems. IT/IS distinction is well established in information systems literature. This view adds – rightly so – usage as a key dimension (following the very profound statement that a software application that is not used is of little value), and shared enterprise artifacts such as models and business processes.
  • The topic of this post is to step back another time and look at the “production process” (the “factory”) that continuously builds and update the information system. On the right-most part of the illustration, we see both the information systems and the organization (usually the ISD – Information System Division in a large company) that builds and runs it. I have separated the part that builds (dev: software development) and the part that runs (op: operation) as a forward reference to devops.

Because a software factory handles ideas and digital information, it could be argued that it is an autopoietic system (this is not a car factory, there is endless supply of ideas and disk space to write new code). Autopoiesis represents the capacity of a living system to continuously develop itself and to transform the process that creates the system and which is a part of the system itself. Autopoiesis generates emergence (of properties) and (what may be seen as) auto-organization. This thread of thought is quite interesting, because it helps understanding the emergence of our three desired properties, however I will leave it to another day, to avoid adding confusion to conceptual complexity.
To return to more practical grounds, the goal of a software factory is to deliver “good software products”, rapidly and efficiently. Because we now have the advantage of having read “The Lean Startup” (if you have not, I would urge you to do so, it’s the best way to understand what is truly expected of a great software factory), we know that there is another dimension to SW factory performance: the ability to listen carefully to the product’s users and react rapidly to their expectation. This is why Eric Ries advocates for MVP (Minimum Viable Products): the SF (software factory) must be able to crank up simple products very rapidly, which are exposed to customers, and modified according to their reaction (this loop is shown on the illustration).
A lot of things are known about how to build a “good” SF. Sharing a reference with the previous post, I picked the following recommendations in Curt Hibb’s book “The Art of Lean Software Development”:

  •  “Practice 0” : Source Code Management and Scripted Built. This is where the word “factory” becomes self-evident: one must use tools (such as source code management) and industrial discipline to manufacture software. There is a “Maslow pyramid” of skills necessary to reach continuous deployment, scripted built is the first step.
  •  “Practice 1” : Automated Testing, because testing is crucial for quality, as in any industrial process (automated testing means more testing), but also because we want to run tests as early as possible, following the principles of extreme programming.
  •  “Practice 2” : Continuous Integration, which means that the product is built continuously in an iterative manner, instead of the traditional waterfall model. Continuous integration to perform integration testing as early as possible; it is also a way to “see the product” and ensure that the factory is united on a common goal.
  •  “Practice 5” : Customer Participation, which is what makes the continuous improvement loop that is pictured in the previous figure possible. Customer participation is at the heart of agile methods.

There is much more in Hibb’s book, as we shall later see, but this is a set of sound, time-proven practices. Another great source of inspiration for designing a software factory is the previously-mentioned DevOps “method”. Many excellent software companies, such as Facebook, are making references to DevOps, which is not a coincidence. Following Octo’s lead, I would summarize DevOps’ contributions with two principles: “Infrastructure as code” and “Continuous deployment”. Infrastructure as code is the ability to address all computing resources (either cloud computing or a regular data center) through API and software. It follows the principles of “Practice 0” (tools & automation) and give true flexibility and agility to the software factory. It also changes the “ops culture” and prepares for the next step. Continuous delivery is the ultimate step of continuous development/testing/integration/deployment. It helps shortening the continuous improvement loop from Eric Ries and is necessary to move towards a “lean software factory” as we shall see later. Taking a look at Facebook development and operations’ culture is worth the effort. Facebook has developed large-scale continuous deployment into an art. I recommend watching Chuck Rossi’s tech talk on “Pushing millions of lines of code five days a week”.

3. Lean Software Factory

The idea of a “lean software factory” comes from mixing “lean software development” (cf. previous post) with “software factory”. That is, adding to what we just saw a few other principles which are taken from Agile methods and from the Toyota Production System (cf. Hibb’s book). This does not mean that all projects from a lean software factory should follow a SCRUM method (take as an illustrative example of agile method). Although this is debatable, I believe that some projects are still better run with a classical V-cycle model (I am not not the only one). There is no magical formula to define the “SCRUM/ agile boundary”, but V-cycle still makes a lot of sense for “back-office projects” with stable and complex specifications (such as a billing system). On the other side, agile methods are better suited to front-office projects (when the human in the loop plays a bigger role), where detailed requirements are difficult to produce because the need is ill-defined or changing rapidly.

To keep this post short, I will summarize the concept of “Lean Software Factory” with four “principles”. Each of them would require a full post, which I may do later on – Each “principle” is in fact a set of practices since “lean is something you do, not something you talk about”.  These principles add to the previously developed concept of “Software Factory”. The first principle captures the essence of “agile methods” and, therefore, only applies to agile projects, whereas the rest applies to both forms of software development (that is, including V-cycle development).

  1. The first principle is to apply an agile method such as SCRUM (Backlog + small batch + test as early as possible + continuous build) whenever the end-user has an important stake with the software product. Agile methods fit nicely with the principles of a SF as described in the previous section. They emphasize customer participation and continuous integration. The lean “touch” adds the concept of small batches (called sprints in SCRUM) and the principle of testing as early as possible, with the goal of producing the right code on the first time. Building a product one small step at a time with regular opportunity to adapt to environment feedback is a key idea which is well developed in “The Lean Startup”. Another key inspiration from lean is to reduce “lead time”, which translates into short sprints but also into time-constrained steps, including design.  This last technique also works within V-cycle: using time-constrained workshops to jointly achieve the requirements and design phases. Those familiar with Google’s software development values will recognize the “lean influence” (develop quickly, only what is necessary, remove waste).
  2. The second principle is to emphasize autonomous teamwork. Teamwork is critical for all kinds of projects and for most activities. A key teamwork moment from the lean culture is Kaizen, which is used to solve problems and search for continuous improvements (two sides of the same coin). Following “the Toyota Way”, all ideas are welcome and everyone’s contribution is useful in a LSF.  There is a lot to be said about kaizen (which I won’t do today) : it goes further than the continuous improvement culture that one may find everywhere (such as the feedback loop in the SCRUM method). “Lean culture” brings a systemic approach to problem solving, including the search for root causes with “5 Whys” and the construction/follow-up action plans, such as the famous “A3” from Toyota. Autonomy is a systemic condition for kaizen in particular, but more generally empowerment is necessary to achieve performance.  One of the best book to understand kaizen and autonomous teams is “The Lean Manager” by F. & M. BallĂ©.
  3. The third principle is to leverage visual management, which often takes the form of a project/product room. Visual Management has multiple benefits, the first of them is synchronicity, that is working with the same time. In the world of an industrial factory, the lean concept that embodies synchronicity is “takt time”. Although takt time also plays a role in a software factory, synchronicity is mostly about working at the same pace, without waiting. Dynamic wall-planning is the best tool to ensure synchronicity, together with the frequent stand-up meetings in front of the said planning, where the whole team keeps track of progress and difficulties. Visual management is also a tool for systemic training. Toyota encourages its workers to use as many schematics and illustrations as needed to share the detailed functioning of technical processes or pieces of equipment. This translates easily into the world of software. Using the walls to share architectural insights with the team is an efficient way to contribute to continuous learning as well as increase efficiency and prevent errors. Visual management is also used to visually control “work in process” (WIP). Reducing WIP is another key tenet from lean management that applies very nicely to software development. The practice of visualizing WIP with small cards (post-it) that are pasted on the wall according to their status in the development process is called Kanban in the lean IT world, in reference to the Totota pull system. Kanban / JIT (just-in-time) in the world of software is not as strictly enforced as in the world of industrial manufacturing. Still, the “pull” chain of control, where every step in a process is “serving” the following step (that is, providing what is needed at the right time, according to the availability of the receiving step), is a great tool to increase efficiency and avoid “overload” of tasks that are waiting to get completed. The “kanban” practice has two benefits: making each member of the team aware of the availability of others who will use their work later on, and reducing overloads and piles of unfinished work through an implicit capacity limit to what is accepted into the development process. The emphasis is on “no waiting” to both improve agility and quality (asynchrony is the best way to lose “context” when the control is handled from one player to another and to produce misunderstandings – this is explained in my last book, and is especially true for software development, which is a complex task, and where one quickly looses focus once your work  is completed.
  4. The last principle tells that a Lean Software Factory is a place with “love for the product”. This supposes two things: to know, understand and “love” the customer, on one hand, and to love software code on the other hand. The love of code is another multi-dimensional mix of culture and practice.  The practice part draws on extreme programming (code reviews, peer writing) and software factory (cf. previous section) with a “lean touch”. Mary Poppendieck explains how the 5S of lean may be applied to the practice of source code management. Lean practice also translates in writing less code (see previously mentioned Curt Hibb’s book). The culture part is also a mix of aesthetic (writing elegant, minimal code that one is pleased to show to the other members of the team) and discipline (following coding styles and guidelines, appropriate density of comments, etc.). This is very close to the values of open source software, one could say that a lean software factory should write its code as if all of it was going to be open source. We are getting back to the opening argument in the introduction: designing open software is a state of mind, hence it should be supported by the culture. There are two reasons why “the love of code” is emphasized as a key value. The first one is that application of what is learned about Toyota: to build a great company, the employees need to love the product that they are making. For Toyota it is about cars, in a software factory, it is about code. Lean management is all about professional pride, technical skills and craft. A lean software factory is not about undistinguishable “man-days” that may be outsourced to a lower-cost country. The second reason is that code is a “live object”, with a renewal rate which is getting higher as the world becomes more complex (Petra Cross from Google says that 50% of their code changes every month). Code that grows iteratively needs to be re-factored regularly (iteration yields accumulation); like a garden, it needs constant care and attention.


Cecil Dijoux said...

Thank you for this post Yves.

I think there is one major aspect of software that does not really appear here is tests.

Frommy experience, I just don't believe in Big Upfront Design and architecture approaches such as Model Driven Architecture or Service Oriented Architecture. I rather believe in emergent design.

What I've learned is there are two types of software : the one you can change and the one you can't. The first are the base of resilient systems, the other are legacy code.

The best way to make your software able to cope with change is to have unit tests you can run fast. Model Driven Architecture is difficult to test, it makes every change very heavy to handle, it does not cope with concurrent teams working on it. It makes your software base heavily depending on external frameworks (MagicDraw, all this kind of stuff). Not to mention migration issues.

I'm not saying the idea is not beautiful I'm just saying it does not work for small/medium organisation. And it surely does not work for Agile development.

I don't think you can have both : MDA, SOA ... and a Lean Start-up approach. If you do one you can't have the other.

Yves Caseau said...

Thanks for your comment :) I agree that testing is a key part of the puzzle, I thought that I made it clear (cf. my comments about the need for agile testing and modular testing).

I actually agree that you cannot do everything at the same time. I have a rather loose definition (see my previous postings or my books) about SOA and MDA, but still I would agree that you cannot do "top-down, model & architecture - driven, large scale system engineering" and "agile development" at the same time. However, my experience is that you need both (in a large organization). This is the point I was trying to make at the begining of section 3 : A LSF need to run both agile projects and V-cycle (model & architecture driven) projects. The separation / distinction is a bit messy, but my opinion is that they may coexist (which is not to say - your point - that they can be done at the same time).

There is another way to answer your comment (because I think that my experience is actually close to yours): I do not envision MDA or SOA as a code-generation, micro-level practice but as a enterprise architecture, macro-pratice. This reduces the tension that you pointing out between LSF and SOA/MDA.

Technorati Profile