Ch7 Handouts
Ch7 Handouts
² Design patterns
Design & Implementation ² Implementation issues
² Open source development
Chapter 7
Dr. Mahmood Qureshi Hashmi
Assistant Professor
Department of Electrical & Computer Engineering Chapter 7 Design and implementa;on 2
² Software design and implementation is the stage in the ² In a wide range of domains, it is now possible to buy off-
software engineering process at which an executable the-shelf systems (COTS) that can be adapted and
software system is developed. tailored to the users’ requirements.
² Software design and implementation activities are § For example, if you want to implement a medical records
system, you can buy a package that is already used in hospitals.
invariably inter-leaved (Occurs in parallel rather than sequentially).
It can be cheaper and faster to use this approach rather than
§ Software design is a creative activity in which you identify developing a system in a conventional programming language.
software components and their relationships, based on a
customer’s requirements. ² When you develop an application in this way, the design
§ Implementation is the process of realizing the design as a process becomes concerned with how to use the
program. configuration features of that system to deliver the
system requirements.
Chapter 7 Design and implementa;on 3 Chapter 7 Design and implementa;on 4
² To show how system modeling and architectural design ² Object-Oriented Design (OOD) using Unified Modeling
(covered in Chapters 5 and 6) are put into practice in Language (UML) is a method for visualizing, specifying,
developing an object-oriented software design and documenting the design of software systems based
² To introduce important implementation issues that are on object-oriented principles.
not usually covered in programming books. These ² UML provides a standardized way to represent the
include software reuse, configuration management, and various components and relationships of an object-
open source development. oriented system, aiding in better communication and
understanding between team members during software
development. Examples includes
●
Class Diagram, Use Case Diagram, Sequence Diagram,
Activity Diagram, State Machine Diagram, Object
Diagram and Component Diagram
Chapter 7 Design and implementa;on 5 Chapter 7 Design and implementa;on 6
² In OOD, different organizations may follow various processes ² Understanding the relationships between the software
depending on their specific needs, but these processes usually that is being designed and its external environment is
share some core activities. Here's a brief explanation of these
common activities:
essential for deciding how to provide the required system
functionality and how to structure the system to
² Common activities in these processes include:
communicate with its environment.
●
Define context and modes of use: Understand system environment and
user interactions. ² Understanding of the context also lets you establish the
●
Design system architecture: Structure key components and their interactions.
boundaries of the system. Setting the system boundaries
helps you decide what features are implemented in the
●
Identify principal system objects: Determine core objects and their
responsibilities.
system being designed and what features are in other
associated systems.
●
Develop design models: Create UML diagrams to visualize structure and
behavior.
●
Specify object interfaces: Define object methods and interactions.Specify
object interfaces. Chapter 7 Design and implementa;on 7 Chapter 7 Design and implementa;on 8
² A system context model is a structural model that
demonstrates the other systems in the environment of
the system being developed.
² An interaction model is a dynamic model that shows how
the system interacts with its environment as it is used.
The systems in the environment of each weather station are a weather information
system, an onboard satellite system, and a control system
Chapter 7 Design and implementa;on 9 Chapter 7 Design and implementa;on 10
The weather station
interacts with the
weather information
system to report
weather data and
the status of the
weather station
hardware.
11
² Once ineractions between the system and its
environment have been understood, you use this
information for designing the system architecture
² You identify the major component that makeup the
system and their interactions and then may organize the
component using an architectural pattern such as a
layered or client server model.
² The weather system is composed of independent
subsystems that communicate by broadcasting
messages on a common infrastructure
Each subsystem listens for messages on that infrastructure and picks up the messages that
are intended for them.
Chapter 7 Design and implementa;on 13 Chapter 7 Design and implementa;on 14
² Identifying object classes is often a difficult part of object
orientd design
² There is no ‘magic formula’ for object identification. It
relies on the skill, experience and domain knowldege of
system designers.
² Object identification is an iterative process. You are
unlikely to get it right first time.
The architecture of the data collection subsystem
Chapter 7 Design and implementa;on 15 Chapter 7 Design and implementa;on 16
² Use a grammatical approach based on a natural
language description of the sysetm (Objects and Attributes are A weather sta;on is a package of soFware controlled instruments
nouns; operations or services are verbs ) which collects data, performs some data processing and transmits
² Base the identification on tangible things in the this data for further processing. The instruments include air and
ground thermometers, an anemometer, a wind vane, a
application domain.(aircraft, roles manager doctors, events request
barometer and a rain gauge. Data is collected periodically.
interactions, locatsions offices etc.)
² Use a scenario-based analysis. The objects, attributes When a command is issued to transmit the weather data, the
and methods in each scenario are identified. (The team weather sta;on processes and summarises the collected data.
responsible for the analysis must identify the required objects, attributes,
The summarised data is transmiNed to the mapping computer
and operations)
when a request is received.
Chapter 7 Design and implementa;on 17 Chapter 7 Design and implementa;on 18
• Object class identification in the weather station system
may be based on the tangible hardware and data in the
system:
• Ground thermometer, Anemometer, Barometer
• Application domain objects that are ‘hardware’ objects
Five Object
related to the instruments in the system. Classes
• Weather station
• The basic interface of the weather station to its
environment. It therefore reflects the interactions
identified in the use-case model.
• Weather data
• Encapsulates the summarized data from the
instruments.
Chapter 7 Design and implementa;on 19 Chapter 7 Design and implementa;on 20
² Design models show the objects and object ² Subsystem models that show logical groupings of
classes and relationships between these objects into coherent sybsystems.
entities. ² Sequence models that show the sequence of object
interactions.
² Static models describe the static structure of the
² State machine models that show how individual objects
system in terms of object classes and
change their state in response to events.
relationships
² Other models include use-case models, aggregation
² Dynamic models describe the dynamic models, generalisation models, etc.
interactions between objects
Chapter 7 Design and implementa;on 21 Chapter 7 Design and implementa;on 22
• 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.
The sequence of interactions that take place when an external system requests the summarized data
from the weather station. You read sequence diagrams from top to bottom
Chapter 7 Design and implementa;on 23 Chapter 7 Design and implementa;on 24
• State diagrams are 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.
State diagram for the weather station system that shows how it responds to requests for
various services
Chapter 7 Design and implementa;on 25 Chapter 7 Design and implementa;on 26
Two interfaces that may be defined for the weather station.
Chapter 7 Design and implementa;on 27 Chapter 7 Design and implementa;on 28
• Name
• A meaningful pattern identifier.
• Problem description.
• Solution description.
• Not a concrete design but a template for a design
solution that can be instantiated in different ways.
• Consequences
• The results and trade-offs of applying the pattern.
Chapter 7 Design and implementa;on 29 Chapter 7 Design and implementa;on 30
• Name
• Observer.
• Description
• Separates the display of object state from the object itself.
• Problem description
• Used when multiple displays of state are needed.
• Solution description
• See slide with UML description.
• Consequences
• Optimisations to enhance display performance are impractical.
Chapter 7 Design and implementa;on 31 Chapter 7 Design and implementa;on 32
Two graphical presentation of the same dataset
Chapter 7 Design and implementa;on 33 Chapter 7 Design and implementa;on 34
² Focus here is not on programming, although this is
obviously important, but on other implementation issues
that are often not covered in programming texts:
§ Reuse Most modern software is constructed by reusing existing
components or systems. When you are developing software,
you should make as much use as possible of existing code.
§ Configuration management During the development process,
you have to keep track of the many different versions of each
software component in a configuration management system.
§ Host-target development Production software does not usually
execute on the same computer as the software development
environment. Rather, you develop it on one computer (the host
system) and execute it on a separate computer (the target
system).
Chapter 7 Design and implementa;on 35 Chapter 7 Design and implementa;on 36
² From the 1960s to the 1990s, most new software was ² The abstraction level
developed from scratch, by writing all code in a high- § At this level, you don’t reuse software directly but use knowledge
level programming language. of successful abstractions in the design of your software.
§ The only significant reuse or software was the reuse of functions ² The object level
and objects in programming language libraries.
§ At this level, you directly reuse objects from a library rather than
² Costs and schedule pressure mean that this approach writing the code yourself.
became increasingly unviable, especially for commercial ² The component level
and Internet-based systems.
§ Components are collections of objects and object classes that
² An approach to development based around the reuse of you reuse in application systems.
existing software emerged and is now generally used for ² The system level
business and scientific software. § At this level, you reuse entire application systems.
Chapter 7 Design and implementa;on 37 Chapter 7 Design and implementa;on 38
² The costs of the time spent in looking for software to ² Configuration management is the name given to the
reuse and assessing whether or not it meets your needs. general process of managing a changing software
² Where applicable, the costs of buying the reusable system.
software. For large off-the-shelf systems, these costs ² The aim of configuration management is to support the
can be very high. system integration process so that all developers can
² The costs of adapting and configuring the reusable access the project code and documents in a controlled
way, find out what changes have been made, and
software components or systems to reflect the
compile and link components to create a system.
requirements of the system that you are developing.
² The costs of integrating reusable software elements with ² See also Chapter 25.
each other (if you are using software from different
sources) and with the new code that you have
developed.
Chapter 7 Design and implementa;on 39 Chapter 7 Design and implementa;on 40
² Version management, where support is provided to keep track ² Most software is developed on one computer (the host),
of the different versions of software components. Version but runs on a separate machine (the target).
management systems include facilities to coordinate
development by several programmers. ² More generally, we can talk about a development
platform and an execution platform.
² System integration, where support is provided to help
§ A platform is more than just hardware.
developers define what versions of components are used to
create each version of a system. This description is then used § It includes the installed operating system plus other supporting
to build a system automatically by compiling and linking the software such as a database management system or, for
development platforms, an interactive development environment.
required components.
² Development platform usually has different installed
² Problem tracking, where support is provided to allow users to
report bugs and other problems, and to allow all developers to software than execution platform; these platforms may
see who is working on these problems and when they are have different architectures.
fixed.
Chapter 7 Design and implementa;on 41 Chapter 7 Design and implementa;on 42
² An integrated compiler and syntax-directed editing ² Software development tools are often grouped to create
system that allows you to create, edit and compile code. an integrated development environment (IDE).
² A language debugging system. ² An IDE is a set of software tools that supports different
² Graphical editing tools, such as tools to edit UML aspects of software development, within some common
framework and user interface.
models.
² Testing tools, such as Junit that can automatically run a ² IDEs are created to support development in a specific
set of tests on a new version of a program. programming language such as Java. The language IDE
may be developed specially, or may be an instantiation
² Project support tools that help you organize the code for of a general-purpose IDE, with specific language-support
different development projects. tools.
Chapter 7 Design and implementa;on 43 Chapter 7 Design and implementa;on 44
² If a component is designed for a specific hardware architecture, or
relies on some other software system, it must obviously be deployed ² Open source development is an approach to software
on a platform that provides the required hardware and software development in which the source code of a software
support. system is published and volunteers are invited to
² High availability systems may require components to be deployed participate in the development process
on more than one platform. This means that, in the event of platform
² Its roots are in the Free Software Foundation
failure, an alternative implementation of the component is available.
(www.fsf.org), which advocates that source code should
² If there is a high level of communications traffic between
not be proprietary but rather should always be available
components, it usually makes sense to deploy them on the same
platform or on platforms that are physically close to one other. This for users to examine and modify as they wish.
reduces the delay between the time a message is sent by one ² Open source software extended this idea by using the
component and received by another.
Internet to recruit a much larger population of volunteer
developers. Many of them are also users of the code.
Chapter 7 Design and implementa;on 45 Chapter 7 Design and implementa;on 46
² The best-known open source product is, of course, the ² Should the product that is being developed make use of
Linux operating system which is widely used as a server open source components?
system and, increasingly, as a desktop environment. ² Should an open source approach be used for the
² Other important open source products are Java, the software’s development?
Apache web server and the mySQL database
management system.
Chapter 7 Design and implementa;on 47 Chapter 7 Design and implementa;on 48
² More and more product companies are using an open
source approach to development.
² Their business model is not reliant on selling a software
product but on selling support for that product.
² They believe that involving the open source community
will allow software to be developed more cheaply, more
quickly and will create a community of users for the
software.
Chapter 7 Design and implementa;on 49 Chapter 7 Design and implementa;on 50
² A fundamental principle of open-source development is ² The GNU General Public License (GPL). This is a so-called
that source code should be freely available, this does not ‘reciprocal’ license that means that if you use open source
mean that anyone can do as they wish with that code. software that is licensed under the GPL license, then you
must make that software open source.
§ Legally, the developer of the code (either a company or an
individual) still owns the code. They can place restrictions on ² The GNU Lesser General Public License (LGPL) is a variant
how it is used by including legally binding conditions in an open of the GPL license where you can write components that link
source software license. to open source code without having to publish the source of
§ Some open source developers believe that if an open source these components.
component is used to develop a new system, then that system
should also be open source. ² The Berkley Standard Distribution (BSD) License. This is a
§ Others are willing to allow their code to be used without this
non-reciprocal license, which means you are not obliged to re-
restriction. The developed systems may be proprietary and sold publish any changes or modifications made to open source
as closed source systems. code. You can include the code in proprietary systems that
are sold.
Chapter 7 Design and implementa;on 51 Chapter 7 Design and implementa;on 52
² Establish a system for maintaining information about
open-source components that are downloaded and
used.
² Be aware of the different types of licenses and
understand how a component is licensed before it is
used.
² Be aware of evolution pathways for components.
² Educate people about open source.
² Have auditing systems in place.
² Participate in the open source community.
Chapter 7 Design and implementa;on 53