©Alistair Cockburn 2009 Alistair Cockburn You Can't Be Agile if Your Architecture's a Mess “Continuous attention to technical.

Slides:



Advertisements
Similar presentations
Bruce Scharlau, University of Aberdeen, 2012 Data storage options for mobiles Mobile Computing.
Advertisements

Eric J. Oszakiewski MCTS: SharePoint Application Development SharePoint Configuration.
UFCE8V-20-3 Information Systems Development 3 (SHAPE HK)
And so to Code. Forward, Reverse, and Round-Trip Engineering Forward Engineering Reverse Engineering Round-Trip Engineering.
What is MySQL? MySQL is a relational database management system (A relational database stores data in separate tables rather than putting all the data.
Threads Load new page Page is loading Browser still responds to user (can read pages in other tabs)
Unit Testing Tips and Tricks: Database Interaction Louis Thomas.
Web Proxy Server. Proxy Server Introduction Returns status and error messages. Handles http CGI requests. –For more information about CGI please refer.
Struts 2.0 an Overview ( )
Data Access Patterns. Motivation Most software systems require persistent data (i.e. data that persists between program executions). In general, distributing.
Cloud Computing for the Enterprise November 18th, This work is licensed under a Creative Commons.
Irwin/McGraw-Hill Copyright © 2004 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS6th Edition.
Presenter - Donn Felker.  Senior Consultant for Microsoft Gold Certified Partner- Statêra.  8 years of experience in developing and architecting enterprise.
TCP/IP protocols Communication over Internet is mostly TCP/IP (Transmission Control Protocol over Internet Protocol) TCP/IP "stack" is software which allows.
© 2007 IBM Corporation IBM Global Engineering Solutions IBM Blue Gene/P Blue Gene/P Navigator.
Native Support for Web Services  Native Web services access  Enables cross platform interoperability  Reduces middle-tier dependency (no IIS)  Simplifies.
Information Systems Chapter 5 Building the database Part 1. Unsing Access.
Designing classes How to write classes in a way that they are easily understandable, maintainable and reusable 3.0.
Car Rental DB Explained. RHS – Car Rental DB Explained The application demonstrates the Model- View-Controller (MVC) pattern The user can –Add.
ARCH-03: Implementing the OpenEdge™ Reference Architecture – Part 1 John Sadd Progress Fellow and OpenEdge Evangelist.
Architectures Classic Client/Server Architecture Classic Web Architecture N-tier (multi-tier) Architecture FEN Databaser og Modellering.
Chapter 26 GoF Design Patterns. The Adapter Design Pattern.
Test Driven Development Arrange, Act, Assert… Awesome Jason Offutt Software Engineer Central Christian Church
Mark Dixon 1 09 – Java Servlets. Mark Dixon 2 Session Aims & Objectives Aims –To cover a range of web-application design techniques Objectives, by end.
Sample Application Multi Layered Architecture (n-tier): –Graphical User Interface (GUI): Forms, components, controls The Visual Designer in Visual Studio.
3-Tier Web Application Architecture. Simple Log-in public String button1_action() { // TODO: Process the button click action. Return value is a navigation.
Hibernate 3.0. What is Hibernate Hibernate is a free, open source Java package that makes it easy to work with relational databases. Hibernate makes it.
Reporting – Sort Orders, Selections, and Related Data TEC02 Brian Ciccolo.
Swing MVC Application Layering A Layer is a collection of components that Perform similar tasks. Perform similar tasks. Isolate implementation details.
And the PageObject Design Model.  How Selenium Remote Control works  You launch a server on your test machine.  Your tests connect to that server via.
UNICORE Plugins – How to Design Application Specific Interfaces Krzysztof Benedyczak Michał Wroński.
© 2006 Intland Software1 Aron Gombas Architect, Intland Software Extending & customizing CodeBeamer.
1 Java Servlets l Servlets : programs that run within the context of a server, analogous to applets that run within the context of a browser. l Used to.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Spring MVC Essentials Getting started.
Build Robust Web Apps in the Real WakeUpAndCode.com.
Mark Dixon 1 11 – Java Servlets. Mark Dixon 2 Session Aims & Objectives Aims –To cover a range of web-application design techniques Objectives, by end.
Who am I ? What am I doing here? Twitter: Mind-Flip Blog:
JAVA BEANS JSP - Standard Tag Library (JSTL) JAVA Enterprise Edition.
EEL 5937 The Bond Agent System (3) EEL 5937 Multi Agent Systems Lecture 17, March. 4, 2003 Lotzi Bölöni.
ARCH-7: Integrate this! SonicMQ® and the OpenEdge® Reference Architecture Christian Stiller Technical Architect.
Andrew Coates Advanced Windows 10 development with the Office 365 APIs DEV33 5.
Elaboration Iteration 3 – Part 3 - Persistence Framework -
Architecture Multi Layered Architecture (n-tier): Application: Model Controllers Database Access Graphical User Interface (GUI): Forms, components, controls.
ARCH-5: Service Interfaces in Practice Christian Stiller Technical Architect.
CERN – European Organization for Nuclear Research Administrative Information Services AisMonitor 1 IT-AIS-HRMarch 9 th 2006 AisMonitor Giovanni Chierico.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Overview of the Spring Framework Introducing.
Chapter 4 Request and Response. Servlets are controlled by the container.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
START Application Spencer Johnson Jonathan Barella Cohner Marker.
By: Eliav Menachi.  On Android, all application data (including files) are private to that application  Android provides a standard way for an application.
Unit testing of the Services Telerik Software Academy Web Services and Cloud.
Build Robust Web Apps in the Real WakeUpAndCode.com * aka ASP.NET 5 before RC1.
Logical Architecture and UML Package Diagrams. The logical architecture is the large-scale organization of the software classes into packages, subsystems,
The Holmes Platform and Applications
Architecture Patterns Design Patterns
Structure of a web application
MVC Architecture, Symfony Framework for PHP Web Apps
External Services & Frameworks
CMPE 280 Web UI Design and Development October 24 Class Meeting
null, true, and false are also reserved.
Lecture 1: Multi-tier Architecture Overview
ARCH-1: Application Architecture made Simple
Social Media And Global Computing Managing MVC with Custom Models
Focus of the Course Object-Oriented Software Development
IT College 2016, Andres käver
Designing For Testability
Eric Mazzocco, Jake Smith, Ian Anderson
plus content providers, loaders, recyclerview
TN19-TCI: Integration and API management using TIBCO Cloud™ Integration
Plug-In Architecture Pattern
Presentation transcript:

©Alistair Cockburn Alistair Cockburn You Can't Be Agile if Your Architecture's a Mess “Continuous attention to technical excellence and good design enhances agility.” (Agile Manifesto, 2001)

©Alistair Cockburn go to Architecture implement discount = amount * discountRate(amount) amount comes from User and/or Test framework discountRate (amount) from DB and/or in-memory mock Implement the “barn door” Make it simple Prepare to show your code

©Alistair Cockburn Why? Up-down and Left-right maps of architecture miss an important symmetry App User App User Both user and DB are ‘outside’ the application

©Alistair Cockburn Most people implement them ‘inside’ the application User GUI (with some bus.logic) APP business logic DB Boo :-( Can’t regression test Can’t make batch Can’t hook to another program Can’t isolate app when DB breaks

©Alistair Cockburn Put both user and DB outside the application The “Hexagonal” architecture: Separate domain & application from ports & adapters. Domain + Application Port

©Alistair Cockburn Use “adapters” to connect ports to external devices Application Adapter app Adapter

©Alistair Cockburn Typical ports are input, data stores. Typical adapters are test, UI, app-app, DB, mocks Application user-side API app test harness adapter data-side API DB access service mock (in-memory) database (Use case boundary) GUI adapter HTTP adapter app-to-app adapter

©Alistair Cockburn Sample application: Storm Warning System Application trigger data app wire feed test adapter http feed notifications answering machine adapter mock telephone administration database test adapter GUI app-to-app adapter DB mock database http adapter adapter

©Alistair Cockburn Implement Test+Mock first. Add UI & DB later Application test harness user interface mock database database access 1 324

©Alistair Cockburn Sample Implementation [1] Test Adapter with FIT import fit.ColumnFixture; public class TestDiscounter extends ColumnFixture { private Discounter app = new Discounter(); public double amount; public double discountRate() { return app. discountRate(amount); } } Application test harness user interface mock database database access 1324

©Alistair Cockburn Sample Implementation of [2] fake DB Discounter app = new Discounter(); public void actionPerformed(ActionEvent event) {... String amountStr = text1.getText(); double amount = Double.parseDouble(amountStr); discountRate = app.discountRate(amount)); text3.setText( "" + discount ); Application test harness user interface mock database database access 1324

©Alistair Cockburn Sample Implementation of Replaceable Mock/DB... public interface RateRepository { double getRate(double amount); } public class RepositoryFactory { public RepositoryFactory() { super(); } public static RateRepository getMockRateRepository() {return new MockRateRepository(); }} public class MockRateRepository implements RateRepository { public double getRate(double amount) { if(amount <= 100) return 0.01; if(amount <= 1000) return 0.02; return 0.05; } Application test harness user interface mock database database access 1324

©Alistair Cockburn Sample Implementation of Switchable Mock/DB import repository.RepositoryFactory; import repository.RateRepository; public class Discounter { private RateRepository rateRepository; public Discounter(RateRepository r) { super(); rateRepository = r; } public double discount(double amount) { double rate = rateRepository.getRate( amount ); return amount * rate; } import app.Discounter; import fit.ColumnFixture; public class TestDiscounter extends ColumnFixture { private Discounter app = new Discounter(RepositoryFactory.getMockRateRepository()); public double amount; public double discountRate() {return app.discountRate( amount ); } }

©Alistair Cockburn Phil Borland’s ‘Riser’ Entity Framework Based on Apple's Core Data Framework ManagedObjectContext to fetch, delete, save objects. PersistentStore represents a single data store. e.g. SQL data store (MySQL, Postres, etc) & a custom one with mock objects.  Switch them at will and the app runs the same. contact: src: net.sf.riser.examples.documentation with package: net.sf.riser.examples.hexagonal

©Alistair Cockburn Domain Objects public class Discount { private String productName; private double rate; // Getters, setters, constructors, etc } public class Discounter { public static double getDiscount(String productName) { FetchRequest fetchRequest = new FetchRequest(Constants.DISCOUNT); fetchRequest.setPredicate(Predicates. createPredicate("productName=\""+productName+"\” ”)); List discounts = getContext().executeFetchRequest(fetchRequest); if (discounts == null || discounts.size() == 0) { return 0; } else { return ((Discount) discounts.get(0)).getRate(); }

©Alistair Cockburn Mock Store public class MockStore extends AbstractMockStore { public static final String TYPE = "HexagonalMockStore"; public MockStore (PersistentStoreCoordinator coordinator, String configurationName, URL location, Map options) { super(coordinator, configurationName, location, options); } public MockStore(PersistentStoreCoordinator coordinator) { super(coordinator, null, null, null); public void doLoad() { EntityDescription entity = Constants.DISCOUNT; addObject(entity, new Discount("ProductOne",.01)); addObject(entity, new Discount("ProductTwo",.02)); public String getType() { return TYPE; }

©Alistair Cockburn Creating the Context private static ManagedObjectContext createContext(ManagedObjectModel model) { PersistentStoreCoordinator coordinator = new PersistentStoreCoordinator(model); if ("mock".equals(System.getProperty("store"))) { coordinator.addPersistentStore( new MockStore(coordinator)); } else { coordinator.addPersistentStore( new SQLStore(coordinator,createSQLOptions())); } ManagedObjectContext context = new ManagedObjectContext(coordinator); return context; } contact: src at: net.sf.riser.examples.documentation with package: net.sf.riser.examples.hexagonal

©Alistair Cockburn Keep your design clean so you stay able to move. Make the tests the first “user” of your app. Make the first DB a mock, be able to swap them. Application user-side API app test harness adapter data-side API DB access service mock (in-memory) database (Use case boundary) GUI adapter HTTP adapter app-to-app adapter Application test harness user interface mock database database access 1324

©Alistair Cockburn