Vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Object-Oriented Software...

Post on 31-Mar-2015

215 views 0 download

Tags:

Transcript of Vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Object-Oriented Software...

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Object-Oriented Software Engineering

Object-Oriented Software Engineering

Anton Eliëns

Vrije Universiteit, Amsterdam

27 april 1999

http://www.cs.vu.nl/~eliens/cmg/html/oo

http://www.cs.vu.nl/~eliens/online/courses/cmg/oo

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Topics:Topics:

• Basic OO technology• Application Framework(s)• Universal Modeling Language• Design Patterns• Project Management• Current developments and trends

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

IntroductionIntroduction

If

OO

is the Answer,

What is

the Question?

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Keywords and phrasesKeywords and phrases

• the OO lifecycle -- modelling• encapsulation, inheritance, delegation,

polymorphism• specification and implementation inheritance• design by contract• interfaces, components and frameworks• idioms, patterns, software architecture

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Basic OO TechnolologyBasic OO Technolology

Technology determines the effectiveness of the approach

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

ConceptsConcepts

• Encapsulation• Data hiding• Inheritance• Polymorphism

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

EncapsulationEncapsulation

• An object contains data and methods• It provides a boundary:• to the world outside• to its ‘children’

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Information hidingInformation hiding

• Reduces complexity• Allows you to defer implementations• Remember: Ignorance is bliss• Helps in decoupling components

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

InheritanceInheritance

• A mechanism for code-sharing• Supports incremental development• Organize by classification• Allows for abstract interfaces

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

PolymorphismPolymorphism

• An object may have multiple types• An abstract type: when it is used• A concrete type: when it is created• An object’s type is determined by its behavior• An object’s type is determined by the messages

it allows

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Design by ContractDesign by Contract

• formal basis -- pre and post conditions• refinement -- by inheritance or polymorphism• runtime checks -- division of responsibility

see Ch. 3, Contracts

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

The San Francisco Framework

The San Francisco Framework

How useful is an OO framework?

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

•Example - San Francisco Framework

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

A framework is ...A framework is ...

• a collection of components• a generic solution for a class of problems• a frame of mind for solving problems• a set of architectural constraints

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

The San Francisco FrameworkThe San Francisco Framework

• is meant to develop business applications• is based on Java technology• may solve 70% of your problem• leaves 30% (minimum) to solve for you• may set a standard• or may fail to do so ...

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

San Francisco - motivationSan Francisco - motivation

• The project was started when several software vendors asked IBM to help modernizing their application products

• However, there were several barriers preventing them from being able to update their applications

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Barriers to modernizingBarriers to modernizing

• (1) The problem of how to retrain their development staff to effectively use OO technology.

• (2) The risk involved in moving to a new technology.

• (3) moving -> the cost of the change• The software developers realized they needed

some basic infrastructure.• Many companies could not develop this

infrastructure themselves.

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

San Francisco - the pressSan Francisco - the press

• The San Francisco project helps to solve these problems by offering developers Business Process Components,

• designed as frameworks that provides an object oriented infrastructure,

• a consistent application programming model, and

• some default business logic• The frameworks make it easier to move to OO

technology because developers use well-tested services instead of building their own.

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

San Francisco Framework - layersSan Francisco Framework - layers

• Core Business Process Layer - the highest• Common Business Objects Layer - middle• Foundation Layer - lowest

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Core Business ProcessesCore Business Processes

• The objective for this layer is to create a sound architecture and highly extensible OO implementation for the basic structure and behavior which any application provider delivering a solution in the application doamin would require:

• Accounts Receivable/Payable Ledger• General Ledger Framework• Sales Order Management Framework• Purchase Order Management

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Common Business ObjectsCommon Business Objects

• Business Objects common to multiple domains• Common Application level Services• CBO:• Business Partner• Address• Number - decimal structure• Currency - how many euros in a dollar?

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Foundation LayerFoundation Layer

• Foundation Object Model Classes• Utilities

• in other words: it provides the infrastructure• comment: reinventing the wheel is not a big

problem, because the wheel is a terrific invention

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Foundation Object Model ClassesFoundation Object Model Classes

• Command• Entity• Dependent• Collection/Iterator• Factory

• you need to study Design Patterns to appreciate these ...

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Using the San Francisco FrameworkUsing the San Francisco Framework

• … The San Francisco Frameworks are designed to make many types of extensions easy for application dvelopers:

• overriding the default business logic in supplied methods

• adding additional attributes to existing classes• adding additional methods to existing classes

• from the report: Complete documentation will be provided …

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

ExampleExample

• Two classes: Receipt and Purchase order Line• default attributes, methods• default business logic: inspect Quality on receipt• Extension: enhance this logic• subclass Receipt • override inspection method• change logic to include checks against supplier

tables, and hazardous or high value products

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

San Francisco - issuesSan Francisco - issues

• Standards: OMG/CORBA Business Issues• Technology Integration:• Compound Documents: Lotus Notes,

JavaBeans, Active X• Business process Modelling and Control:

workflow engines may be used as glue …• Internet/Intranet and Java: applications may be

designed ….• Conclusions: … a bit premature ...

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Universal Modeling LanguageUniversal Modeling Language

• … why you need models?• Models are necessary to communicate,• to stabilize abstractions• as a reference for the implementation• and maintenance• and you need an agreement on the notation and

formalisms in which you express your models

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Unified Modeling LanguageUnified Modeling Language

• class diagrams -- conceptual structure • use cases -- functional requirements • interaction diagrams -- operational aspects • package and deployment -- implementation • state and activity -- dynamic behavior

• See http://www.rational.com/uml and UML Distilled, [Fowler97].

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

UML - Quick Reference and OverviewUML - Quick Reference and Overview

adapted from the Rational Rose Quick Reference at http://www.rational.com/uml/qr

and Principles of O-O Software Development

Appendix UML

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Class diagramsClass diagrams

• Describe properties of classes• and their (inter) relations

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Interaction diagramInteraction diagram

• To gain an operational intuition• to check calling chains

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Use casesUse cases

• Define the boundary between the system and its uses

• Might be a good subject for a paper ...

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Collaboration diagramsCollaboration diagrams

• To further analyze the relations between classes• augments: class diagram and interaction

diagram

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Visibility propertiesVisibility properties

• More implementation oriented• But remember: ignorance is bliss ...

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Component and Deployment diagramComponent and Deployment diagram

• Primarily for the system architect

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Associations, roles, aggregationsAssociations, roles, aggregations

• You may augment the model to any extent• Personally, I believe in constraints

• See for example: Fowler - Analysis Patterns

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Dynamic object behavior - state transitionsDynamic object behavior - state transitions

• State transition diagrams are rarely used• except in applications that require scheduling:• workflow, simulation, concurrency

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

ExamplesExamples

- interactive drawing tool

- the reactor pattern (events)

- business process modeling

- the observer pattern

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Interactive drawing toolInteractive drawing tool

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Reactor (event-handling) patternReactor (event-handling) pattern

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Reactor - Interaction diagram (events)Reactor - Interaction diagram (events)

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Business process modelingBusiness process modeling

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

(simulation) event state transition diagram(simulation) event state transition diagram

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Observer PatternObserver Pattern

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

A Catalogue of Design patternsA Catalogue of Design patterns

• a common design vocabulary• documentation and learning aid• an adjunct to existing methods• a target for redesign

see the GOF Design Patterns and the Patterns Homepage

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

The Pattern Schema: structureThe Pattern Schema: structure

• Name - handle– increases design vocabulary

• Problem - when to apply– explains the problem and the conflict

• Solution - general arrangement– design, responsibilities, collaborations

• Consequences - trade-off's– to understand the costs and benefit

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Causes for Redesign (1)Causes for Redesign (1)

1. creating an object by specifying a class explicitly -- Abstract Factory, Factory Method, Prototype

2. dependence on specific operations -- Chain of Responsibility, Command

3. dependence on hardware & software platforms -- Abstract Factory, Bridge

4. dependence on object implementation or representation -- Abstract Factory, Bridge, Memento, Proxy

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Causes for Redesign (2)Causes for Redesign (2)

5. algorithm dependence -- Builder, Iterator, Strategy, Template Method, Visitor

6. extending functionality by subclassing -- Bridge, Chain, Composite, Decorator, Observer

7. tight coupling -- Abstract Factory, Bridge, Chain of Responsibilities, Command, Facade, Mediator, Observer

8. inability to alter classes conveniently -- Adaptor, Decorator, Visitor

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Kinds of PatternsKinds of Patterns

• creational patterns -- Factory, Singleton, ...

• structural patterns -- Adaptor, Composite, Bridge, ...

• behavioral patterns -- Mediator, Observer, Command, …

see UML

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Managing O-O ProjectsManaging O-O Projects

Did

YOU

ever

manage

a

project?

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Critical Success FactorsCritical Success Factors

• use incremental scheduling and staging• find and fix failing ideas• develop a habit of delivering• get: sponsor, project manager, technical leader

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Key Failure IndicatorsKey Failure Indicators

• absence of incremental development• use of C++ in commercial IS

see Surviving Object-Oriented Projects: A Managers Guide

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

OO - Success and FailureOO - Success and Failure

• OO = technology + mind-set• it might be new technology to your organisation• developers love it!• requires and enables communication between groups

• adopting OO may succeed or fail!

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Possible benefits - responsivenessPossible benefits - responsiveness

• responsiveness - variations on a theme• responsiveness to change!• time-to-market• communication - developers, users, executives• maintenance, reuse, productivity• GUI development• morale -- cutting-edge technology

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

DrawbacksDrawbacks

• Are YOU underestimating?• productivity takes time• hazards of C++ (and Java, ...)• reuse is difficult• establishing a software process• business-modelling or software design?• CASE helps?• You will pay for: training, experience, tools,

consultants, ...

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

The hazards of C++?The hazards of C++?

• C++ won the language war over Eiffel, Objective-C, SOM, C@+, and Java?

• Java -- relative simplicity and portability

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Managing (the complexity of) C++Managing (the complexity of) C++

• misconception: C++ is like C• consider using another language• Why does C++ exist? - engineering and

systems programming• create a subset of the language• design and coding standards• use people with knowledge!

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Risk-reduction StrategiesRisk-reduction Strategies

• look carefully all around the project• detect the risks!• list the risks in order• work on the risks in order of danger

see Risk Avoidance Patterns

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Technology and TrendsTechnology and Trends

UML

Risks

Java

Frameworks

Contracts

CORBA

Patterns

DOT

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

FrameworksFrameworks

• Frameworks = Components + PatternsRalph Johnson, CACM Nov. 1997

The benefits of frameworks stem from the inversion of control.

A Framework defines an Architecture?

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Software ArchitectureSoftware Architecture

Software Architecture = a set of rules, guidelines, interfaces, and conventions used to define how components and applications communicate and interoperate with each other ...

see patterns

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

CORBACORBA

• the issue is standardisation• by means of interfaces• looking for consensus• this differs from a de-facto standard• imposed by market share ...

see Ch 11: Application integration -- standards

see frameworks

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Java - perspectivesJava - perspectives

• Internet applications• Software Engineering• Language Design• System Development• Computer Science• IT (in) Business• Global Village

Informatie, januari 99: Java - een kwestie van vraag en aanbod

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Dimensions of RisksDimensions of Risks

• Knowledge• Teaming• Productivity• Ownership• Distractions

Don't discuss risks, unless you know how to do Project Management

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

ConclusionsConclusions

• OO offers– a valid metaphor for SE– powerful technology– maturing design methods and notations– a rich set of patterns

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Yet beware ofYet beware of

• the learning curve• simplified hype• cutting edge technology• (over) ambitious projects

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Assignments:Assignments:

• Write a paper about one of the following topics. The paper may discuss concepts or focus on a case study.– The Unified Modelling Language -- UML– Frameworks -- for example San Francisco

• Write a comparative study of object-oriented analysis and design methods, focussing on aspects of project management.

• Describe a case study concerning the deployment of design patterns.

vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie

Course materialCourse material

• Chapter 1• Additional material

– Ch 3: Design by Contract

– Ch 11: Methods and Tools

– Object Tutorials

• Resources– http://www.rational.com -- Rational Rose, UML– http://www.ibm.com/java/sanfrancisco -- IBM Java San Francisco

Framework

• Papers and Reports– http://www.rational.com/uml/html/summary -- UML Summary– http://www.ibm.com/Java/Sanfrancisco/prd_summary.html -- San

Francisco Technical Summary