Agile Architecture. The Why, the What and the How

Similar documents
Essential Skills for the Agile Developer. Agile. copyright Net Objectives, Inc.

Design Patterns Thinking and Architecture at Scale

The Design Patterns Matrix From Analysis to Implementation

The Strategy Pattern Design Principle: Design Principle: Design Principle:

Using Design Patterns in Java Application Development

Background. Fowler's Perspectives. bjectives. Scott L. Bain, Senior Consultant, Net Objectives,

Index Shalloway rev.qrk 9/21/04 5:54 PM Page 419. Index

Topics. Software Process. Agile. Requirements. Basic Design. Modular Design. Design Patterns. Testing. Quality. Refactoring.

Design Patterns Explained

Design Pattern. CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.)

Design patterns. Jef De Smedt Beta VZW

SDC Design patterns GoF

MSO Lecture 12. Wouter Swierstra (adapted by HP) October 26, 2017

Application Architectures, Design Patterns

CSCI 253. Overview. The Elements of a Design Pattern. George Blankenship 1. Object Oriented Design: Iterator Pattern George Blankenship

Refactoring, Design Patterns and Extreme Programming %-(&7,9(

EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 6: Design Patterns

Produced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

Applying the Observer Design Pattern

1 Software Architecture

Software Design COSC 4353/6353 D R. R A J S I N G H

Object-Oriented Design

Design Patterns. Manuel Mastrofini. Systems Engineering and Web Services. University of Rome Tor Vergata June 2011

MSO Lecture 6. Wouter Swierstra (adapted by HP) September 28, 2017

MSO Lecture 6. Wouter Swierstra. September 24, 2015

Design Patterns Reid Holmes

An Introduction to Patterns

MSO Object Creation Singleton & Object Pool

Review Software Engineering October, 7, Adrian Iftene

CSE 70 Final Exam Fall 2009

Introduction to Software Engineering: Object Design I Reuse & Patterns

The GoF Design Patterns Reference

Applying the Factory Method Design Pattern

Software Design Patterns. Background 1. Background 2. Jonathan I. Maletic, Ph.D.

Object-oriented Software Design Patterns

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico

DESIGN PATTERN - INTERVIEW QUESTIONS

Lectures 24 and 25 Introduction to Architectural Styles and Design Patterns

Writing your own Java I/O Decorator p. 102 Tools for your Design Toolbox p. 105 Exercise Solutions p. 106 The Factory Pattern Baking with OO

Design Patterns. Observations. Electrical Engineering Patterns. Mechanical Engineering Patterns

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

COURSE 11 DESIGN PATTERNS

Design Patterns. Gunnar Gotshalks A4-1

DESIGN PATTERNS FOR MERE MORTALS

A few important patterns and their connections

Plan. A few important patterns and their connections. Singleton. Singleton: class diagram. Singleton Factory method Facade

Trusted Components. Reuse, Contracts and Patterns. Prof. Dr. Bertrand Meyer Dr. Karine Arnout

CS342: Software Design. November 21, 2017

Improve Your SystemVerilog OOP Skills

Tuesday, October 4. Announcements

CS 520/620 Advanced Software Engineering Fall September 27, 2016

CPSC 310 Software Engineering. Lecture 11. Design Patterns

Design Patterns: From Analysis to Implementation BJECTIVES

Chapter 8 Paying Attention to Principles and Wisdom

Keywords: Abstract Factory, Singleton, Factory Method, Prototype, Builder, Composite, Flyweight, Decorator.

Produced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar

Applying the Decorator Design Pattern

SOLID DESIGN PATTERNS FOR MERE MORTALS

OODP Session 4. Web Page: Visiting Hours: Tuesday 17:00 to 19:00

APPLYING DESIGN PATTERNS TO SCA IMPLEMENTATIONS

Build Testable Client and Service Applications

Patterns in Software Engineering

Credit where Credit is Due. Lecture 25: Refactoring. Goals for this lecture. Last Lecture

3 Product Management Anti-Patterns by Thomas Schranz

Plan. Design principles: laughing in the face of change. What kind of change? What are we trying to achieve?

Applying Design Patterns to accelerate development of reusable, configurable and portable UVCs. Accellera Systems Initiative 1

Object Oriented Methods with UML. Introduction to Design Patterns- Lecture 8

Understading Refactorings

CS 520/620 Advanced Software Engineering Spring February 11, 2016

Lecture 20: Design Patterns II

Object-Oriented Oriented Programming

Administrivia. Programming Language Fall Example. Evolving Software. Project 3 coming out Midterm October 28. Refactoring October 14, 2004

The Object-Oriented Paradigm

Kerievsky_book.fm Page 355 Thursday, July 8, :12 PM. Index

Socket attaches to a Ratchet. 2) Bridge Decouple an abstraction from its implementation so that the two can vary independently.

administrivia today UML start design patterns Tuesday, September 28, 2010

Lecture 17: Patterns Potpourri. Copyright W. Howden 1

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

Design Patterns. (and anti-patterns)

UNIT I Introduction to Design Patterns

Software Development Project. Kazi Masudul Alam

Evolving Software. CMSC 433 Programming Language Technologies and Paradigms Spring Example. Some Motivations for This Refactoring

What is Design Patterns?

More on Design. CSCI 5828: Foundations of Software Engineering Lecture 23 Kenneth M. Anderson

RDD and Strategy Pa.ern

Expanding Our Horizons. CSCI 4448/5448: Object-Oriented Analysis & Design Lecture 9 09/25/2011

A Data Modeling Process. Determining System Requirements. Planning the Project. Specifying Relationships. Specifying Entities

Think of drawing/diagramming editors. ECE450 Software Engineering II. The problem. The Composite pattern

Lessons Learned. Johnny Bigert, Ph.D., Skype/Microsoft October 26, 2011

Design Patterns. Dr. Rania Khairy. Software Engineering and Development Tool

Design patterns. OOD Lecture 6

Agile Software Development

Design Patterns. SE3A04 Tutorial. Jason Jaskolka

TDDB84. Lecture 2. fredag 6 september 13

A Reconnaissance on Design Patterns

Dealing with Bugs. Kenneth M. Anderson University of Colorado, Boulder CSCI 5828 Lecture 27 04/21/2009

Microservice Splitting the Monolith. Software Engineering II Sharif University of Technology MohammadAmin Fazli

Dependency Inversion, Dependency Injection and Inversion of Control. Dependency Inversion Principle by Robert Martin of Agile Fame

Introduction to Testing and Maintainable code

Transcription:

Agile Architecture The Why, the What and the How

Copyright Net Objectives, Inc. All Rights Reserved 2 Product Portfolio Management Product Management Lean for Executives SAFe for Executives Scaled Agile Framework ASSESSMENTS CONSULTING TRAINING COACHING technica process l Kanban / Scrum ATDD / TDD / Design Patterns SAFe Scrum/XP Leading SAFe SAFe Program Consultant Lean Management Project Management p o d c a s t s

Copyright Net Objectives, Inc. All Rights Reserved 3 Al Shalloway CEO, Founder alshall@netobjectives.com @AlShalloway Co-founder of Lean-Systems Society Co-founder Lean-Kanban University

What are objects? How much time does typing take? If you have a choice between A & B and one is easy to undo & the other isn t, which do you chose? Copyright Net Objectives, Inc. All Rights Reserved 4

Copyright Net Objectives, Inc. All Rights Reserved 5 when adding functionality, where s the problem? is it in writing the new code? integrating it into the new system? and which is likely to be the source of difficulties?

Copyright Net Objectives, Inc. All Rights Reserved 6 Units: Agile Architecture 1. Purpose of Architecture 2. Perspective Models 3. Useful Practices

Copyright Net Objectives, Inc. All Rights Reserved 7 ABLE WORK Purpose Why have an architecture? and, by the way, what is an architecture?

Copyright Net Objectives, Inc. All Rights Reserved 8 architecture what is architecture? Underlying technology Structure Layers What can t be changed? What provides context for change?

Copyright Net Objectives, Inc. All Rights Reserved 9 architecture when you want to extend an architecture for performance, scalability or security reasons, which causes problems: architecture or code quality

all with minimal risk Copyright Net Objectives, Inc. All Rights Reserved 10

Copyright Net Objectives, Inc. All Rights Reserved 11 architecture what if integrating functionality wasn t hard? we weren t tied to our system s architecture? we were truly object-oriented? we could be prepared for the unknown?

Copyright Net Objectives, Inc. All Rights Reserved 12 Not trying to anticipate change Cannot prevent change Designing to accommodate* change requires Layered architectures Code clarity and maintainability *Change is not the problem, it s the damage that it causes. What if it didn t cause damage.

Copyright Net Objectives, Inc. All Rights Reserved 13 Classic Architecture Create a structure that contains everything Anticipate everything Understand the big picture so have a framework to hold things Learn what you need to up front Agile Architecture Create a structure that can change Prepare for anything Understand the big picture so can evolve to hold things Set things up to use new ideas as they become apparent

Copyright Net Objectives, Inc. All Rights Reserved 14 architecture the real question How do we allow for evolutionary architecture? there is a parallel between agile architecture and agile discovery

how? Emergent design Copyright Net Objectives, Inc. All Rights Reserved 15 Testing at Behavior and Functional levels Behavioral testing (ATDD, BDD) Test perspective is from customer Functional test Test perspective is from coder Why test-first in both cases?

Copyright Net Objectives, Inc. All Rights Reserved 16 Types of Refactoring Refactoring Bad Code Code "smells" Improve Design without changing Function. Refactor to improve code quality A way to clean up code without fear of breaking the system Refactoring Good Code Code is "tight" A new Requirement means code needs to be changed Design needs to change to accommodate this. A way to make this change without fear of breaking the system

Copyright Net Objectives, Inc. All Rights Reserved 17 Types of Refactoring Refactoring Bad Code Code "smells" Improve Design without changing Function. Refactor to improve code quality A way to clean up code without fear of breaking the system Refactoring Good Code Code is "tight" A new Requirement means code needs to be changed Design needs to change to accommodate this. A way to make this change without fear of breaking the system

Copyright Net Objectives, Inc. All Rights Reserved 18 Testability Code that is difficult to unit test is often: 1. Tightly Coupled: "I cannot test this without instantiating half the system 2. Weakly Cohesive: "This class does so much, the test will be enormous and complex! 3. Redundant: "I'll have to test this in multiple places to ensure it works everywhere"

Copyright Net Objectives, Inc. All Rights Reserved 19 Testability and Design Considering how to test your objects before designing them is, in fact, a kind of design It forces you to look at: the public method definitions what the responsibilities of the object are Easy testability is tightly correlated to loose coupling and strong cohesion

Copyright Net Objectives, Inc. All Rights Reserved 20 Units: Agile Architecture 1. Purpose of Architecture 2. Perspective Models 3. Useful Practices

Copyright Net Objectives, Inc. All Rights Reserved 21 Perspective Models 1. Abstraction 2. Creation 3. Structure Conceptual Specification Implementation thinking points

Copyright Net Objectives, Inc. All Rights Reserved 22 Three Perspectives of Abstraction Conceptual What you want Specification How you use it Implementation How it actually works UML Distilled: A Brief Guide to the Standard Object Modeling Language, Second Edition, by Martin Fowler, Addison-Wesley Pub Co, ISBN: 0321193687

Copyright Net Objectives, Inc. All Rights Reserved 23 Use of Perspectives Any entity (class, method, delegate, etc ) in a system should operate at one of these perspectives: Conceptual Specification Implementation UML Distilled: A Brief Guide to the Standard Object Modeling Language, Second Edition, by Martin Fowler, Addison-Wesley Pub Co, ISBN: 0321193687

Copyright Net Objectives, Inc. All Rights Reserved 24 Perspective Models 1. Abstraction 2. Creation 3. Structure Create objects Use objects thinking points

rinciple: Separate Use From onstruction Copyright Net Objectives, Inc. All Rights Reserved 25 The relationship between any entity A and any other entity B in a system should be limited such that A makes B or A uses B, and never both.

Copyright Net Objectives, Inc. All Rights Reserved 26 Normal Constructor C++ class ByteFilter { public: ByteFilter(); virtual ~ByteFilter(); } ByteFilter::ByteFilter () { // do any constructor behavior here } // the rest of the class follows void main { ByteFilter *mybytefilter; //... mybytefilter = new ByteFilter(); //... }

Copyright Net Objectives, Inc. All Rights Reserved 27 Encapsulating the Constructor C++ class ByteFilter { public: static ByteFilter* getinstance(); protected: ByteFilter(); virtual ~ByteFilter(); } ByteFilter::ByteFilter () { // do any constructor behavior here } ByteFilter* ByteFilter::getInstance() { return new ByteFilter(); } Void ByteFilter::returnInstance( ByteFilter *bf2delete) { delete bf2delete; } // the rest of the class follows void main { ByteFilter *mybytefilter; //... mybytefilter = ByteFilter::getInstance(); //... }

Accommodating Change: Complexity C++ Copyright Net Objectives, Inc. All Rights Reserved 28 class ByteFilter { // this is an abstract class. public: static ByteFilter* getinstance(); protected: ByteFilter(); }; ByteFilter* ByteFilter::getInstance() { if (somedecisionlogic()) { return new HiPassFilter(); } else { return new LoPassFilter(); } } //Note: both HiPassFilter and LoPassFilter derive from ByteFilter // but implement the filtering differently void main () { ByteFilter *mybytefilter; //... mybytefilter = ByteFilter::getInstance(); //... } No Change!

Copyright Net Objectives, Inc. All Rights Reserved 29 In C++, Objects on the Stack C++ Instead of this ByteFilter mybytefilter; //. //. Object gets used //. // Object falls out of scope, memory is cleaned up we prefer this Encapsulating Destruction ByteFilter* mybytefilter = ByteFilter::getInstance(); //. //. Object gets used //. ByteFilter::returnInstance(myByteFilter);

Copyright Net Objectives, Inc. All Rights Reserved 30 Using Smart Pointers C++ auto_ptr<bytefilter> mybytefilter = ByteFilter::getInstance(); //. //. Object gets used, exception-safety ensured //.

Copyright Net Objectives, Inc. All Rights Reserved 31 Perspective Models 1. Abstraction 2. Creation 3. Structure Architecture Application thinking points

architecture is layered One layer should not know about another Copyright Net Objectives, Inc. All Rights Reserved 32

Copyright Net Objectives, Inc. All Rights Reserved 33 Units: Agile Architecture 1. Purpose of Architecture 2. Perspective Models 3. Useful Practices

Copyright Net Objectives, Inc. All Rights Reserved 34 Useful Practices 1. Understand objects 2. Simplify adding new functionality 3. Simplify Interfaces 4. Design for the Unknown 5. Avoid redundancy Objects are not data with methods Objects are manifestations of concepts or behavior thinking points

Copyright Net Objectives, Inc. All Rights Reserved 35 Useful Practices 1. Understand objects 2. Simplify adding new functionality 3. Simplify Interfaces 4. Design for the Unknown 5. Avoid redundancy Use dependency injection Separate use from construction thinking points

Copyright Net Objectives, Inc. All Rights Reserved 36 The Problem We are writing a web-enabled sales order system A customer signs in and fills out the order

Copyright Net Objectives, Inc. All Rights Reserved 37 Initial Solution TaskController SalesOrder Have TaskController instantiate SalesOrder that handles filling out the sales order, etc.

Copyright Net Objectives, Inc. All Rights Reserved 38 The Challenge As soon as we get new variations in tax we have to modify the SalesOrder object Where should we add the new responsibility if taxation begins to vary?

Copyright Net Objectives, Inc. All Rights Reserved 39 New Requirement Multiple Tax Domains Eventually need to handle different tax rules US Tax Canadian Tax One Solution method calctax // use switch on type of tax rule to be used // TYPE US: // calc tax based on US rules // break // TYPE CANADIAN: // calc tax based on Canadian rules // break

Copyright Net Objectives, Inc. All Rights Reserved 40 Direct Inheritance for Specialization We can solve this problem by specializing our first SalesOrder object to handle the new tax rules TaskController SalesOrder + calctax() z original calctax that does US tax new (overriden) calctax that does Canadian tax CanadianSalesOrder + calctax()

Copyright Net Objectives, Inc. All Rights Reserved 41 Abstract Inheritance for Specialization This is a bit better SalesOrder + calctax() CanadianSalesOrder + calctax() USSalesOrder + calctax()

Copyright Net Objectives, Inc. All Rights Reserved 42 May Lead to Maintenance Problems If we get new variations, where do we put them? We either start using lots of switches (which makes the code difficult to understand), or we start over-specializing (which still makes things difficult) What if we need to switch tax algorithms at runtime? SalesOrder + calctax() CanadianSalesOrder + calctax() USSalesOrder + calctax() EnglishCanadianSO + language() FrenchCanadianSO language()

Copyright Net Objectives, Inc. All Rights Reserved 43 Proper Use of Inheritance Define a class that encapsulates variation, contain (via delegation) an instance of a concrete class derived from the abstract class defined earlier Chip Chip Encryption Chip_64e Chip_128e 64e 128e Class Inheritance to Specialize Class Inheritance to Categorize 1. Decoupling of concepts 2. Deferring decisions until runtime 3. Small performance hit

Copyright Net Objectives, Inc. All Rights Reserved 44 Dependency Injection TaskController SalesOrder CalcTax + taxamount(itemsold : Salable, qty : double, price : double) : double USTax CanTax

Copyright Net Objectives, Inc. All Rights Reserved 45 Useful Practices 1. Understand objects 2. Simplify adding new functionality 3. Simplify Interfaces 4. Design for the Unknown 5. Avoid redundancy Use Dependency Inversion Principle thinking points

Copyright Net Objectives, Inc. All Rights Reserved 46 Dependency Inversion Principle High level modules should not depend on low-level modules. Both should depend on abstractions. Abstractions should not depend on details. Details should depend on abstractions. The modules that contain the high-level business rules should take precedence over, and be independent of, the modules that contain the implementation details. Agile Software Development: Principles, Practices and Patterns Bob Martin, pg 127.

Copyright Net Objectives, Inc. All Rights Reserved 47 Useful Practices 1. Understand objects 2. Simplify adding new functionality 3. Simplify Interfaces 4. Design for the Unknown 5. Avoid redundancy Scott s Magic Card Encapsulate that! thinking points

Copyright Net Objectives, Inc. All Rights Reserved 48 The Situation Multiple processors in a real-time environment There will be a performance problem just don t know where / how

The Options Figure out where / how the performance problem will show up Just use what appears best at first and fix it later if it becomes clear later that we need something else Use Scott Bain s magic consultant card Copyright Net Objectives, Inc. All Rights Reserved 49 ~3

Copyright Net Objectives, Inc. All Rights Reserved 50 How would I design if I knew that no matter what I did it would be wrong?

The Magic Consultant Card Copyright Net Objectives, Inc. All Rights Reserved 51 ~3

The Magic Consultant Card Copyright Net Objectives, Inc. All Rights Reserved 52 ~3

The Magic Consultant Card "Encapsulate That" Copyright Net Objectives, Inc. All Rights Reserved 53 ~3

The Magic Consultant Card The Good News The magic card is always right! The Bad News It doesn t tell you how to do what it tells you to do! This is where design patterns come in. In many cases a pattern exists to help you see how to solve your problem. Copyright Net Objectives, Inc. All Rights Reserved 54 ~3

The Net Objectives Patterns Repository Behavior Strategy Bridge Sequence Workflow Cardinality Construction Selection Structure Decorator Template Method Decorator Singleton Chain of Responsibility Composite Chain of Responsibility Template Method Template Method Null Object Visitor Bridge Null Object Chain of Responsibility Abstract Factory Template Method Proxy Observer Composite Builder Entity Facade Adapter Proxy Factory Method Relationships Observer Command Mediator Visitor Dependencies Mock Object Prototype http://www.netobjectivestest.com/patternrepository/index.php?title=main_page Copyright Net Objectives, Inc. All Rights Reserved 55

Copyright Net Objectives, Inc. All Rights Reserved 56 Useful Practices 1. Understand objects 2. Simplify adding new functionality 3. Simplify Interfaces 4. Design for the Unknown 5. Avoid redundancy Avoiding redundancy is impossible We can manage it Shalloway s Principle thinking points

Copyright Net Objectives, Inc. All Rights Reserved 57 Shalloway s Law If N things need to change and N>1, Shalloway will find at most N-1 of these things

Copyright Net Objectives, Inc. All Rights Reserved 58 Shalloway s Principle Avoid situations where Shalloway s Law Applies

Copyright Net Objectives, Inc. All Rights Reserved 59 Summary review Design for change Use models of perspective Abstraction Creation Structure Use good practices Dependency injection Model the unknown Shalloway s Law You ve still gotta think!

Copyright Net Objectives, Inc. All Rights Reserved 60 Questions email: alshall@netobjectives.com twitter: @alshalloway Webinars May 28 The Challenges of Team-Based or Evolutionary Based Methods In Achieving Agile at Scale