Lean Architecture for Agile Software Development
Total Page:16
File Type:pdf, Size:1020Kb
1 Agile has long shunned up-front design. When Agilists force themselves to do up-front work, it usually is limited to a symbolic use of User Stories for requirements and metaphor for architecture, with much of the rest left to refactoring. Experience and formal studies have shown that incremental approaches Lean Architecture for to architecture can possibly lead to poor structure in the long term. This talk shows how to use domain analysis in a Lean way to build an architecture of form that avoids the mass of structure that usually Agile Software accompanies big up-front design, using only judicious documentation. It will also show how Development architecture can accommodate incremental addition of features using Trygve Reenskaug's new DCI (Data, Context and Interaction) approach, and how it maps elegantly onto C++ implementations. The Taking Architecture into the talk is based on the forthcoming Wiley book of the same title. Agile World 7 Platform hours (9:00 - 16:00), 82 Slides. James O. Coplien Gertrud&Cope, Mørdrup, Denmark Copyright ©2010, ©2011, ©2012, ©2013, ©2014, ©2015 James O. Coplien. All rights reserved. No Scrum Foundation portions of this material may be reproduced or redistributed in any form without prior written permission from James O. Coplien. In general you will find that I am generous about giving permission for use of these materials at no charge as long as the source is acknowledged. 2 In this course you will learn Lean architecture — not just as a pop phrase, but in terms of the Seminar Objectives grounding of the term "Lean" in the principles of the Toyota Way. You will lean the importance of mental models in software architecture, particularly as the concept underlies the Model-View-Controller architecture that has been the foundation of most interactive programs since the 1980s. You will learn • To be able to apply Lean principles of the basics and several advanced concepts of the DCI (Data-Collaboration-Interaction) architecture. domain architecture • To learn about the place of mental models in architecture • NOTE: This is a seminar, not a tutorial LeanArchitecture-DCI-OneDay-Master.key - 15 Sep 2015 3 Here is an outline for the day. Outline I. Definitions: Lean, Agile, Architecture... 4–7 II. The Agile Architecture Allergy 8–15 III. Mental Models & MVC 16–20 IV. More than that: Overall form 21–23 V. What the System Is, ABCs, Dictionary 24–36 VI. What-the-system-Does 37–38 VII. The OO Crisis and DCI 41–48 VIII. Roles and DCI Implementation 49–63 IX. DCI Advantages 65–66 X. The Process 67–73 XI. Advanced Topics (time permitting) 74–81 XII. Conclusion 82–84 4 Lean is a complicated framework of values and practices that has been proven in building complicated I. What is Lean? systems. It has been refined by Toyota in Japan and has spread to other companies like Canon and Honda in Japan. It is the main foundation of the Scrum production framework. ! A collection of principles and approaches A comprehensive treatment of Lean would be impossible here, and the concept is difficult for the – Value Stream Western world. Here, we list some of the popular trappings of Lean as understood in the West. – Reducing waste (time, material) – Reducing inconsistency (with communication) The goals are reduced waste and higher value. – Reducing unevenness (planning & process) – Up-front planning – Single-piece continuous flow – Reduce inventory – Kaizen ! Results in – Reduced inventory – Reduced waste – Higher Value LeanArchitecture-DCI-OneDay-Master.key - 15 Sep 2015 5 In this course, by the term "Agile" we mean it as defined by the Agile Manifesto, above. What is Agile? We are uncovering better ways of developing software by doing it and helping others do it. Through this work we have come to value: – Individuals and interactions over processes and tools – Working software over comprehensive documentation – Customer collaboration over contract negotiation – Responding to change over following a plan That is, while there is value in the items on the right, we value the items on the left more. • Kent Beck • James Grenning • Robert Cecil Martin • Mike Beedle • Jim Highsmith • Steve Mellor • Arie van Bennekun • Andrew Hunt • Ken Schwaber • Alistair Cockburn • Ron Jefries • Jef Sutherland • Ward Cunningham • Jon Kern • Dave Thomas • Martin Fowler • Brian Marick © 2001, the above authors this declaration may be freely copied in any form, but only in its entirety through this notice. 6 This is a seminar about Lean and Agile architecture. What is architecture? Throughout the ages and even in the field of building construction, architecture has always been about form. Form is the What is Architecture? essence of structure. The word in English for a piece of material, into which molten metal or plastic are poured or injected to make a new something, is called a form. We focus on form because if we look at ! Architecture is the essence of structure: form structure, it actually makes it difficult to understand the essence by adding a lot of detail which is – Structure obfuscates form! irrelevant early in design. ! Lean architecture: just-in-time delivery of functionality, just-in-time pouring material into What, then, is Lean Architecture? The principles of Lean include just-in-time delivery, careful the forms organization, up-front planning, avoiding waste, and overall consistency. Architecture is in principle – Reduces long-term cost – Increases harmony: remove muri about consistency. If we have a consistent system early on that is stable over time, it avoids rework ! Agile architecture: one that supports change, and waste. That takes up-front planning and careful organization. That in place, we have a guide — a end-user interaction, discovery, and ease of form — into which we can write code when the need comes along. comprehension (of functionality) – Rapid delivery A good architecture supports Agile development. A good architecture is Agile if it supports change and – Increased revenues has just enough documentation to do the job — the documentation that really makes a difference. Good architecture supports the Agile values: support for change, a good model that supports the end user’s mental model of the system and that helps the developer’s discovery process. Here, we will focus on helping the developer reason about functionality in the code — functionality that reflects the end user wishes. LeanArchitecture-DCI-OneDay-Master.key - 15 Sep 2015 7 There are very few fundamental activities in software development; here they are. Analysis is about Architecture in the understanding the system, and is rather independent of the problems we want to solve. Problem Development Process definition sets the direction for design in the context of the analysis. Design solves the problem, and testing evaluates the degree to which we have solved the problem. We build a product called software, Analysis and most of that is code. The software has a form that we call its architecture. Understanding the System Architecture Design Solving the Problem(s) Code Problem Definition Articulating the Problem(s) Testing Did we solve the problem? 8 In an XP world, the air is full of singing User Stories and there is a beautiful and simple landscape. All II. YAGNI...? is well and the future looks bright. User Stories Tacit LeanArchitecture-DCI-OneDay-Master.key - 15 Sep 2015 9 The problem is that most of the system mass comes not from the explicit knowledge of system II. YAGNI...? functionality, but from the tacit knowledge about the form of the implementation and of the assumptions behind its functioning. These are often the realm of architecture. We often call it domain knowledge. Image by Ralph Clevenger, 1999. User Stories Tacit Knowledge 10 Mads Thiessen of Nordija relates that his project failed to do an up-front architecture, and used YAGNI The Agile Allergy to techniques to create a set-top box architecture based on channel services. When the architecture had Architecture to be converted to accommodate video on demand, it required a major re-work of the interface code and business logic. Marko Taipale of European Game and Entertainment Technology Ltd. Related (23 November, 2007, Helsinki, Finland) that they consciously started a project from scratch to use TDD to create an architecture — even though they thought they knew what the architecture would be. Six months later, “Because we had no up- “We spent 6 months their effort proved their initial hunch to be correct. front architecture, we didn’t doing TDD and ended foresee the need for video- on-demand services and with the architecture we originally knew that Long-term Cost incurred a great cost implementing it” — Mads we would get” — Thiessen, Nordija Marko Taipale, EGET Architectural Effort LeanArchitecture-DCI-OneDay-Master.key - 15 Sep 2015 11 Test-driven development is a design technique, intended to replace big up-front design in XP. The Architecture driven by Tests? historic progression started with an article by Kent Beck [Bec1994] that described how Smalltalk had suffered because it lacked a testing culture, and the article proposed how to solve the problem with a test framework. That framework evolved into the form it took in an article joint with Eric Gamma in ! The XP approach: Test-Driven Design 1998, which today we know as jUnit. [BeGa1998] Test-first was part of XP in 1999 [Bec1999], and TDD – First, write the test; then run it; then write the techniques matured by 2002 [Bec2002]. code; then run the test again; “refactor” until it works The idea is that tests shape your architecture. That could be true in the days when function — which is – No code without a test first what tests are about — dominated system structure. That was true in the day of batch programming ! This worked fine in the days when the system shape followed the imperative flow and card readers.