1 / 67

Chapter 7

Chapter 7. Design and Implementation. Topics covered. Object-oriented design using the UML Design patterns Implementation issues Open source development. What is “design and implementation”?.

lerato
Télécharger la présentation

Chapter 7

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 7 Design and Implementation

  2. Topics covered • Object-oriented design using the UML • Design patterns • Implementation issues • Open source development

  3. What is “design and implementation”? • The stage in the software engineering process at which an executable software system is developed. • Design and implementation activities are invariably interleaved. • Software design is a creative activity in which you identify software components and their relationships, based on a customer’s requirements. • Implementation is the process of realizing the design as a program.

  4. Build or buy? • In a wide range of domains, it is now possible to buy off-the-shelf systems (COTS) that can be adapted and tailored to users’ requirements. • For example, if a medical records system is required, you can buy a package that is already used in hospitals. This can be cheaper and faster than developing a system. • When you procure an application in this way, the design process becomes concerned with how to use the configuration features of that system to deliver the system requirements.

  5. Object-oriented design using the UML

  6. An object-oriented design process… • Structured, object-oriented design processes involve developing a number of different system models. • They require a lot of effort for development and maintenance of these models and, for small systems, this may not be cost-effective.* • However, for large systems developed by different groups design models are an important communication mechanism.* * acknowledgment of both agile and planned-based principles

  7. ...an iterative, boot-strapping process

  8. Process stages • There are a variety of different object-oriented design processes. • Common activities normally include: • Define the context and modes of use of the system. • Design the system architecture. • Identify the principal system objects. • Develop design models (static and dynamic). • Specify object interfaces. • The process illustrated here is for the wilderness weather station. (See Section 1.3.3, p. 22.)

  9. System context and interactions • Goal:develop an understanding of the relationships between the software being designed and its external environment. • Understanding of the system context also lets you establish the boundaries (scope) of the system. • This helps in deciding what features will be implemented in the system being designed and what features will be in associated systems.

  10. Context and interaction models • A system context model is a static modelthat identifies the other systems in the environment of the system being developed. • An interaction model is a dynamic modelthat shows how the system interacts with its environment as it is used.

  11. System context for the weather station

  12. Weather station use cases

  13. Use case description—Report weather

  14. Architectural design • Once interactions between the system and its environment have been understood, this info is used in designing the system architecture. • Identify the major components that make up the system and their interactions, and then organize the components using an architectural pattern such as a layered or client-server model. • The weather station is comprised of independent subsystems that communicate by broadcasting messages via a shared infrastructure…

  15. High-level architecture of weather station

  16. Object class identification • Identifying object classes is often a difficult part of OO design. • There is no “magic formula” – it relies on the skill, experience, and domain knowledge of system designers • An iterative, boot-strapping process – you are unlikely to get it right the first time.

  17. Approaches to object identification • Use a grammatical approach based on a natural language description of the system (Abbott’s heuristic). • Associate objects with tangible things in the application domain (e.g., devices). • Use a behavioural approach: identify objects based on what participates in what behaviour. (cont’d)

  18. Approaches to object identification (cont.) • Use scenario-based analysis. The objects, attributes and methods in each scenario are identified. • Use an information-hiding based approach.*Identify potentially changeable design decisions and isolate these in separate objects to minimize the impact of change. (Parnas) * “Bonus” approach! (No extra charge.)

  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. (cont’d)

  20. Weather station description (cont’d) 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.

  21. Weather station object classes • Object class identification may be based on the tangible hardware and data in the system: • Weather station – interface of the weather station to its environment. It reflects interactions identified in the use-case model. • Weather data – encapsulates summarised data from the instruments. • Ground thermometer, Anemometer, Barometer, etc. – application domain “hardware” objects* related to the instruments in the system. *hardware-controlling SOFTWARE

  22. Weather station object classes

  23. Design models • Design models show the relationships among objects and object classes. • Static models describe the static structure of the system in terms of object and object class relationships. • Dynamic models describe the dynamic interactions among objects.

  24. Examples of design models • Sub-system models show logical groupings of objects into coherent sub-systems. (static) • Sequence models show the sequence of object interactions associated with system uses. (dynamic) • State machine models show how individual objects change their state in response to events. (dynamic) • Other models include use-case models, aggregation models, generalisation (inheritance) models, etc.

  25. Sub-system models • Shows how the design is organized into logically related groups of objects. • In the UML, these are shown using packages, an encapsulation construct. • This is a logical model – the actual organization of objects in the system as implemented may be different.

  26. Weather station sub-systems Active object Annotations go here

  27. Sequence models • Show the sequence of object interactions that take place. • Objects are arranged horizontally across the top. • Time is represented vertically; models are read top to bottom. • Interactions are represented by labelled arrows – different styles of arrows 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.

  28. Data collection sequence diagram

  29. State diagrams • Used to show how objects respond to different service requests and the state transitions triggered by these requests. • State diagrams are useful high-level models of a system or an object’s run-time behavior. • You don’t usually need a state diagram for all of the objects in the system. Many of the objects in a system are relatively simple and a state model adds unnecessary detail to the design.

  30. Weather station state diagram by messages received from “remote control room” initial state

  31. Interface specification • Object interfaces have to be specified to support parallel design (among other things...). • Designers should avoid revealing datarepresentation information in their interface design. (operations access and update all data) • Objects may have several logical interfaces which are viewpoints on the methods provided. (supported directly in Java) • UML class diagrams are used for interface specification, but pseudocode may also be used. (origin of “info hiding” term)

  32. Weather station interfaces

  33. Design patterns

  34. Design patterns • A way of reusing “accumulated knowledge and wisdom” about a problem and its solution. • A design pattern is a description of some problem and the “essence” of a solution. • Should be sufficiently abstract to be reusable in different contexts. • Often utilize OO characteristics such as inheritance and polymorphism.

  35. Pattern elements • Name: a meaningful pattern identifier • Problem description • Solution description: a template for a design solution that can be instantiated in different operational contexts (often illustrated graphically) • Consequences: the results and trade-offs of applying the pattern (analysis and experience)

  36. Example: The Observer pattern* *cf Model-View-Controller (MVC) architectural design pattern

  37. The Observer pattern • Name: Observer • Description: Separates the display of object statefrom the object itselfallowing alternative displays. • Problem description: Used when multiple displays of state are needed. • Solution description:(See UML description.) • Consequences:Object optimizations to enhance the performance of a particular display are impractical. (cont’d)

  38. The Observer pattern (cont’d)

  39. The Observer pattern (cont’d) Observer

  40. The Observer pattern (cont’d) • Concrete Subject • Has any number of observers • Provides an interface to attach and detach observer objects at run-time • Sends notification to its observers • Concrete Observer • Provides an update interface to receive signals from subject • Implements update operation

  41. UML model of Observer pattern Subject super class Observer super class (for alternative displays) one to many Specific observer sub-class Specific subject sub-class

  42. Recognizing design patterns • Using patterns effectively requires the ability to recognize common design problems and their associated solution patterns. • For example: • Tell several objects that the state of some other object has changed (Observer pattern). • Provide a standard way of accessing the elements in a collection, irrespective of how that collection is implemented (Iterator pattern). • Allow for the possibility of extending the functionality of an existing class at run-time (Decorator pattern).

  43. Implementation issues

  44. The focus here in NOT on programming… • Reuse: Most modern software is constructed by reusing existing components or systems. • Configuration management: Keeping track of the different versions of software components using a configuration management system. • Host-target development: Production software is usually developed on one computer (the host system) and executes on a separate computer (the target system).

  45. Reuse • From the 1960s to the 1990s, most new software was developed from scratch, by writing all code in a high-level programming language. • The only significant reuse or software was the reuse of functions and procedures in programming language libraries. • Costs and schedule pressure have made this approach increasingly unviable, especially for commercial and Internet-based systems. (cont’d)

  46. Reuse (cont’d) • Development based around the reuse of existing software therefore emerged and is now generally used for most business and scientific software.

  47. Reuse levels • The abstraction level: reuse knowledge of successful abstractions in the design of your software. • The object level: reuse objects from a library rather than writing the code yourself. • The component level: components are collections of objects and object classes that may be reused in application systems. • The system level: reuse entire application systems.

  48. Reuse costs include… • The time spent in looking for software to reuse and assessing whether or not it meets the needs. • Where applicable, the costs of buying the reusable software. For large off-the-shelf systems, these costs can be very high. • The costs of adapting and configuring reusable software components or systems to reflect the requirements of the system being developing. • The costs of integrating reusable software elements with each other (when using software from different sources) and with any new code being developed.

  49. Configuration management • Configuration management is the name given to the general process of managing a changing software system. • Its aim is to support the system integration process so that all developers can access the project code and documents in a controlled way, find out what changes have been made, and compile and link components to create (“build”) a system.

  50. Configuration management activities • Version management: keeping track of the different versions of software components. Version management systems include facilities to coordinate development by several programmers. • System integration: defining what versions of components are used to create each version of a system. Used to build a system automatically by compiling and linking the required components. • Problem tracking: allows reporting of bugs and other problems, and allows all developers to see who is working on these problems and when they are fixed.

More Related