Eliminate enterprise software design instability - protect variations! Nickolay Kofanov

Similar documents
GRASP 2. CSC 440: Software Engineering Slide #1

Object-Oriented Design II - GRASP

2009 Shawn A. Bohner. Shawn Bohner Office: Moench Room F212 Phone: (812)

Object-Oriented Design

Four More GRASP Principles CSSE 574: Session 5, Part 2

ADVANCED SOFTWARE DESIGN LECTURE 7 GRASP

Object-Oriented Design I

Object-Oriented Design

GRASP: MORE PATTERNS FOR

Object-Oriented Design II

Last Time: Object Design. Comp435 Object-Oriented Design. Last Time: Responsibilities. Last Time: Creator. Last Time: The 9 GRASP Patterns

GRASP Design Patterns A.A. 2018/2019

Object-Oriented Design I - SOLID

17. GRASP: Designing Objects with Responsibilities

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

Avancier Methods. Very basic design patterns. It is illegal to copy, share or show this document

OODP OOAD Session 7a

Patterns and Testing

PART 4 Elaboration Iteration 2 More Patterns

Responsibilities. Using several specific design principles to guide OO design decisions.

ADVANCED SOFTWARE DESIGN LECTURE 4 GRASP. Dave Clarke

Tecniche di Progettazione: Design Patterns

Software Engineering

Principles of Software Construction: Objects, Design and Concurrency. Object-Oriented Design: Assigning Responsibilities.

Principles of Object-Oriented Design

From Design Patterns: Elements of Reusable Object Oriented Software. Read the sections corresponding to patterns covered in the following slides.

Information Expert (or Expert)

Abstraction. Design fundamentals in OO Systems. Fundamental Software Development Principles

Software Design and Analysis CSCI 2040

Object Analysis & Design in the textbook. Introduction to GRASP: Assigning Responsibilities to Objects. Responsibility-Driven Design

Software Engineering

CSC7203 : Advanced Object Oriented Development. J Paul Gibson, D311. Design Patterns

Intro to: Design Principles

Chapter 8: Class and Method Design

OO Design Principles

Object Oriented. Analysis and Design

be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate

Design patterns. Jef De Smedt Beta VZW

COMP 6471 Software Design Methodologies

CHAPTER 5 GENERAL OOP CONCEPTS

Software Engineering

CSE 70 Final Exam Fall 2009

Object Relationships

Introduction to Testing and Maintainable code

Requirements and Design Overview

1: Introduction to Object (1)

Highlights of Previous Lecture

The Design Patterns Matrix From Analysis to Implementation

2 GRASP Patterns and basic OO Design. Roel Wuyts OASS

Study About the Relationship Between the Model-View-Controller Pattern and Usability

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

Assigning Responsibilities

Software Design and Analysis CSCI 2040

Applying Some Gang of Four Design Patterns CSSE 574: Session 5, Part 3

Principles of Software Construction: Objects, Design, and Concurrency. Assigning Responsibilities to Objects. toad. Jonathan Aldrich Charlie Garrod

Ingegneria del Software Corso di Laurea in Informatica per il Management. Software quality and Object Oriented Principles

17.11 Bean Rules persistent

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

An Introduction to Patterns

Object-Oriented Design

References: Applying UML and patterns Craig Larman

Index. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107

Principles of Object-Oriented Design

Exam in TDDB84: Design Patterns,

Architectural Code Analysis. Using it in building Microservices NYC Cloud Expo 2017 (June 6-8)

Introduction to Software Engineering (2+1 SWS) Winter Term 2009 / 2010 Dr. Michael Eichberg Vertretungsprofessur Software Engineering Department of

Design Patterns. Paul Jackson. School of Informatics University of Edinburgh

An Introduction to Patterns

Design Patterns V Structural Design Patterns, 2

Recap: CRC Cards Process

Software Design And Modeling BE 2015 (w. e. f Academic Year )

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

CSC207H: Software Design SOLID. CSC207 Winter 2018

Assigning Responsibilities by Larman

Lecture: Modular Design

Schedule(3/3) March 18th 13:00 Unified Process and Usecase-Driven Approach. (problem definition, use case model)

Object- Oriented Design with UML and Java Part I: Fundamentals

Review Software Engineering October, 7, Adrian Iftene

OO Frameworks. Introduction. Using Frameworks

What is Software Architecture

Inheritance. EEC 521: Software Engineering. Dealing with Change. Polymorphism. Software Design. Changing requirements Code needs to be flexible

Idioms and Design Patterns. Martin Skogevall IDE, Mälardalen University

GRASP ing at the First 5 Patterns Principles CSSE 574: Session 3, Part 4

Application Oriented Networks: An SOA Perspective

CMPT Data and Program Organization

CMPS 115 Winter 04. Class #10 (2004/02/05) Changes/Review Programming Paradigms Principles of OOD <break> Design Patterns

Appendix A - Glossary(of OO software term s)

Frames and Inheritance. Winston, Chapter 9

COURSE 2 DESIGN PATTERNS

Open Closed Principle (OCP)

Integration Testing Qualidade de Software 2

Single Responsibility Principle (SRP)

Software Design and Analysis CSCI 2040

ADVANCED SOFTWARE DESIGN LECTURE 4 SOFTWARE ARCHITECTURE

Software Design and Analysis CSCI 2040

GRASP: Patterns for. chapter18

Object-oriented design principles

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

5. Application Layer. Introduction

Application Architectures, Design Patterns

Transcription:

Eliminate enterprise software design instability - protect variations! Nickolay Kofanov

Owning a hammer doesn't make one an architect.

Responsibility-Driven-Design The way of thinking about the design of software objects (and also larger-scale components) in terms of responsibilities, roles, and collaborations

A critical ability in OO development is to skillfully assign responsibilities to software objects. General Responsibility Assignment Software Patterns grasp these principles to successfully design object-oriented software.

2 common patterns that are most often used subconsciously GRASP #1 Creator Question: Who should be responsible for creating a new instance of some class GRASP #2 Information Expert Question: What is a general principle of assigning responsibilities to objects

Yin und Yang of software engineering GRASP #3 Low Coupling Question: How to support low dependency, low change impact, and increased reuse? GRASP #4 High Cohesion Question: How to keep objects focused, understandable, and manageable, and as a side effect, support Low Coupling?

High Cohesion + Low Coupling = Code Orthogonality The killer combination in components of tightly defined responsibilities together with independence from the wider system

Improve coupling? GRASP #5 Indirection Question: Where to assign a responsibility, to avoid direct coupling between two (or more) things? How to de-couple objects so that low coupling is supported and reuse potential remains higher? "Most problems in computer science can be solved by another level of indirection" Improve cohesion? - GRASP #6 Pure Fabrication Question: What object should have the responsibility, when you do not want to violate High Cohesion and Low Coupling, or other goals, but solutions offered by Expert (for example) are not appropriate?

Poly(multiple)-morph(form)-ism GRASP #7 Polymorphism Question: How to handle alternatives based on type? How to create pluggable software components?

GRASP #8 Controller Question: What first object beyond the UI layer receives and coordinates ("controls") a system operation GRASP Controller!= MVC Controller && ( GRASP Controller instanceof App/Domain service GRASP Controller instanceof Domain Model )

GRASP #9 Protected Variation Question: How to design objects, subsystems, and systems so that the variations or instability in these elements does not have an undesirable impact on other elements? Identify points of predicted variation or instability and assign responsibilities to create a stable interface around them. Almost every software or architectural design trick/principle/pattern is a specialization of Protected Variations

Simple example uper Delivery! Requirement for the release v1.0: Ukraine only shipment with Requirement for the release v2.0: International shipment with

Arrange Delivery Use Case: 1. Create new parcel 2. Send parcel to address 3.

Something is wrong here Arrange Delivery Use Case: 1. Create new parcel 2. Send parcel to address 3. Coupling to concrete class

Do the right thing (analysis); Do the thing right (design)

GoF Adapter Pattern

Repetition is the mother of all learning: Almost every software or architectural design trick/principle/pattern is a specialization of Protected Variations

Maturation of a developer or architect can be seen in their growing knowledge of ever-wider mechanisms to achieve PV Craig Larman the author of GRASP

Data-Driven Design The system is protected from the impact of data by externalizing the variant, reading it in, and reasoning with it.

Reflective Design The system is protected from the impact of logic or external code variations by reflective algorithms that use introspection and metalanguage services

Uniform Access Principle

Interpreter-Driven Design The system is protected from the impact of logic variations by externalizing the logic, reading it in, and using an interpreter.

Service Discovery / Lookup System is protected from variations in the location of services, using the stable interface of the lookup service Consul makes it simple for services to register themselves and to discover other services via a DNS or HTTP interface.

Liskov Substitution Principle (LSP) LSP formalizes the principle of protection against variations in different implementations of an interface, or subclass extensions of a superclass. CIRCLE What s the relation ship? ELLIPSE The Circle/Ellipse Dilemma Robert C. Martin If your code works with object a of type A it should also work correctly with any object b of type B if B extends (implements) A

Liskov Substitution Principle violation: Circle is not an Ellipse in software perspective

Structure-Hiding Design Law Of Demeter The system is protected from the impact object structure variations. Within a method, messages should only be sent to: 1. this object 2. An attribute of this. 3. An element of a collection which is an attribute of this. 4.A parameter of the method. 5. An object created within the method. when you want a dog to walk, you do not command the dog's legs to walk directly; you command the dog which then commands its own legs

Incorrect Correct

The farther along a path the program traverses, the more fragile it is Why? because the object structure may change! (especially true in young applications or early iterations)

Two points of change: Variation point - variations in the existing, current system or requirements Evolution point - speculative points of variation that may arise in the future, but which are not present in the existing requirements. Protected variations mechanisms are applied to both.

2 dangerous software engineer diseases: 1. Pattern-itis 2. Generalize-itis suffix -itis forming names of inflammatory diseases. You aren t going to need it extreme Programming principle

Novice developers tend toward brittle designs. Intermediate developers tend toward overly fancy and flexible designs. Expert designers choose with insight Sometimes a simple design whose cost of change is balanced against its likelihood.

Links: echo "Thank you!" Error, no keyboard. Press F1 to continue _