Introduction. Observation Patterns. Accounting Patterns. How to use Patterns



Similar documents
Patterns in a Nutshell

Recurring Events for Calendars

Dealing with Roles. Martin Fowler.

A methodology for secure software design

Excerpts from Chapter 4, Architectural Modeling -- UML for Mere Mortals by Eric J. Naiburg and Robert A. Maksimchuk

Evaluating OO-CASE tools: OO research meets practice

Encapsulating Crosscutting Concerns in System Software

A Review of an MVC Framework based Software Development

Xtreme RUP. Ne t BJECTIVES. Lightening Up the Rational Unified Process. 2/9/2001 Copyright 2001 Net Objectives 1. Agenda

A Confederation of Patterns for Resource Management

Maturity Assessments of Service- oriented Enterprise Architectures with Iterative Pattern Refinement

Architectural Patterns (3)

Patterns in. Lecture 2 GoF Design Patterns Creational. Sharif University of Technology. Department of Computer Engineering

Chapter 3 Chapter 3 Service-Oriented Computing and SOA Lecture Note

Teaching Software Engineering Through Game Design

Quality Ensuring Development of Software Processes

A MODEL OF HETEROGENEOUS DISTRIBUTED SYSTEM FOR FOREIGN EXCHANGE PORTFOLIO ANALYSIS

The WebShop E-Commerce Framework

From Systems to Services

EMBEDDED SOFTWARE DEVELOPMENT: COMPONENTS AND CONTRACTS

Using MDA in Web Software Architectures

Object-Oriented Design

The WebShop e-commerce framework

DEGREE CURRICULUM SOFTWARE ARCHITECTURES Degree in Computer Engineering. Teaching staff: GIL IRANZO, ROSA MARIA GARCIA GONZALEZ, ROBERTO

CHAPTER 4: PATTERNS AND STYLES IN SOFTWARE ARCHITECTURE

Twin A Design Pattern for Modeling Multiple Inheritance

APLRAC: A PATTERN LANGUAGE FOR DESIGNING AND IMPLEMENTING ROLE-BASED ACCESS CONTROL

A Pattern System for Network Management Interfaces

SOFTWARE ESTIMATING RULES OF THUMB. Version 1 - April 6, 1997 Version 2 June 13, 2003 Version 3 March 20, 2007

Software Refactoring using New Architecture of Java Design Patterns

Organization. Introduction to Software Engineering

ARCHITECTURAL DESIGN OF MODERN WEB APPLICATIONS

The Command Dispatcher Pattern

Research Topics in Software Engineering

Manager-Agent and Remote Operation: Two Key Patterns for Network Management Interfaces

Génie Logiciel et Gestion de Projets. Patterns

Software Development Process

Ontological Representations of Software Patterns

A First Set of Design Patterns for Algorithm Animation

A Process View on Architecture-Based Software Development

SAPM Overview. Semester Summary. Project management. Tools (1) Dr. James A. Bednar

An Analysis Pattern for Invoice Processing Eduardo B. Fernandez 1 and Xiaohong Yuan 2

Section 2.5 Average Rate of Change

IES - Introduction to Software Engineering

Monitor Object. An Object Behavioral Pattern for Concurrent Programming. Douglas C. Schmidt

Name of pattern types 1 Process control patterns 2 Logic architectural patterns 3 Organizational patterns 4 Analytic patterns 5 Design patterns 6

Programming Language Constructs as Basis for Software Architectures

Information systems modelling UML and service description languages

Composing Concerns with a Framework Approach

Chap 1. Introduction to Software Architecture

Software Architecture and Patterns for Electronic Commerce Systems

MANAGEMENT S ROLE 1/16/ Copyright 2001, Net Objectives

A Meeting Room Scheduling Problem

Code Qualities and Coding Practices

Developing Flexible and High-performance Web Servers with Frameworks and Patterns

Applying Design Patterns in Distributing a Genetic Algorithm Application

XXI. Object-Oriented Database Design

Architectural Patterns. Layers: Pattern. Architectural Pattern Examples. Layer 3. Component 3.1. Layer 2. Component 2.1 Component 2.2.

Agile Techniques for Object Databases

Deployment Pattern. Youngsu Son 1,JiwonKim 2, DongukKim 3, Jinho Jang 4

Broker Revisited Michael Kircher, Markus Voelter, Klaus Jank, Christa Schwanninger, Michael Stal

[2006] IEEE. Reprinted, with permission, from [M. Ye and K. Sandrasegaran, Teaching about Firewall Concepts using the inetwork Simulator, Information

9.2 Summation Notation

What are the place values to the left of the decimal point and their associated powers of ten?

An overview to Software Architecture in Intrusion Detection System

TEACHING AGGREGATE PLANNING IN AN OPERATIONS MANAGEMENT COURSE

An Introduction to Software Engineering

Classification of Fuzzy Data in Database Management System

CS 111 Classes I 1. Software Organization View to this point:

Design Patterns. Design patterns are known solutions for common problems. Design patterns give us a system of names and ideas for common problems.

Design Pattern Management System: A Support Tool Based on Design Patterns Applicability

Transcription:

Analysis Martin Fowler fowler@acm acm.org http://ourworld ourworld.compuserve.com/homepages/martin_fowler Page Martin Fowler 9//99 What we will cover Introduction Observation Accounting How to use Page 2 Martin Fowler 9//99

projects fail despite the latest technology for lack of ordinary solutions. Ralph Johnson and Ward Cunningham Gang of Four : Design book Pattern Languages of Programming (PLoP) conferences A pattern is an idea that has been useful in one practical context and will probably be useful in others. [Fowler] http://www.hillside.net/patterns Page 3 Martin Fowler 9//99 Design Pattern: Mediator Mediator Colleague Concrete Colleague Concrete Mediator Concrete Colleague Define an object that encapsulates how a set of objects interact. Gamma, E., Helm, R., Johnson, R. and Vlissides, J. Design : elements of reusable object-oriented software, Addison-Wesley, Reading, MA, 995. www.industriallogic.com/papers/learning.html Page 4 Martin Fowler 9//99 2

David Hay Relational data models Not connected with patterns community, but still patterns Hay, D. Data Model : conventions of thought, Dorset House, New York, NY, 996. Martin Fowler OO conceptual models Healthcare, Accounting, Financial Trading, Planning Fowler, M. Analysis : reusable object models, Addison-Wesley, Reading MA, 997. Analysis Page 5 Martin Fowler 9//99 Notation Each customer may have many orders Each order has a single customer Order Customer placedon : Date dispatch() Priority Order Individual Customer Corporate Customer A customer may be a corporate customer or an individual customer An order may be a priority order Interface not implementation Martin Fowler with Kendall Scott, UML Distilled: Applying the Standard Object Modeling Language, Addison-Wesley 997 Page 6 Martin Fowler 9//99 3

application in 3 tier architecture application 2 domain database application 3 Visibility is from application to domain Domain carries shared services Applications do not see database used in domain tier Page 7 Martin Fowler 9//99 Observation Introduction Observation Accounting How to use Page 8 Martin Fowler 9//99 4

Attributes of Person Person height : Number weight : Number blood glucose level : Number What are the problems with this model? Page 9 Martin Fowler 9//99 Quantity Quantity Person height : Quantity weight : Quantity blood glucose level : Quantity amount: Number units: Unit +, -, *, / <, >, =, <=, >= as(unit) : Quantity tostring() : String valueof(string) : Quantity Define arithmetic operations for quantity Money is a kind of quantity Use Conversion Ratio to convert to other units What if there are tens or hundreds of attributes? Page 0 Martin Fowler 9//99 5

Measurement Martin Fowler is six feet tall Phenomenon Type Person Measurement amountof(phenomenontype) : Quantity amount: Quantity For each attribute of person, define an instance of phenomenon type To record a value for a person create a measurement When should we use this model? Page Martin Fowler 9//99 Observation Phenomenon Phenomenon Type Observation {overlapping} Category Observation Measurement amount: Quantity Person amountof(phenomenontype) : Quantity valueof(phenomenontype) : Phenomenon Martin Fowler is blood group O Martin Fowler is Male Page 2 Martin Fowler 9//99 6

Knowledge and Operational Levels Knowledge Associative Function arguments result Phenomenon Operational Person Observation Category Observation Operational regular day to day objects Knowledge Meta-Data Objects that capture domain rules Page 3 Martin Fowler 9//99 Range Range upper: Magnitude lower: Magnitude isupperinclusive: Boolean islowerinclusive: Boolean includes (Magnitude) : Boolean overlaps (Range) : Boolean abuts (Range) : Boolean Magnitude = < =< > >= Between 0 miles and 50 miles 6m < x 5m Page 4 Martin Fowler 9//99 7

Phenomenon with Range Range Phenomenon {phenomena's ranges should not overlap} Phenomenon Type Normal Heart Rate is 60 80 beats per minute Page 5 Martin Fowler 9//99 Assigning a phenomenon new a Measurement heart rate: Phenomenon Type normal heart rate: Phenomenon fast heart rate: Phenomenon phenomenon = phenomenonincluding(ameasurement) includes (ameasurement) false includes (ameasurement) true fastheartrate setphenomenon(fastheartrate) Page 6 Martin Fowler 9//99 8

Corporate Finance Problem Each month we get a large number of indicators (revenue, income, units sold ) Each indicator is given values for good, reasonable, poor, or bad If revenue is over 05 million that is good, over 95 is reasonable, over 90 is poor and under 90 is bad. Indicators can be calculated based on other indicators Revenue = income - costs Income = units sold * average price Page 7 Martin Fowler 9//99 Measurement Protocol Measurement Measurement Protocol {list} Phenomenon Type Source Measurement Protocol Calculated Measurement Protocol Source Protocols read from external systems Calculated Protocols are calculations Page 8 Martin Fowler 9//99 9

Calculated Measurement Measurement Protocol result type Phenomenon Type Formula Calculated Measurement Protocol argument types {list} Calculated measurement protocol has formula and arguments Revenue = Income - Costs Income = Number sold X Average Price Body Mass Index = weight / height 2 Page 9 Martin Fowler 9//99 Creating a Measurement a Measurement Protocol a Formula create Measurement find arguments execute return quantity new a Measurement Factory method for measurements Page 20 Martin Fowler 9//99 0

Observation Quantity Measurement Observation Range Phenomenon with Range Measurement Protocol Page 2 Martin Fowler 9//99 Accounting Introduction Observation Accounting How to use Page 22 Martin Fowler 9//99

Account Account balance: Money Entry amount: Money whencharged: Timepoint whenbooked: Timepoint {balance = sum(entries)} Entries record history of changes to an account Where might we use this model? Page 23 Martin Fowler 9//99 Transaction Account Entry amount: Money 2.. Transaction {sum(entries.amount) = 0} I withdraw $00 from my checking account The Willenhall Coal Company delivers 30 tons of coal to Bilston Gasworks Why are transactions useful? Page 24 Martin Fowler 9//99 2

Posting Rule (simple) Account trigger output Posting Rule multiplier: Number execute() 5% of state tax is deducted from gross income Page 25 Martin Fowler 9//99 Individual Instance Method Posting Rule calculation Method output trigger Account Income tax is deducted at 5% for first $3,500 28% to $80,750 3% to $30,800 Each instance of posting rule has its own method Conceptual statement Page 26 Martin Fowler 9//99 3

Account Types output Account Type trigger Knowledge Posting Rule Method Operational Employee Account Employee Apply the graduated tax algorithm to the gross pay of Doug and Dinsdale Piranha to yield their net pay. Page 27 Martin Fowler 9//99 Network of Posting Rules 3 hours (Tuesday) raw Overtime: Account Type OT hours PR straight += input if (Sunday) excess += input else excess += input * 0.5 straight OT hours : 3 hours.5 hours Account Type Excess Hours: Account Type Straight OT Payment : Posting Rule out = input * employee.rate Excess Payment: Posting Rule excess = input * employee.otrate * 2/3 premium = input * employee.otrate * /3 $50 Straight Dollars : Account Type Excess Hours: $50 $25 Account Type Premium Hours: Account Type $225 Total Overtime : Summary Account Type Page 28 Martin Fowler 9//99 4

Executing the network a list of Posting Rules a Posting Rule an Employee input Account output Account pay (employee) *[for all elements] run (employee) get account (input account type) get unprocessed entries * [for each entry] execute posting rule post entry Page 29 Martin Fowler 9//99 Procedural Approach H H Process Hours Get straight hours account Dollarize Straight Hours get unprocessed entries [for all entries] Dollarize Excess Hours multiply by rate H post to straight dollars Page 30 Martin Fowler 9//99 5

Changing the Rules H H Process Hours Get straight hours account Dollarize Straight Hours get unprocessed entries [for all entries] Dollarize Excess Hours [before April 5] [on or after April 5] H multiply by rate multiply by rate * 0.9 post to straight dollars Page 3 Martin Fowler 9//99 Adding an effectivity time output Account Type trigger Posting Rule effectivity: Date Range Method Employee Account Employee Add a date range for each posting rule instance Page 32 Martin Fowler 9//99 6

New Behavior a list of Posting Rules a Posting Rule an Employee input Account output Account pay (employee) *[for all elements] run (employee) get account (input account type) get unprocessed entries in (date range) * [for each entry] execute posting rule post entry Page 33 Martin Fowler 9//99 Implementing with singleton State Tax PR state: State {Singleton} CA Tax PR state: State {Singleton} MA Tax PR state: State {Singleton} NY Tax PR state: State What are the strengths and weaknesses? Page 34 Martin Fowler 9//99 7

State Tax PR state: State {abstract} Strategy Pattern Calculation Strategy «Method» return strategy. {Singleton} CA Tax {Singleton} MA Tax {Singleton} NY Tax What are the strengths and weaknesses? Page 35 Martin Fowler 9//99 Parameterized Method State Tax PR state: State rate: Number «Method» multiply by rate What are the strengths and weaknesses? Page 36 Martin Fowler 9//99 8

Combining Implementations State Tax PR state: State {Singleton} CA Tax PR Multiplier PR rate: Number {Singleton} NYTax PR Combination of singleton and parameterized approaches Page 37 Martin Fowler 9//99 Posting Rule Execution Eager firing Fire when entry added to account Find all posting rules looking at that account and fire them (etc, etc) Posting rule based Have a coordinator which tells posting rules when to fire Account based based Have a coordinator tell which accounts when to fire their outbound posting rules Backward Chained When you ask an account for its balance All input accounts must be asked for value (etc, etc) Which would you choose? Page 38 Martin Fowler 9//99 9

Accounting Account Transaction Posting Rule Individual Instance Method Posting Rule Execution Posting Rules for Many Accounts Accounting Practice Page 39 Martin Fowler 9//99 How to use Introduction Observation Accounting How to use Page 40 Martin Fowler 9//99 20

Using Starting point for development Inspiration to get things going Comparison for review Why are we different to this pattern? Documentation of complex frameworks Highlight the key patterns Informal standardization Mining from legacy systems Training The next step after basic training The why is at least as important as the what Page 4 Martin Fowler 9//99 Learning about Read the books Use a book group Discuss two chapters a week over lunch Take a training course Training must emphasize using patterns Instructors expertise is central Try using the patterns You cannot understand a pattern till you have tried it Trying a pattern and finding it does not fit is valuable Write some patterns http://www.hillside.net/patterns Page 42 Martin Fowler 9//99 2

Books Beck, K. Smalltalk Best Practice. Volume : Coding, Prentice Hall, Englewood Cliffs, NJ, 997. Buschmann, F., Meunier, R., Rohnert, H., Sommerlad, P. and Stal., M. Pattern-Oriented Software Architecture - A System of, John Wiley, 996. Coad, P., North, D. and Mayfield, M. Object Models: strategies, patterns and applications, Prentice Hall, Englewood Cliffs, 995. Coplien, J.O. and Schmidt, D.C. Pattern Languages of Program Design, Addison-Wesley, Reading, MA, 995. Gamma, E., Helm, R., Johnson, R. and Vlissides, J. Design : elements of reusable object-oriented software, Addison-Wesley, Reading, MA, 995. Fowler, M. Analysis, Addison-Wesley, Reading MA, 997 Hay, D. Data Model : conventions of thought, Dorset House, New York, NY, 996. Vlissides, J.M., Coplien, J.O. and Kerth, N.L. ed.pattern Languages of Program Design 2, Addison-Wesley, 996. http://www.hillside.net/patterns Page 43 Martin Fowler 9//99 Final Thoughts are relevant for all aspects of software engineering and for Business Process Reengineering Analysis patterns can be used across traditional vertical business domains A model is not right or wrong, only more or less useful are a starting point, not a final destination Still learning about teaching, using, and discovering patterns Page 44 Martin Fowler 9//99 22