Tips for domain name registration and picking the right domain. Web hosting basics.
Godaddy Website Builder & Domains Promo Codes: Save money at Godaddy using this special
p (more)
Tips for domain name registration and picking the right domain. Web hosting basics.
Godaddy Website Builder & Domains Promo Codes: Save money at Godaddy using this special
promo link for Discount Domains and Hosting coupon codes. Create your own professionallooking
website with a few clicks. No programming required. Get started now:
http://www.godaddy.com-specialmessage.info/ezdiscount (less)
Slide 1: 3 minute review of last week -Architectural design process
q
System structuring
• • • Repository model Client-Server model Abstract machine (layered) model Centralised control
• Call-return model • Manager model
q
Control modelling
• •
Event-based control
• Broadcast model
• Interrupt-driven model
q
Modular decomposition
• • Object model Data-Flow model
Slide 1
Slide 2: 13 minute review of last week -Formal Specifications
Symbol_Table New --> Table Enter (Table, Symbol, Type) --> Table Lookup (Table, Symbol) --> Type Delete (Table, Symbol) --> Table Replace (Table, Symbol, Type) --> Table Lookup(New, S) = Undefined Lookup(Enter(ST, S1, T1), S2) = if S1=S2 then T1 else Lookup(ST, S2) Delete(New,S2) = undefined Delete(Enter(ST, S1,T1), S2) = if S1=S2 then ST else Enter(Delete(ST, S2), S1, T1) Replace( Replace(
Slide 2
Slide 3: Ch. 12 - Object-oriented Design
q
q
Designing systems using self-contained objects and object classes Advantages of OOD
• • Easier maintenance. Objects may be understood as stand-alone entities Objects are appropriate reusable components Shared data areas are eliminated. Objects communicate by message passing Objects may be distributed and may execute sequentially or in parallel
Slide 3
q
Characteristics of OOD
• •
Slide 4: Object-oriented development
q
q
q
q
Object-oriented analysis, design and programming are related but distinct OOA is concerned with developing an object model of the application domain OOD is concerned with developing an objectoriented system model to implement requirements OOP is concerned with realising an OOD using an OO programming language such as Java or C++
Slide 4
Slide 5: 12.1 Objects and object classes
q
q
q
Objects are entities in a software system which represent instances of realworld and system entities Object classes are templates for objects. They may be used to create objects Object classes may inherit attributes and services from other object classes
Employee name: string address: string dateOfBirth: Date employeeNo: integer socialSecurityNo: string department: Dept ma nager: Employee salary: integer status: {current, left, retired} taxCode: integer . .. join () leave () retire () changeDetails ()
Slide 5
Slide 6: Object communication
q q
Conceptually, objects communicate by message passing. Messages
• • The name of the service requested by the calling object. Copies of the information required to execute the service and the name of a holder for the result of the service.
q
In practice, messages are often implemented by procedure calls
• • v = circularBuffer.Get () ; thermostat.setTemp (20) ;
Slide 6
Slide 7: Generalisation and inheritance
q
q
q
q
Objects are members of classes which define attribute types and operations Classes may be arranged in a class hierarchy where one class (a super-class) is a generalisation of one or more other classes (sub-classes) A sub-class inherits the attributes and operations from its super class and may add new methods or attributes of its own Generalisation in the UML is implemented as inheritance in OO programming languages
Slide 7
Slide 8: A generalisation hierarchy
Employee Ma nager budgetsControlled dateAppointed Programmer project progLanguage
Project Ma nag er projects
De pt. Ma nager dept
Strategic Ma nag er responsibilities
Slide 8
Slide 9: Advantages of inheritance
q
q
q
It is an abstraction mechanism which may be used to classify entities It is a reuse mechanism at both the design and the programming level The inheritance graph is a source of organisational knowledge about domains and systems
Slide 9
Slide 10: Problems with inheritance
q
q
q
Object classes are not self-contained. they cannot be understood without reference to their superclasses Designers have a tendency to reuse the inheritance graph created during analysis. Can lead to significant inefficiency The inheritance graphs of analysis, design and implementation have different functions and should be separately maintained
Slide 10
Slide 11: Inheritance and OOD
q
There are differing views as to whether inheritance is fundamental to OOD.
• View 1. Identifying the inheritance hierarchy or network is a fundamental part of object-oriented design. Obviously this can only be implemented using an OOPL. View 2. Inheritance is a useful implementation concept which allows reuse of attribute and operation definitions. Identifying an inheritance hierarchy at the design stage places unnecessary restrictions on the implementation
Slide 11
•
Slide 12: Concurrent objects
q
q
q
q
The nature of objects as self-contained entities make them suitable for concurrent implementation The message-passing model of object communication can be implemented directly if objects are running on separate processors in a distributed system In Java, threads are used for implementing concurrency Threads must include a method called run() and this is started up by the Java run-time system
Slide 12
Slide 13: Servers and active objects
q
Servers.
• The object is implemented as a parallel process (server) with entry points corresponding to object operations. If no calls are made to it, the object suspends itself and waits for further requests for service Objects are implemented as parallel processes and the internal object state may be changed by the object itself and not simply by external calls
q
Active objects
•
Slide 13
Slide 14: Active transponder object
q
q
Active objects may have their attributes modified by external operations but may also update them autonomously using internal operations Transponder object broadcasts an aircraft’s position. The position may be updated using a satellite navigation system.
Slide 14
Slide 15: An active transponder object
class Transponder extends Thread { Position currentPosition ; Coords c1, c2 ; Satellite sat1, sat2 ; Navigator theNavigator ; public Position givePosition () { return currentPosition; } public void run () { while (true) { c1 = sat1.position () ; c2 = sat2.position () ; currentPosition = theNavigator.compute (c1, c2) ; } } } //Transponder
Slide 15
Slide 16: 12.2 An object-oriented design process
q q q q q
Define the context and modes of use of the system Design the system architecture Identify the principal system objects Develop design models Specify object interfaces
Slide 16
Slide 17: Weather system description
A weather data collection system is required to generate weather maps on a regular basis using data collected from remote, unattended weather stations and other data sources such as weather observers, balloons and satellites. Weather stations transmit their data to the area computer in response to a request from that machine. The area computer validates the collected data and integrates it with the data from different sources. The integrated data is archived and, using data from this archive and a digitised map database a set of local weather maps is created. Maps may be printed for distribution on a special-purpose map printer or may be displayed in a number of different formats.
Slide 17
Slide 18: Layered architecture
«subsystem» Da ta display Data display layer where objects are concerned with preparing and presenting the data in a humanreadable form Data archiving layer where objects are concerned with storing the data for future processing Data processing layer where objects are concerned with checking and integrating the collected data Data collection layer where objects are concerned with acquiring data from remote sources
«subsystem» Da ta archiving
«subsystem» Da ta processing
«subsystem» Da ta collection
Slide 18
Slide 19: Weather station description
A weather station is a package of software controlled instruments which collects data, performs some data processing and transmits this data for further processing. The instruments include air and ground thermometers, an anemometer, a wind vane, a barometer and a rain gauge. Data is collected every five minutes. When a command is issued to transmit the weather data, the weather station processes and summarises the collected data. The summarised data is transmitted to the mapping computer when a request is received.
Slide 19
Slide 20: System context and models of use
q
q
Develop an understanding of the relationships between the software being designed and its external environment System context
• A static model that describes other systems in the environment. Use a subsystem model to show other systems. Following slide shows the systems around the weather station system. A dynamic model that describes how the system interacts with its environment. Use use-cases to show interactions
Slide 20
q
Model of system use
•
Slide 21: Subsystems in the weather mapping system
«subsystem» Da ta collection Observer Co mms Weather station Balloon Satellite «subsystem» Da ta display User interface Ma p Ma p display Ma p printer
«subsystem» Da ta processing Da ta checking Da ta integration
«subsystem» Da ta archiving Da ta storage Ma p store Da ta store
Slide 21
Slide 22: Use-cases for the weather station
Startup
Shutdown Re port
Ca librate
Test
Slide 22
Slide 23: Use-case description
System Use-case Actors Data Weather station Report Weather data collection system, Weather station The weather station sends a summary of the weather data that has been collected from the instruments in the collection period to the weather data collection system. The data sent are the maximum minimum and average ground and air temperatures, the maximum, minimum and average air pressures, the maximum, minimum and average wind speeds, the total rainfall and the wind direction as sampled at 5 minute intervals. The weather data collection system establishes a modem link with the weather station and requests transmission of the data. The summarised data is sent to the weather data collection system
Stimulus Response
Comments Weather stations are usually asked to report once per hour but this frequency may differ from one station to the other and may be modified in future.
Slide 23
Slide 24: Architectural design
q
q
Once interactions between the system and its environment have been understood, you use this information for designing the system architecture Layered architecture is appropriate for the weather station
• • • Interface layer for handling communications Data collection layer for managing instruments Instruments layer for collecting data
Slide 24
Slide 25: Weather station architecture
Weather station «subsystem» Interface
Manages all external communications Collects and summarises weather data
«subsystem» Da ta collection
«subsystem» Instruments
Package of instruments f or raw data collections
Slide 25
Slide 26: Object identification
q
q
q
Identifying objects (or object classes) is the most difficult part of object oriented design There is no 'magic formula' for object identification. It relies on the skill, experience and domain knowledge of system designers Object identification is an iterative process. You are unlikely to get it right first time
Slide 26
Slide 27: Approaches to identification
q
q
q
q
Use a grammatical approach based on a natural language description of the system Base the identification on tangible things in the application domain Use a behavioural approach and identify objects based on what participates in what behaviour Use a scenario-based analysis. The objects, attributes and methods in each scenario are identified
Slide 27
Slide 28: Weather station object classes
q
Ground thermometer, Anemometer, Barometer
• Application domain objects that are ‘hardware’ objects related to the instruments in the system The basic interface of the weather station to its environment. It therefore reflects the interactions identified in the use-case model Encapsulates the summarised data from the instruments
Slide 28
q
Weather station
•
q
Weather data
•
Slide 29: Weather station object classes
WeatherStation identifier reportWeather () calibrate (instruments) test () startup (instruments) shutdown (instruments) WeatherData airTemperatures groundTemperatures win dSpeeds win dDirections pressures rainfall collect () summarise ()
Ground the rmometer temperature test () calibrate ()
Anemometer win dSpeed win dDirection test ()
Ba rom eter pressure height test () calibrate ()
Slide 29
Slide 30: Further objects and object refinement
q
Use domain knowledge to identify more objects and operations
• • Weather stations should have a unique identifier Weather stations are remotely situated so instrument failures have to be reported automatically. Therefore attributes and operations for self-checking are required In this case, objects are passive and collect data on request rather than autonomously. This introduces flexibility at the expense of controller processing time
Slide 30
q
Active or passive objects
•
Slide 31: Design models
q
q
Design models show the objects and object classes and relationships between these entities Static models describe the static structure of the system in terms of object classes and relationships
• Sub-system models that show logical groupings of objects into coherent subsystems
q
Dynamic models describe the dynamic interactions between objects.
• • Sequence models show the sequence of object interactions State machine models show how individual objects change their state in response to events
Slide 31
Slide 32: Subsystem models
q
q
q
Shows how the design is organised into logically related groups of objects In the UML, these are shown using packages. This is a logical model. The actual organisation of objects in the system may be different.
«subsystem» Interface
«subsystem» Da ta collection
Co mmsCo ntroller
WeatherData Instrument Status
WeatherStation
«subsystem» Instruments Air thermometer Ground thermometer Ra inGauge Anemometer
Barometer
Wind Vane
Slide 32
Slide 33: Sequence models
q
Sequence models show the sequence of object interactions that take place
• • • Objects are arranged horizontally across the top Time is represented vertically so models are read top to bottom Interactions are represented by labelled arrows, Different styles of arrow represent different types of interaction A thin rectangle in an object lifeline represents the time when the object is the controlling object in the system
Slide 33
•
Slide 34: Data collection sequence
:CommsController request (report) acknowledge () report () summarise () :WeatherStation :WeatherData
send (report) reply (report) acknowledge ()
Slide 34
Slide 35: Statecharts
q
Show how objects respond to different service requests and the state transitions triggered by these requests
• • • • • If object state is Shutdown then it responds to a Startup() message In the waiting state the object is waiting for further messages If reportWeather () then system moves to summarising state If calibrate () the system moves to a calibrating state A collecting state is entered when a clock signal is received
Slide 35
Slide 36: Weather station state diagram
Operation
calibrate () Calibrating calibration OK Shutdown startup () shutdown () Waiting test () transmission done Testing test complete
Transmitting clock collection done reportWeather () weather summary complete
Summarising Collecting
Slide 36
Slide 37: Object interface specification
q
q
q
q
Object interfaces have to be specified so that the objects and other components can be designed in parallel Designers should avoid designing the interface representation but should hide this in the object itself Objects may have several interfaces which are viewpoints on the methods provided The UML uses class diagrams for interface specification but Java may also be used
Slide 37
Slide 38: Weather station interface
interface WeatherStation { public void WeatherStation () ; public void startup () ; public void startup (Instrument i) ; public void shutdown () ; public void shutdown (Instrument i) ; public void reportWeather ( ) ; public void test () ; public void test ( Instrument i ) ; public void calibrate ( Instrument i) ; public int getID () ; } //WeatherStation
Slide 38
Slide 39: 12.3 Design evolution
q
q
q
Hiding information inside objects means that changes made to an object do not affect other objects in an unpredictable way Assume pollution monitoring facilities are to be added to weather stations. These sample the air and compute the amount of different pollutants in the atmosphere Pollution readings are transmitted with weather data
Slide 39
Slide 40: Changes required
q
q
q
Add an object class called ‘Air quality’ as part of WeatherStation Add an operation reportAirQuality to WeatherStation. Modify the control software to collect pollution readings Add objects representing pollution monitoring instruments
Slide 40
Slide 41: Pollution monitoring
WeatherStation identifier reportWeather () reportAirQuality () calibrate (instruments) test () startup (instruments) shutdown (instruments) Air quality NO Data smokeData benzeneData collect () summarise ()
Pollution monitoring instruments NO meter SmokeMeter
BenzeneMeter
Slide 41
Slide 42: Key points
q
q
q
q
OOD is an approach to design so that design components have their own private state and operations Objects should have constructor and inspection operations. They provide services to other objects Objects may be implemented sequentially or concurrently The Unified Modeling Language provides different notations for defining different object models
Slide 42
Slide 43: Key points
q
q
q
A range of different models may be produced during an object-oriented design process. These include static and dynamic system models Object interfaces should be defined precisely using e.g. a programming language like Java Object-oriented design simplifies system evolution
Slide 43
Slide 44: 10 minute break - a puzzle
q
q
What is the probability that a randomly picked triangle contains an obtuse angle ? An angle between 90 and 180 degrees is called an obtuse angle.
Triangle without any obtuse angle
Triangle with an obtuse angle
Slide 44
Slide 45: Solution to the puzzle
q
q
q q
q
Every triangle has a unique circum-circle on which the 3 corners of the triangle lie. A triangle has an obtuse angle, when all the three corners lie in one half of the circle (same semicircle). Reuse the knowledge from last weeks puzzle. The probability that 3 randomly picked points on the circumference of a circle falling in the same semi-circle is 0.75 Answer is 0.75.
Slide 45
Slide 46: Solution to the puzzle from Prof. Greg Allen
q q
q
q
q
q q
Solution from first principles. If you fix 2 angles of triangle, its 3rd angle gets automatically fixed. Red areas represent the cases where angle A or B is an obtuse angle. Blue area represents the cases where angles A + B <= 90 and hence angle C is an obtuse angle. White area represents the cases where angles A + B => 90 and hence angle C <= 90. No angle is obtuse. Red and Blue areas cover 75% Answer is 0.75.
B
180
180
A
Slide 46
Slide 47: Ch 14 - Design with Reuse
q q
q
Building software from reusable components. In most engineering disciplines, systems are designed by composing existing components that have been used in other systems Software engineering has been more focused on original development but it is now recognised that to achieve better software, more quickly and at lower cost, we need to adopt a design process that is based on systematic reuse
Slide 47
Slide 48: Becoming a Chess Master
q
First learn rules and physical requirements
• e.g., names of pieces, legal movements, chess board geometry and orientation, etc. e.g., relative value of certain pieces, strategic value of center squares, power of a threat, etc.
q
Then learn principles
•
q
However, to become a master of chess, one must study the games of other masters
• These games contain patterns that must be understood, memorized, and applied repeatedly
q
There are hundreds of these patterns
Slide 48
Slide 49: Becoming a Software Design Master
q
First learn the rules
• e.g., the algorithms, data structures and languages of software e.g., structured programming, modular programming, object oriented programming, generic programming,etc.
q
Then learn the principles
•
q
However, to truly master software design, one must study the designs of other masters
• These designs contain patterns must be understood, memorized, and applied repeatedly
q
There are quite a few of these patterns
Slide 49
Slide 50: Reuse-based software engineering
q
Application system reuse
• The whole of an application system may be reused either by incorporating it without change into other systems (COTS reuse) or by developing application families Components of an application from sub-systems to single objects may be reused Software components that implement a single welldefined function may be reused
Slide 50
q
Component reuse
•
q
Function reuse
•
Slide 51: Benefits of reuse
q
Increased reliability
• Components exercised in working systems Less uncertainty in development costs Reuse components instead of people Embed standards in reusable components
Avoid original development and hence speed-up production
Slide 51
q
Reduced process risk
•
q
Effective use of specialists
•
q
Standards compliance
•
q
Accelerated development
•
Slide 52: Requirements for design with reuse
q
q
q
It must be possible to find appropriate reusable components The reuser of the component must be confident that the components will be reliable and will behave as specified The components must be documented so that they can be understood and, where appropriate, modified
Slide 52
Slide 53: Reuse problems
q q q q q
Increased maintenance costs Lack of tool support Not-invented-here syndrome Maintaining a component library Finding and adapting reusable components
Slide 53
Slide 54: 14.1 Component-based development
q
q
q
q
Component-based software engineering (CBSE) is an approach to software development that relies on reuse It emerged from the failure of object-oriented development to support effective reuse. Single object classes are too detailed and specific Components are more abstract than object classes and can be considered to be stand-alone service providers The component interface is published and all interactions are through the published interface
Slide 54
Slide 55: Component interfaces
q
Provides interface
• Defines the services that are provided by the component to other components Defines the services that specifies what services must be made available for the component to execute as specified
Component Provides interface
q
Requires interface
•
Requires interface
Slide 55
Slide 56: Printing services component
Requires interface PrintService Print GetQueue PrinterInt Remove Transfer Register Unregister Provides interface
GetPDfile
Slide 56
Slide 57: Component abstractions
q
Functional abstraction
• The component implements a single function such as a mathematical function The component is a collection of loosely related entities that might be data declarations, functions, etc. The component represents a data abstraction or class in an object-oriented language
The component is a group of related classes that work together
q
Casual groupings
•
q
Data abstractions
•
q
Cluster abstractions
•
q
System abstraction
• The component is an entire self-contained system
Slide 57
Slide 58: CBSE processes
q q
q
Component-based development can be integrated into a standard software process by incorporating a reuse activity in the process However, in reuse-driven development, the system requirements are modified to reflect the components that are available CBSE usually involves a prototyping or an incremental development process with components being ‘glued together’ using a scripting language
Specify components Search for reusable components Incorporate discovered components
Design system aachitecture
An opportunistic reuse process
Slide 58
Slide 59: Development with reuse
Outline system requirements Search for reusable components Modify requirements accor ding to discovered components
Architectur al design
Search for reusable components
Specify system components based on reusable components
Slide 59
Slide 60: CBSE problems
q
q q
Component incompatibilities may mean that cost and schedule savings are less then expected Finding and understanding components Managing evolution as requirements change in situations where it may be impossible to change the system components
Slide 60
Slide 61: Application frameworks
q
q
q
Frameworks are a sub-system design made up of a collection of abstract and concrete classes and the interfaces between them The sub-system is implemented by adding components to fill in parts of the design and by instantiating the abstract classes in the framework Frameworks are moderately large entities that can be reused
• • not full applications in their own right applications are constructed by integrating a number of frameworks.
Slide 61
Slide 62: Framework classes
q
System infrastructure frameworks
• Support the development of system infrastructures such as communications, user interfaces and compilers Standards and classes that support component communication and information exchange. Eg. CORBA, Microsoft’s COM, DCOM, Java Beans Support the development of specific types of application such as telecommunications or financial systems. Embed domain knowledge and support enduser applications.
Slide 62
q
Middleware integration frameworks
•
q
Enterprise application frameworks
•
Slide 63: Extending frameworks
q
q
Frameworks are generic and are extended to create a more specific application or sub-system Extending the framework involves
• • Adding concrete classes that inherit operations from abstract classes in the framework Adding methods that are called in response to events that are recognised by the framework
q
Problem with frameworks is their complexity and the time it takes to use them effectively
Slide 63
Slide 64: Model-view controller
q q
q
System infrastructure framework for GUI design Allows for multiple presentations of an object and separate interactions with these presentations MVC framework involves the instantiation of a number of patterns (eg. Observer discussed later)
View state View methods view modification messages Controller state User inputs Controller methods
Model queries and updates
Model edits Model state Model methods
Slide 64
Slide 65: COTS product reuse
q q
q
COTS - Commercial Off-The-Shelf systems COTS systems are usually complete application systems that offer an API (Application Programming Interface) Building large systems by integrating COTS systems is now a viable development strategy for some types of system such as E-commerce systems
Slide 65
Slide 66: COTS system integration problems
q
Lack of control over functionality and performance
• COTS systems may be less effective than they appear Different COTS systems may make different assumptions that means integration is difficult COTS vendors not system users control evolution COTS vendors may not offer support over the lifetime of the product
Slide 66
q
Problems with COTS system inter-operability
•
q
No control over system evolution
•
q
Support from COTS vendors
•
Slide 67: Component development for reuse
q q
Components for reuse may be specially constructed by generalising existing components Component characteristics for reusability
• • • • Should reflect stable domain abstractions Should hide state representation Should be as independent as possible Should publish (but not handle) exceptions through the component interface The more general the interface, the greater the reusability but it is then more complex and hence less usable
Slide 67
q
There is a trade-off between reusability and usability.
•
Slide 68: Reusable components
q
q
The development cost of reusable components is higher than the cost of specific equivalents. This extra reusability enhancement cost should be an organization rather than a project cost Generic components may be less space-efficient and may have longer execution times than their specific equivalents
Slide 68
Slide 69: 14.2 Application families
q
q
q
An application family or product line is a related set of applications that has a common, domainspecific architecture The common core of the application family is reused each time a new application is required Each specific application is specialised in some way and may involve writing additional units and adapting some components to meet new demands
Slide 69
Slide 70: Application family specialisation
q
Platform specialisation
• Different versions of the application are developed for different platforms Different versions of the application are created to handle different peripheral devices Different versions of the application are created for customers with different requirements. E.g. inventory management system for power utility, university labs, library etc
Slide 70
q
Configuration specialisation
•
q
Functional specialisation
•
Slide 71: A resource management system
User access Program access
Add
Delete
Query
Browse
Admin
Report
Resource desc.
Screen spec.
Report spec.
Resource database
Slide 71
Slide 72: Inventory management systems
q
Resource database
• Maintains details of the things that are being managed Describes the structures in the resource database and input and output formats that are used Provides functions implementing queries over the resources A user interface and an application programming interface
Slide 72
q
I/O descriptions
•
q
Query level
•
q
Access interfaces
•
Slide 73: Application family architectures
q
q
q q
Architectures must be structured in such a way to separate different sub-systems and to allow them to be modified The architecture should also separate essential facilities of the system from the detailed information (about the resources) and the user access to such information. Specific layer includes descriptions, screens, reports. Higher layers use these descriptions in their operation rather than hard-wired info about the resources.
Slide 73
Slide 74: Library system
q q
The resources being managed are the books in the library Additional domain-specific functionality (issue, borrow, etc.) must be added for this application
Library user access Add Delete Query Browse Admin Report Issue Return Users
Resource desc.
Screen spec.
Report spec.
Library holdings database
Slide 74
Slide 75: 14.3 Design patterns
q
q
q
q q q
A design pattern is a way of reusing abstract knowledge about a problem and its solution A pattern is a description of the problem and the essence of its solution It should be sufficiently abstract to be reused in different settings Well-tried solution to a common problem Description of accumulated wisdom and experience Patterns often rely on object characteristics such as inheritance and polymorphism
Slide 75
Slide 76: Pattern elements
q
Name
• A meaningful pattern identifier
q q
Problem description Solution description
• Not a concrete design but a template for a design solution that can be instantiated in different ways The results and trade-offs of applying the pattern
q
Consequences
•
Slide 76
Slide 77: Multiple displays
50 D C B A 25 0 AB C D
Subject Observer 1 A: 40 B: 25 C: 15 D: 20 Observer 2
Slide 77
Slide 78: The Observer pattern
q
Name
• Observer Separates the display of object state from the object itself Used when multiple displays of state are needed See the next slide with UML description Optimisations to enhance display performance are impractical
Slide 78
q
Description
•
q
Problem description
•
q
Solution description
•
q
Consequences
•
Slide 79: The Observer pattern
Subject Attach (Observer) Detach (Observer) Notify () Observer Update () for all o in observers o -> Update ()
ConcreteSubject GetState () subjectState return subjectState
ConcreteObserver Update () observerState observerState = subject -> GetState ()
Slide 79
Slide 80: Comparing patterns and Frameworks
q
q
q
q
Patterns and frameworks are highly synergistic concepts, with neither subordinate to the other Patterns have been characterized as more abstract descriptions of frameworks, which are then implemented in a particular language Sophisticated frameworks typically embody dozens of patterns Likewise, patterns have been used to document frameworks
Slide 80
Slide 81: Patterns handbook
q
Mature engineering disciplines have handbooks that describe successful solutions to known problems
• e.g., automobile designers don’t design cars using the laws of physics, they adapt adequate solutions from the handbook known to work well enough The extra few percent of performance available by starting from scratch typically isn’t worth the cost
•
q
Patterns can form the basis for the handbook of software engineering
• If software is to become an engineering discipline, successful practices must be systematically documented and widely disseminated
Slide 81
Slide 82: Key points
q
q
q
q
Design with reuse involves designing software around good design and existing components Advantages are lower costs, faster software development and lower risks Component-based software engineering relies on black-box components with well-defined requires and provides interfaces COTS product reuse is concerned with the reuse of large, off-the-shelf systems
Slide 82
Slide 83: Key points
q
q
q
Software components for reuse should be independent, should reflect stable domain abstractions and should provide access to state through interface operations Application families are related applications developed around a common core. A generic system is adapted and specialised to meet specific requirements - platform/configuration/functionality Design patterns are high-level abstractions that document successful design solutions
Slide 83