software architectures + design: jsp/jsdadrion/520-f03/pdf-links/18-arch-fw-pat … · design...
TRANSCRIPT
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 1
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
18- Architecture, Frameworks,Components, Patterns, Middleware + Design: JSP/JSD
Rick Adrion
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Software Architectures
ß Architectural taxonomy (“boxology”)ß Architectural patterns & idiomsß Design patterns & idiomsß Reuseß Class librariesß Componentsß Frameworksß Middleware
RequirementsRequirements
DetailedDesign
DetailedDesign
High-levelDesign
High-levelDesign
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Architectural taxonomy (“boxology”)ß dataflow
ß batch sequentialß data flow networkß pipes & filter
ß call/returnß main program/subroutinesß abstract data typesß objectsß call based client/serverß layered
ß independent componentsß communicating processesß distributedß event systems (implicit, explicit)
ß virtual machineß interpreterß rule-based
ß data-centeredß repositoryß blackboard
can decompose into sequential stagesinvolves transformations on continuous
(or on very long streams) streams ofdata
flexibility, configurability, loose couplinghierarchies, producer-consumer, tightly
connected
cross-platformlate decision on hardware
focus on management and representationof data
long-lived (persistent) data is focus onrepositories
stream of incoming requests to accesshighly structured data
changing data “noisy” input data, uncertain execution
order can not be predetermined,consider a blackboard
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Active Object, Bridge,Proxy, WrapperFaçade, & Visitor
Capture the static & dynamic roles &relationships in solutions that occurrepeatedly
Design patterns
Half-Sync/Half-Async,Layers, Proactor,Publisher-Subscriber,& Reactor
Express a fundamental structuralorganization for software systems thatprovide a set of predefined subsystems,specify their relationships, & include therules and guidelines for organizing therelationships between them
Architecturalpatterns
Optimize for commoncase, passinformation betweenlayers
Document rules for avoiding commondesign & implementation mistakes thatdegrade performance
Optimizationprinciple patterns
Scoped lockingRestricted to a particular language, system,or tool
Idioms
ExamplesDescriptionType
Taxonomy of Patterns & Idioms
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 2
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
designview
deploymentview
processview
implementationview
Use -CaseView
Use cases
Components
Classes, interfaces,collaborations
Active classes Nodes
OrganizationPackage, subsystem
DynamicsInteraction
State machine
The Rational 4+1 Views
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
The Rational 4+1 Views
Use cases, Scenarios (sequence diagrams)
Design:class & collaborationdiagrams
Process:class &
statechartdiagrams
Implementation:componentdiagrams
Deployment:deployment
diagrams
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Architecture Description Languages
ßformal notations for representing and analyzingarchitectural designs
ßprovide both a conceptual framework and a concretesyntax for characterizing software architectures
ßtools for parsing, displaying, compiling, analyzing, orsimulating architectural descriptions.
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
ADL Examplesß Adageß supports the description of architectural frameworks for avionics navigation
and guidanceß Aesopß supports the use of architectural styles
ß C2ß supports the description of user interface systems using anevent-based style
ß Darwinß supports the analysis of distributed message-passing systems
ßMeta-Hß provides guidance for designers of real-time avionics control software;
ß Rapideß allows architectural designs to be simulated, and has tools for analyzing the
results of those simulations;ß SADLß provides a formal basis for architectural refinement;
ß UniConß has a high-level compiler for architectural designs that supports a mixture of
heterogeneous component and connector types;ßWrightß supports the formal specification and analysis of interactions between
architectural components.
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 3
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
formal architectural specification.
ßmodule interconnection languagesßstatic aspects of component interactionßdefinition and use of types, variables, and functions amongcomponentsßexamples: INTERCOL, PIC, CORBA/IDL
ßprocess algebrasßdynamic interplay among componentsßconcerned with the protocols by which componentscommunicateßexamples: Wright (based on CSP), Chemical AbstractMachine (based on term rewriting)
ßevent languagesß identification and ordering of eventsßevent is a very flexible, abstract notionßexample: Rapide
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Evaluation & analysis
ßconduct a formal review with external reviewersßtime the evaluation to best advantageßchoose an appropriate evaluation techniqueßcreate an evaluation contractßlimit the number of qualities to be evaluatedßinsist on a system architectßbenefitsßfinancialßincreased understanding and documentation of thesystemßdetection of problems with the existing architectureßclarification and prioritization of requirementsßorganizational learning
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Benefits
ßexamplesßAT&Tß10% reduction in project costs, on projects of 700 staff daysor longer, the evaluation pays for itself.
ßconsultantsßreported 80% repeat business, customers recognizedsufficientvalue
ßwhere architecture reviews did not occurßcustomer accounting system estimated to take two years,took seven years, re-implemented three times, performancegoals never met
ß large engineering relational database system, performancemade integration testing impossible, project was cancelledafter twenty million dollars had been spent.
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Architecture vs FrameworksßFrameworksßan object-oriented reuse techniqueßused successfully for some time & are an importantpart of the culture of long-time object-orienteddevelopers,ßBUT they are not well understood outside theobject-oriented community and are often misused
ßQuestion:ßare frameworks mini-architectures, large-scalepatterns, or they are just another kind ofcomponent?
ßDefinitionsßa framework is a reusable design of all or part of asystem that is represented by a set of abstractclasses and the way their instances interactßa framework is the skeleton of an application thatcan be customized by an application developer
Ralph E. Johnson, “Frameworks= (Components+Patterns).”Communications of the ACM, October 1997/Vol. 40, No. 10
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 4
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Frameworks & Class Libraries
ßdevelopers often do not even know they are using aframework, but refer to a “class library”
ßframeworks differ from other class libraries by reusinghigh-level designßmore to learn before a class can be reused
ßcan never be reused in isolation; typically a set ofclasses must be learned at once
ßyou can often tell that a class library is a framework ifthere are dependencies among its components and ifprogrammers who are learning it complain about itscomplexity.
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Framework Architecture
Class Library Architecture
ADTs
Strings
LocksIPC
Math
LOCAL INVOCATIONS APPLICATION-
SPECIFICFUNCTIONALITY
GLUECODE
Files
GUIEVENTLOOP
Frameworks & Class Libraries
ßA class is a unit of abstraction& implementation in an OOprogramming language
ßA framework is an integratedset of abstract classes thatcan be customized forinstances of a family ofapplications
Adapted from Douglas C. Schmidt, “Patterns, Frameworks, & Middleware: Their Synergistic Relationships”
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Components & frameworks
ßFrameworksßwere originally intended to be reusablecomponentsßbut reusable O-O components have not found amarket
ßare a component in the sense thatßvenders sell them as productsßan application might use several frameworks.
ßBUTßthey more customizable than most componentsßhave more complex interfacesßmust be learned before the framework can be used
ßa component represents code reuse, whileframeworks are a form of design reuse
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Components & frameworksßframeworksßprovide a reusable context for componentsßprovide a standard way for components to handleerrors, to exchange data, and to invoke operationson each otherß“component systems’’ such as OLE, OpenDoc, and Beans,are really frameworks that solve standard problems thatarise in building compound documents and other compositeobjects. make it easier to develop new components
ßenable making a new component (such as a userinterface) out of smaller components (such as awidget)ßprovide the specifications for new components anda template for implementing them.
ßa good framework can reduce the amount ofeffort to develop customized applications by anorder of magnitude
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 5
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Middleware Bus
Component Architecture
Naming
LockingLogging
Events
Framework Architecture
ADTs
Locks
Strings
Files
INVOKES
Reactor
GUI
DATABASE
NETWORKING
APPLICATION-SPECIFICFUNCTIONALITY CALLBACKS
Frameworks & Components
ßA framework is an integratedset of abstract classes thatcan be customized forinstances of a family ofapplications
ßA component is anencapsulation unit with oneor more interfaces thatprovide clients with access toits services
Adapted from Douglas C. Schmidt, “Patterns, Frameworks, & Middleware: Their Synergistic Relationships”
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Comparison
Class Libraries FrameworksMacro-levelMeso-levelMicro-level
Borrow caller’s threadInversion ofcontrol
Borrow caller’sthread
Domain-specific or
Domain-independent
Domain-specificDomain-independent
Stand-alonecomposition entities
“Semi-complete”applications
Stand-alonelanguage entities
Components
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Frameworks as Reusable Design
ßAre they like other techniques for reusing high-leveldesign, e.g., templates or schemas?ßtemplates or schemasßusually depend on a special purpose design notationßrequire special software toolsßframeworksßare expressed in a programming languageßmakes them easier for programmers to learn and toapplyßno tools except compilersßcan gradually change an application into a frameworkßbecause they are specific to a programming language,some design ideas, such as behavioral constraints,cannot be expressed well
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Frameworksand domain-specific architectures
ßA framework is ultimately an object-oriented design, while adomain-specific architecture might not be.
ßA framework can be combined with a domain-specificlanguage by translating programs in the language into a setof objects in a frameworkßwindow builders associated with GUI frameworks areexamples of domain-specific visual programming languages
ßUniformity reduces the cost of maintenance
ßGUI frameworks give a set of applications a similar look andfeel
ßusing a distributed object framework ensures that allapplications can communicate with each other.
ßmaintenance programmers can move from one application tothe next without having to learn a new design
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 6
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Overview of Patterns
ßPatternsßpresent solutions to common software problemsarising within a certain context
ßhelp resolve key software design issuesßFlexibility, Extensibility, Dependability, Predictability,Scalability,Efficiency
ßcapture recurring structures & dynamics amongsoftware participants to facilitate reuse ofsuccessful designs
ßcodify expert knowledge of design strategies,constraints and best practices
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
software patterns
ßrecord experience of good designersßdescribe general, recurring design structures in apattern-like formatßproblem, generic solution, usageßsolutions (mostly) in terms of O-O modelsßcrc-cards; object-, event-, state diagramsßoften not O-O specificßpatterns are generic solutions; they allow for design andimplementation variationsßthe solution structure of a pattern must be “adapted” toyour problem designßmap to existing or new classes, methods, ...ßa pattern is not a concrete reusable piece of software!
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
qualities of a pattern
ßencapsulation and abstractionßeach pattern encapsulates a well-defined problem and itssolution in a particular domainßserve as abstractions which embody domain knowledge andexperience
ßopenness and variabilityßopen for extension or parametrization by other patterns so thatthey may work together
ßgenerativity and composabilityßgenerates a resulting context which matches the initial contextof one or more other patterns in a pattern languageßapplying one pattern provides a context for the application ofthe next pattern.
ßequilibriumßbalance among its forces and constraints
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Active Object, Bridge,Proxy, WrapperFaçade, & Visitor
Capture the static & dynamic roles &relationships in solutions that occurrepeatedly
Design patterns
Half-Sync/Half-Async,Layers, Proactor,Publisher-Subscriber,& Reactor
Express a fundamental structuralorganization for software systems thatprovide a set of predefined subsystems,specify their relationships, & include therules and guidelines for organizing therelationships between them
Architecturalpatterns
Optimize for commoncase, passinformation betweenlayers
Document rules for avoiding commondesign & implementation mistakes thatdegrade performance
Optimizationprinciple patterns
Scoped lockingRestricted to a particular language, system,or tool
Idioms
ExamplesDescriptionType
Taxonomy of Patterns & Idioms
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 7
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Frameworks and Patterns
ßframeworks represent a kind of patternße.g., Model/View/Controller is a user-interface frameworkoften described as a patternßapplications that use frameworks must conform to theframeworks’ design and model of collaboration, so theframework causes patterns in the applications that use it.
ßframeworks are at a different level of abstraction thanpatternsßframeworks can be embodied in code, but only examplesof patterns can be embodied in code.ßa strength of frameworks is that they can be written downin programming languages and not only studied butexecuted and reused directlyßin contrast, design patterns have to be implemented eachtime they are used.
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Frameworks and Patterns
ßdesign patterns are smaller architectural elements than frameworksßa typical framework contains several design patterns but the reverse
is never trueßdesign patterns are the micro-architectural elements of frameworks.ß e.g., Model/View/Controller can be decomposed into three major design
patterns, and several less important onesßMVC uses the Observer pattern to ensure the view’s picture of the model is
up-to-date, the Composite pattern to nest views, and the Strategy patternto cause views to delegate responsibility for handling user events to theircontroller.
ßdesign patterns are less specialized than frameworks.ß frameworks always have a particular application domain.ßdesign patterns can be used in nearly any kind of application.ßmore specialized design patterns are certainly possible, even these
wouldn't dictate an application architecture
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Frameworks
ßare firmly in the middle of reuse techniques.
ßare more abstract and flexible than components,
ßare more concrete and easier to reuse than a puredesign (but less flexible and less likely to be applicable)
ßare more like techniques that reuse both design andcode, such as application generators and templates.
ßcan be thought of as a more concrete form of a patternßpatterns are illustrated by programs, but a framework isa program
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Application-specific functionality
Framework Characteristics
ßFrameworks exhibit“inversion of control” atruntime via callbacks
ßFrameworks provideintegrated domain-specific structures &functionality
ßFrameworks are “semi-complete” applications
Networking DatabaseGUI
MissionComputing
ScientificVisualizationE-commerce
Adapted from Douglas C. Schmidt, “Patterns, Frameworks, & Middleware: Their Synergistic Relationships”
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 8
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Using Frameworks Effectively
ßFrameworks are powerful, but hard to develop & useeffectively by application developersßIt’s often better to use & customize COTS frameworksthan to develop in-house frameworksßComponents are easier for application developers touse, but aren’t as powerful or flexible as frameworksßSuccessful projects are often organized using the“funnel” model
Adapted from Douglas C. Schmidt, “Patterns, Frameworks, & Middleware: Their Synergistic Relationships”
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Relation to Middleware
ßone of the strengths of frameworks is that they arerepresented by traditional object-oriented programminglanguages.ßBUT, this is also a weakness of frameworks, however,and it is one that the other design-oriented reusetechniques do not share.ßMiddlewareßCOM, CORBA, etc. address this problem, since they letprograms in one language interoperate with programs inanother
ßOther approachesßsome frameworks have been implemented twice so thatusers of two different languages can use them, such asthe SEMATECH CIM framework
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Hardware
Domain-SpecificServices
CommonMiddleware Services
DistributionMiddleware
Host InfrastructureMiddleware
Operating Systems& Protocols
Applications
Evolution of Middleware
ßHistorically, mission-critical apps werebuilt directly atop hardware & OSßtedious, error-prone, & costly overlifecycles
ßThere are layers of middleware, just likethere are layers of networking protocolsßStandards-based COTS middleware
helps:ßControl end-to-end resources & QoSßLeverage hardware & softwaretechnology advancesßEvolve to new environments &requirementsßProvide a wide array of reuseable, off-the-shelf developer-oriented services
Adapted from Douglas C. Schmidt, “Patterns, Frameworks, & Middleware: Their Synergistic Relationships”
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Middleware
ß Infrastructure middleware.ßencapsulates core OS communication and concurrency services to
eliminate many tedious, error-prone, and non-portable aspects ofdeveloping and maintaining distributed applications using low-levelnetwork programming mechanisms, such as socketsßExamples: the Java Virtual Machine (JVM) and the ADAPTIVE
Communication Environment (ACE).ßDistribution middlewareßbuilds upon the lower-level infrastructure middleware to automate
common network programming tasks, such as parametermarshaling/demarshaling, socket and request demultiplexing, andfault detection/recoveryßExamples: Object Management Group's (OMG's) Common Object
Request Broker Architecture (CORBA), Microsoft's Distributed COM(DCOM), and JavaSoft's Remote Method Invocation (RMI).
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 9
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Middleware
ß Common middleware servicesß augments the distribution middleware by defining domain-independent
services, such as event notifications, logging, multimedia streaming,persistence, security, transactions, fault tolerance, and distributedconcurrency control
ß applications can reuse these services to perform common distribution tasksthat would otherwise be implemented manually.
ß Domain-specific Servicesß tailored to the requirements of particular domains, such as
telecommunications, e-commerce, health-care, or process automation
ß are generally reusable, and thus are the least mature of the middleware layerstoday
ß embody domain-specific knowledge, however, they have the most potential toincrease system quality and decrease the cycle-time and effort required todevelop particular types of networked applications
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Progress
ßsignificant progress in QoS-enabled middleware,stemming in large part fromthe following trends:ßyears of iteration,refinement, & successfuluseßmaturation of middlewarestandardsß .NET, J2EE, CCMßReal-time CORBAßReal-time JavaßSOAP & Web Services
ßmaturation of componentmiddleware frameworks &patterns
Year1970 2005
ARPAnet
RPC
Micro-kernels
CORBA & DCOM
Real-timeCORBA
Component Models (EJB)
CORBA ComponentModel (CCM)
Real-time CCM
DCE
Web Services
Adapted from Douglas C. Schmidt, “Patterns, Frameworks, & Middleware: Their Synergistic Relationships”
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
JSP & JSD
ßJackson System DevelopmentßEmphasis on high-level conceptual design
ßDevelops collection of coordinated graphicaldepictions of system
ßStrong hints about how to carry them toimplementation decisions
ßStrong suggestions about how to go aboutdoing this
ßJackson Structured ProgrammingßJSD Based on/uses JSP, so let’s look at thatfirst
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
JSP
ßDesign is about structure, about the relation of parts tothe whole.
ß Programs consist of the following parts or components:ßelementary components
ßthree types of composite components -- componentshaving one or more parts:ßsequence -- a sequence is a composite component thathas two or more parts occurring once each, in order.
ßselection -- a composite component that consists of two ormore parts, only one of which is selected, once.
ßiteration a composite component that consists of one partthat repeats zero or more times.
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 10
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
composite components
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Basic program design method (JSP)
ßsystem diagram
ßinput/output structure diagrams
ßprogram structure diagram
ßallocation of operations to program structureßwhich part? how many times?
ß"read-ahead rule"
ßconstructive method of designßnot top-down, not stepwise refinement
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
JSP design method
ßconsists of the following steps:1. Draw a system diagram
2. Draw a data structure for each input and output file
3. Draw a single data structure based oncorrespondences between the input and outputdata structures; this data structure forms the basicprogram structure
4. List the operations needed by the program, Foreach, ask "Where does it belong (in what programpart?)" "How many times does it occur?" Allocatethe operations to the basic program structure.
5. Translate the program structure into text, specifyingthe conditions for iteration and selection
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
multiplication table example
ß The required output is:
1
2 4
3 6 9
4 8 12 16
... ... ... ...
10 20 30 40 50 60 70 80 90 100
1. Draw system diagram
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 11
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
multiplication table example
2. Draw data structures 3. Form program structurebased on the datastructures from theprevious step.
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
multiplication table example
4. List and allocate operationsß elementary operations needed to perform the task,
and for each operationß "How often is it executed?"
ß "In what program component(s) does it belong?”
ß The operations must be elementary statements ofsome programming language; e.g., Pascal.
operation how often? where?1 row-no := 1; once at start of program2 col-no := 1; once per line in part that produces a
line, at start3 row-no := row-no + 1; 9 times in part that produces a
line4 col-no := col-no + 1; (row-no)-1 per
linein part that computes anelement
5 line[col_no] := row_no*col_no once per element in part that computes anelement
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
multiplication table example
5. Code program from structure diagram or structure text
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Difficulties in applying JSP
ßThe development procedures of a method should be closelymatched to specific properties of the problems it can be used tosolveßbasic JSP requires the problem to possess at least these two
properties:ß the data structures of the input and output files, and the
correspondences among their data components, are such that asingle program structure can embody them allßeach input file can be unambiguously parsed by looking ahead just
one record
ß If the file structures do not correspond appropriately it is impossibleto design a correct program structure: this difficulty is called astructure clashß If an input file can not be parsed by single look ahead it is
impossible to write all the necessary conditions on the program’siterations and selections: this is a recognition difficulty
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 12
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Structure Clashes
ß three kinds of structure clashß interleaving clashß data groups that occur sequentially in one structure correspond
functionally to groups that are interleaved in another structureß e.g., the input file of a program may consist of chronologically ordered
records of calls made at a telephone exchange; the program must producea printed output report of the same calls arranged chronologically withinsubscriber. The ‘subscriber groups’ that occur successively in the printedreport are interleaved in the input file
ßordering clashß corresponding data item instances are differently ordered in two structuresß e.g., an input file contains the elements of a matrix in row order, and the
required output file contains the same elements in column order.ßboundary clash,ß two structures have corresponding elements occurring in the same order,
but the elements are differently grouped in the two structures; theboundaries of the two groupings are not synchronized.
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Boundary clashes
ßare surprisingly commonß three well-known examples:ßThe calendar consists of years, each year consisting of a number of
days. In one structure the days may be grouped by months, but byweeks in another structure. There is a boundary clash here: theweeks and months can not be synchronized.ßA chapter of a printed book consists of text lines. In one structure the
lines may be grouped by paragraphs, but in another structure bypages. There is a boundary clash because pages and paragraphscan not be synchronized.ßA file in a low-level file handling system consists of variable-length
records, each consisting of between 2 and 2000 bytes. The recordsmust be stored sequentially in fixed blocks of 512 bytes. There is aboundary clash here: the boundaries ofthe records can not besynchronized with the boundaries of the blocks
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Program decomposition
ßExample of a “structure clash”ßan inventory transaction file consists of dailytransactions sorted by part number
ßeach part number may have one or more transactionsßeither a receipt into the warehouse or an order out of thewarehouse
ßeach transaction contains a transaction code, a part-identifier, and a quantity received or ordered
ßA program is to be written that prints a line for each partnumber showing the net daily movement for that partnumber into or out of the warehouseßAssumption: the input file is blocked, with each blockcontaining a record count followed by a number of records
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Report generation
1. Draw system diagram
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 13
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Report generation example
2. Draw data structures
1. Draw new system diagram
Structuresdon’t match“boundary”
clash
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Report generation example
ß Program PA consumes the input file of blocks of recordsand produces an unblocked file of transactions. ProgramPB consumes the groups of unblocked transaction recordsand produces the required report.
2. Draw data structures
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Resolution of the structure clash
ßdecomposing the program P intotwo programs, PA and PB asshown below:
ßImplementationß Batch processing: PA producesthe serial data stream, I, which isthen processed by program PB.ßParallel processing: cooperatingprograms or coroutines or asindependent tasks under controlof a multi-programming tasksupervisor
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Program Inversion
ßsolution of a structure clash more cheaply thanemploying Multi-programmingß convert one program that it runs as a subroutine of theother
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 14
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Uses of program inversion
ßInteractive conversational programs
ßInterrupt handler
ßImplementation of pipes & filters and hierarchicalnetworks
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Significance of Inversion
ßmany situations appearing in their dynamic, piecemealexecutable form can be recast in their underlying serial form asa simple programßany resumable program--one that is alternately activated andsuspended--is an example of inversion
ßwhat is the underlying seriality of its input and output?ßcan recast the problem in serial form, and design a simpleprogram using JSP
ßcan optimize the design using inversion
ß inversion preserves program correctness--it is an algorithmictransformation--we can be confident about the design of theinverted (resumable) program
ß inversion allows us to extend the range of JSP to manysituations that at first glance do not appear to be amenable to it
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Recognition Difficulties
ßA recognition difficulty is present when an input file cannot be unambiguously parsed by single look-aheadßsometimes the difficulty can be overcome by lookingahead two or more records
ßsometimes a more powerful technique is necessary
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Backtracking technique
1. the recognition difficulty is simply ignored. The program is designed, andthe text for the AGroup and BGroup components is written, as usual. Nocondition is written on the Group selection component. The presence ofthe difficulty is marked only by using the keywords posit and admit inplace of if and else.
2. a quit statement is inserted into the text of the posit AGroup componentat each point at which it may be detected that the Group is, in fact, not anAGroup. In this example, the only such point is when the B record isencountered. The quit statement is a tightly constrained form of GO TO:its meaning is that execution of the AGroup component is abandonedand control jumps to the beginning of the admit BGroup component.
3. the program text is modified to take account of side-effects: that is, of theside-effects of operations executed in AGroup before detecting that theGroup was in fact a BGroup.
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 15
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Central virtues of JSPß it provides a strongly systematic and prescriptive method for a clearly
defined class of problemß independent JSP designers working on the same problem produce the same
solutionß JSP keeps the program designer firmly in the world of static structures to
the greatest extent possible.ß only in the last step of the backtracking technique, when dealing with side-
effects, is the JSP designer encouraged to consider the dynamic behavior ofthe programß this restriction to designing in terms of static structures is a decisive
contribution to program correctness for those problems to which JSP can beappliedß avoids the dynamic thinking -- the mental stepping through the program
execution -- that has always proved so seductive and so fruitful a source oferror.
ß HintsßDon't optimize!!If you have to, do it as the last step, after you have designed
the program properly.ßUse Models not functions
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Jackson System Development (JSD)
ßEmphasis on high-level conceptual design
ßDevelops collection of coordinated graphical depictionsof system
ßStrong hints about how to carry them to implementationdecisions
ßStrong suggestions about how to go about doing this
ßConsiderable literature delving into the details of JSD
ßProduct of a commercial company
ßSupported by courses, tools, consultants
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
JSD Models Focus on Actions
ßJSD produces models of the real world and the way inwhich the system to be built interacts with itßPrimary focus of this is actions (or events)ßactions can have descriptive attributesßset of actions must be organized into set of processesßProcesses describe which actions must be groupedtogether and what the "legal" sequences of actions areßProcesses can overlap in various waysßProcesses are aggregated into an overall system modelßusing two canonical models of inter-processcommunication
ßData are described in the context of actionsßin JSD data considerations are subordinate to actions
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
JSD - Phases
ßthe modeling phaseßEntity/action step
ßEntity structure step
ßModel process step
ßthe network phaseßconnect model processes and functions in a singlesystem specification diagram (SSD)
ßimplementation phaseßexamine the timing constraints of the system
ßconsider possible hardware and software forimplementing our system
ßdesign a system implementation diagram (SID)
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 16
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Student Loan Exampleß Functional requirements:ß before getting a loan, there is an evaluation process after which agreement is
always reachedß a TE transaction records each step of the evaluation processß a TA transaction records the overall loan agreement
ß a student can take any number of loans, but only one can be active at anytimeß each loan is initiated by a TI transaction
ß the student repays the loan with a series of repaymentß each repayment transaction is recorded by a TR transaction
ß a loan is terminated by a TT transaction.ß two output functions are desired:ß an inquiry function that prints out the loan balance for any student,ß a repayment acknowledgment sent to each student after payment is received by the
universityß Non Functional requirementsß to be implemented on a single processorß inquiries should be processed as soon as they are receivedß repayment acknowledgments need only be processed at the end of each day.ßNote: generates a stream of data over a long-period of time
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Step 1: Entity/action step
ßActions have the following characteristics:ßan action takes place at a point in time
ßan action must take place in the real world outside of thesystem.
ßan action is atomic, cannot be divided into subactions.
ßEntities have the following characteristics:ßan entity performs or suffers actions in time.
ßan entity must exist in the real world, and not be aconstruct of a system that models the real world
ßan entity must be capable of being regarded as anindividual; and, if there are many entities of the sametype, of being uniquely named.
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Candidatesß Entities/Description:ß studentß systemß universityß loanß student-loan
ß Actions/Attributes:ß evaluate -action of university? (university performs the evaluation); action of
student? (student is evaluated)ß attributes: student-id, loan-no, date of evaluation, remarks
ß agree - action of university? (university agrees to loan); action of student ?(agrees to loan)ß attributes: student-id, loan-no, date of agreement, amount of loan, interest rate,
repayment period)ßmake loan - action of universityß attributes: student-id, loan-no, date of loan, loan amount, interest rate, repayment
periodß initiate - action of university? (university initiates loan); action of student?
(student initiates loan); action of loan? (is initiated)ß attributes: student-id, date initiated
ß repay - action of loan? (loan is repaid); action of student? (student repays theloan);ß attributes: student-id, date of repayment, amount of repayment
ß terminate - action of loan (loan is terminated);ß attributes: student-id, date of termination, remarks
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Focus on:
ßEntities/Description:ßstudent
ßActions/Attributes:ßevaluate -action of student; student? (student suffers theaction, is evaluated);ßattributes: student-id, loan-no, date of evaluation, remarks
ßagree - action of studentßattributes: student-id, loan-no, date of agreement, amount of loan,
interest rate, repayment period)
ß initiate - action of studentßattributes: student-id, date initiated
ßrepay - action of studentßattributes: student-id, date of repayment, amount of repayment
ßterminate - action of studentßattributes: student-id, date of termination, remarks
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 17
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Step 2: Entity structure step
(1) evaluation part- zero or more evaluate actions
(2) student agrees to loan(3) loan(s) is (are) made
- zero or more loans.- loan is a sequence of initiateaction, iteration of repay actions, aterminate action
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Model Process
ßPrimary building block of a JSD designßcontains all actions characterizing a key real-worldprocess
ßActions are structured into a treeßonly the leaf nodes of the tree are real-world actions
ßinterior nodes are conceptual
ßinterior nodes can be annotated to show choice oriteration
ßtraversals of this tree constitute the only "legal"sequences of actions for this process
ßModel process tree defines a regular expressionßset of traversals is a regular set
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Model Processes
ßA model process is a particular view of the systemßvarious model processes provide different views
ßmodel process is multiply instantiated for different instances
ßmodel processes are often annotated with informalspecifications and notations
ßsame action may appear as part of more than one process
ßModel Processes and Data
ßactions on data hang off of model process leaf nodes
ßglobal data is necessary tooß for functions that must combine data from >1 model process
ß to assure consistency between model processes
ß to coordinate between different instances of the same modelprocess
ß to coordinate between different models of the same entity
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Step 3: Model process step
abstract student entity in the real world
realization in theInformation system
entity structure diagram describes the structure of
the serial data stream
Use JSP to create aprogram for the process
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 18
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Error handling
ßa real-time system (but slow-running)systemß information is collected as it arrives
from the real-worldßentity model process is synchronized
with the actions of the real world entityß the state vector of a model process's
“program” has a “counter” … and if it“points” to repay component of astudent's process, then an 'E'(evaluate), 'A' (agree) or 'I' (initiate)transaction must be recognized as anerror
counter
state vector (SV) connection -- one process can examine the SV of a 2nd process -- the double lines indicate that an inquiry process, over its life, will examine many student processes
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Total System Model
ßAt the Network Phase, weave Model Processestogether incrementally to form the total systemspecificationßalso add new processes during this phase: e.g., input,output, user interface, data collection
ßGoal is to indicate how model processes communicatewith each other, use each other, are connected to userand outside worldßLinkage through two types of communication:ßMessage passingßState vector inspectionßIndicates which data moves between which processesßand more about synchronization
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Model Process Communication
ßFundamental notion is Data Streamsßcan have multiple data streams arriving at an action in aprocess
ßcan model multiple instances entering a data stream ordeparting from one
ßTwo types of data stream communication:ßasynchronous message passing
ßState vector inspection
ßThese communication mechanisms used to model howdata is passed between processes
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Message Passing
ßData stream carries a message from one processactivity to an activity in another processßmust correlate with output leaf of sending model process
ßmust correlate with input leaf of receiving model process
ßData transfer assumed to be asynchronousßless restrictive assumption
ßno timing constraints are assumed
ßmessages are queued in infinitely long queues
ßmessages interleaved non-deterministically whenmultiple streams arrive at same activity
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 19
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
State Vector Inspection
ßModeling mechanism used when one process needsconsiderable information about another
ßState vector includesßvalues of all internal variables
ßexecution text pointer
ßProcess often needs to control when its state vector canbe viewedßprocess may need exclusive access to its vector
ßCould be modeled as message passing, but importantto underscore characteristic differences
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Network Phase -- the SSDß loan balance inquiry function (LBE) is connected to the
Student-1 process by state vector (SV) connectionßThe function to produce the student acknowledgments data
stream (ACK) is embedded in the student-1 process in therepays component
ßDT is an input signal at the end of the day--a daily time marker--that tells the payment acknowledgment lister (PAL) function tobeginßThe ACK and DT data streams are rough-merged, that is, we
don't know precisely whether a repayment acknowledgment willappear on today's or tomorrow's daily list.
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Designing the LBE function w/ JSP
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Implementation Phase
ßUse of inferences encouraged by understandingsgleaned from the network phase
ßNetwork Phase suggests ideal traversal paths throughmodel processes and their local dataßsuggests internal implementation of model processes
ßstudying use of model processes suggests internalstructure of their data
ßCommunication by data streams and state vectorinspection often suggest real implementationsßBut often not
CMPSCI520/620
”Rick Adrion 2003 (except where noted) 20
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
The SIDall of the serial data streams are input to the scheduler process
all student processes have an identical structure; only their SV are different--separate the state vectors ofstudent processes from their process text (state vector separation). --set of SV is the data base of our student loan system
student-1 process is invertedwith respect to its data stream, S. and is called by the scheduler to process a transaction, and then suspended
PAL is inverted with respect to both of its inputs, the repayment acknowledgment data stream and the daily marker. PAL is invoked by Student-1 whenever Student-1 processes a repayment transaction. The scheduler invokes PAL directly when it receives a DT and this triggers the daily listing
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Design of the scheduler in JSPß records from the serial data stream
(loan balance inquiries and studentloan transactions) are read andprocessed in real-timeß at the end of the day, a daily time
marker--perhaps a signal to thesystem from the operator--is input
ß PAL is invoked & processespayment acknowledgments thathave been previously generated inreal-time whenever a studentrepayment is made and stored in abuffer
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
JSD and JSP
ß In JSD, the principles of JSP are extended into the areas ofsystems analysis, specification, design and implementationß In JSP, a simple program describes a sequential process that
communicates by means of sequential data streams; its structure isdetermined by the structure of its input and output data streamß In JSD, the real world is modeled as a set of sequential model
processes that communicate with the real world and with each otherby sequential data streams (as well as by a second read-onlycommunication called state vector connection). The structure of amodel process is determined by the structure of its inputs andoutputs.ßThe JSD implementation step embodies the JSP implementation
technique, program inversion, in which a program is transformedinto a procedureßOther JSP techniques, such as the single read-ahead rule and
backtracking, and principles, such as implementation throughtransformation, are used in JSD
UUNIVERSITYNIVERSITY OFOF M MASSACHUSETTS ASSACHUSETTS AAMHERSTMHERST •• D DEPARTMENTEPARTMENT OF OF CCOMPUTER OMPUTER SSCIENCE CIENCE •• CCMPMPSSCI 520/620 CI 520/620 FFALL 2003ALL 2003
Comments/Evaluation
ßFocus on conceptual designßBut difficult to build a system this way
ßBased upon model of real world
ßCareful (and experienced) analysis of the modelgenerally points suggested implementation tactics,thoughßParnas notions of module not perceptible here
ßNot an iterative refinement approach either
ßTreatment of data is very much subordinated/secondary
ßDoes a good job of suggesting possible parallelism
ßContrasts strongly with Objected Oriented notions (eg.Booch, UML)