Software Engineering Chapter 6 Notes
Software Engineering Chapter 6 Notes
Functional modelling is typically supported through the use of a data flow diagram (DFD).
The data flow diagram gives information on how data is transformed as it ‘flows’ through the
system, and it gives information on the kind of processes that transform the data within a
system. It is very important that you understand that data flow diagrams merely show how
data moves through the system, and how the data is transformed by processes. The data
flow diagram does not model the flow of control through the system (i.e. it is not concerned
with the order in which processes are carried out and therefore does not consider the
conditions that have to be fulfilled in order for a transformation to be carried out).
The following notation is used within DFDs:
• External entities are represented by a box. An external entity can be a source of
system inputs or a sink for system outputs. For example, an external entity of a
system could be a person or organisation outside the context of the system that is
an originator or receiver of system data.
• Processes (transforms) perform some form of transaction on the data flowing
through the system and are represented as circles. For example, the registration of a
job applicant could be such a process.
• Data flows within a DFD are represented as arrows that connect processes to each
other or to external entities. An example of such a data flow might be a registration
form.
• A data store is a repository of data and is represented as two horizontal lines.
An advantage of a DFD is its graphical representation, which makes it not only accessible to
the analyst, but also to the non-expert system user. Furthermore, DFDs allow for levelled
representation. A level-0 DFD (also referred to as the context diagram) shows a system at its
most general level as a single process with its incoming and outgoing data flows. An example
of a level-0 DFD of a basic payroll system is given in Figure 6.1.
The input of the payroll system consists of the employee’s personal data such as name,
address, tax code etc. and the amount of time worked. The output produced consists of the
pay cheque for the employee and formatted accounting information that is distributed
within the finance department for accounting purposes. The exact details of individual data
flows is described within a data dictionary.
Note that in Figure 6.1 the employee is represented twice. This is not really necessary, but is
practised here to separate input and output merely to support better readability.
Once the level-0 diagram has been created, more detail about the system is introduced at
level-1. This process is often referred to as refinement.
During the refinement of a DFD, processes are broken down into smaller processes and the
information flows between them. It is very important that overall the incoming and outgoing
data flows remain the same at different levels of refinement. An example of a possible
refinement of the level-0 DFD in Figure 6.1 is presented in Figure 6.2.
Within this DFD the processes 1, 3 and 4 cannot be divided any further and therefore are
referred to as primitive (Hamlet and Maybee 2001). They represent simple transforms with
single incoming and outgoing flows. However, process 2 is more complex and should be
divided further in a level-2 diagram.
DFD refinement
• During the refinement of a DFD:
Processes are broken down into smaller processes and the information
flows between them
It is very important that the overall incoming and outgoing data flows
remain the same at different levels of refinement
Processes that cannot be refined further are called primitives. These
normally have one input and one output.
(Pressman)
Binary
Ternary
Quaternary
Relationships
Chen (1976) defined a relationship as ‘an association among entities’.
For instance, between lecturer and course we can identify the ‘teaches’ relationship. The
entities involved in a relationship are called the participants in that relationship. Note that,
in the context of database design, we identify relationships between type entities; therefore
we identify type relationships (as opposed to instance relationships).
The participation of a type entity E in a relation type R is said to be total if any instance of E
participates at least in one instance of R. For example, the participation of lecturer ‘belongs
to’ Academic Department is total, since any lecturer must belong to an Academic
Department. The number of entities participating in a relationship represents the degree of
the relationship.
There are three important kinds of relationships reflecting cardinality constraints (note that
we have given classifications for binary relations only, in other words of degree 2 of the kind
E1 R E2, where entity 1 is in relation R with entity 2):
o One-to-one: for any instance e1 of E1 there is a single instance e2 of E2, such that e1
R e2 and vice-versa (e.g. ‘has’ between ‘Lecturer’ and ‘room’).
o One-to-many: for an instance e1 of E1 there might be more than one instance of E2,
e21, e22,…, e2n, such that e1 R e21, e1 R e22,…, e1 R e2n, but for any instance e2 of
E2, there is only a single instance e1 of E1 such that e1 R e2 (e.g. ‘belongs to’
between ‘Lecturer’ and ‘Academic Department’).
o Many-to-many: for an instance e1 of E1 there might be more than one instance of
E2, e21, e22, …, e2n, such that e1 R e21, e1 R e22, …, e1 R e2n, and vice-versa; e.g.
In
Figure 11.14(a) we see that staffNo SG5 manages branchNo B003 and staffNo SL21 manages
branchNo B005, but staffNo SG37 does not manage any branch. In other words, a member of staff
can manage zero or one branch and each branch is managed by one member of staff. As there is a
maximum of one branch for each member of staff involved in this relationship and a maximum of
one member of staff for each branch, we refer to this type of relationship as one-to-one, which we
usually abbreviate as (1:1).
propertyNo.
Determining the multiplicity
o In Figure 11.15(a) we see that staffNo SG37 oversees propertyNos PG21 and
PG36, and staffNo SA9 oversees propertyNo PA14 but staffNo SG5 does not
oversee any properties for rent and propertyNo PG4 is not overseen by any
member of staff. In summary, a member of staff can oversee zero or more
properties for rent and a property for rent is overseen by zero or one member of
staff. Therefore, for members of staff participating in this relationship there are
many properties for rent, and for properties participating in this relationship
there is a maximum of one member of staff. We refer to this type of relationship
as oneto-many, which we usually abbreviate as (1:*).
Diagrammatic representation of 1:* relationships
o An ER diagram of the Staff Oversees PropertyForRent relationship is shown in
Figure 11.15(b). To represent that a member of staff can oversee zero or more
properties for rent, we place a ‘0..*’ beside the PropertyForRent entity. To
represent that each property for rent is overseen by zero or one member of
staff, we place a ‘0..1’ beside the Staff entity. (Note that with 1:* relationships,
we choose a relationship name that makes sense in the 1:* direction.)
o If we know the actual minimum and maximum values for the multiplicity, we can
display these instead. For example, if a member of staff oversees a minimum of
zero and a maximum of 100 properties for rent, we can replace the ‘0..*’ with
‘0..100’.
You would read the relationships in Figure 13.2 in the following way: lecturer has one and
only one room and room can be associated with none or only one lecturer. Lecturer belongs
to one and only one department but department has one or more lecturers. Lecturer
teaches one or more courses and course must be taught by one or more lecturers. You will
Enhanced Entity relationship
The E-R model is sufficient to represent traditional database applications. To cater for the
additional concepts present in the newer databases, the Enhanced entity relationship model
has been created. These handle the concepts of types,
o Supertypes and subtypes,
o Inheritance, (not important)
o Specialisation and (not important)
o Generalisation. (not important)
The concept of specialization/generalization is associated with special types of entities
known as superclasses and subclasses, and the process of attribute inheritance. We begin
this section by defining what superclasses and subclasses are and by examining
superclass/subclass relationships. We describe the process of attribute inheritance and
contrast the process of specialization with the process of generalization. We then describe
the two main types of constraints on superclass/subclass relationships called participation
and disjoint constraints. We show how to represent specialization/generalization in an
Enhanced Entity–Relationship (EER) diagram using UML.
A type is defined by the common properties of a set of entities. Therefore any instance
entity is of at least one type, and it belongs to a type entity. Note that an instance entity can
be of a more than one type. E.g. In the type hierarchy illustrated, John is a clerk, but he is
also an employee and a person.
In the previous illustration, the Person was a supertype (superclass) and the Employee a
subtype (subclass). Similarly, The Employee is a supertype for the two subtypes Clerk and
Engineer. A subtype inherits all the properties of its supertypes.
Superclasses and Subclasses
o As we discussed in Chapter 11, an entity type represents a set of entities of the same
type such as Staff, Branch, and PropertyForRent. We can also form entity types into
a hierarchy containing superclasses and subclasses.
o Superclass An entity type that includes one or more distinct subgroupings of its
occurrences, which require to be represented in a data model.
o Subclass A distinct subgrouping of occurrences of an entity type, which require to be
represented in a data model.
o Entity types that have distinct subclasses are called superclasses. For example, the
entities that are members of the Staff entity type may be classified as Manager,
SalesPersonnel, and Secretary. In other words, the Staff entity is referred to as the
superclass of the Manager, SalesPersonnel, and Secretary subclasses. The
relationship between a superclass and any one of its subclasses is called a
superclass/subclass relationship. For example, Staff/Manager has a
superclass/subclass relationship.
Superclass/subclass relationships
o Each member of a subclass is also a member
of the superclass. In other words, the entity
in the subclass is the same entity in the
superclass, but has a distinct role. The
relationship between a superclass and a
subclass is one-to-one (1:1) and is called a
superclass/subclass relationship (see Section
11.6.1). Some superclasses may contain overlapping subclasses, as illustrated by a
member of staff who is both a Manager and a member of Sales Personnel. In this
example, Manager and SalesPersonnel are overlapping subclasses of the Staff
superclass. On the other hand, not every member of a superclass need be a member
of a subclass; for example, members of staff without a distinct job role such as a
Manager or a member of Sales Personnel.
o We can use superclasses and subclasses to avoid describing different types of staff
with possibly different attributes within a single entity. For example, Sales Personnel
may have special attributes such as salesArea and carAllowance. If all staff attributes
and those specific to particular jobs are described by a single Staff entity, this may
result in a lot of nulls for the job-specific attributes. Clearly, Sales Personnel have
common attributes with other staff, such as staffNo, name, position, and salary.
However, it is the unshared attributes that cause problems when we try to represent
all members of staff within a single entity. We can also show relationships that are
only associated with particular types of staff (subclasses) and not with staff, in
general. For example, Sales Personnel may have distinct relationships that are not
appropriate for all staff, such as SalesPersonnel Uses Car.
o To illustrate these points, consider the relation called AllStaff shown in Figure 12.1.
This relation holds the details of all members of staff no matter what position they
hold. A consequence of holding all staff details in one relation is that while the
attributes appropriate to all staff are filled (namely, staffNo, name, position, and
salary), those that are only applicable to particular job roles are only partially filled.
For example, the attributes associated
o with the Manager (mgrStartDate and bonus), SalesPersonnel (salesArea and
carAllowance), and
o Secretary (typingSpeed) subclasses have values for those members in these
subclasses. In other words, the attributes associated with the Manager,
SalesPersonnel, and Secretary subclasses are empty for those members of staff not
in these subclasses.
o There are two important reasons for introducing the concepts of superclasses and
subclasses into an ER model. Firstly, it avoids describing similar concepts more than
once, thereby saving time for the designer and making the ER diagram more
readable. Secondly, it adds more semantic information to the design in a form that is
familiar to many people.
o For example, the assertions that ‘Manager IS-A member of staff’ and ‘flat IS-A type
of property’, communicates significant semantic content in a concise form.
State-transition diagrams
State-transition diagrams (STD) show how the system behaves as a consequence of some
external stimuli. For this purpose the STD represents the state of the system and the
transitions into different states when an external event happens.
The structure of the data items within these models may be described in more detail within
the data dictionary. Similarly, the models will contain a more detailed description of the key
processes taking place.
The STD represents:
o • The state of the system, and
o • The transitions into different states …
… when an external action occurs
Undertaking design using the structured systems analysis paradigm
(Study guide)
Within software design the system requirements are translated into a detailed definition of
how the system can be implemented in computer executable code. The design process is a
creative one and, although methods and guidelines are helpful, judgment and flair on the
part of the software engineer are still required to design a software system. Within the
structured approach to systems analysis, the design process transforms the functional, data
and behavioural model created within the requirements analysis phase. It can be divided
into (Pressman, 2005):
o data design
o architectural design
o interface design
o component-level design.
Data design
o Data design transforms the data model into the data structures that will be required
to implement the system.
Architectural design
o Architectural design is concerned with determining the key modules that will exist in
the system and the links between these modules. These key modules describe all
the key functions that the system will have to provide.
o Structure charts
A common technique used within architectural design is structured design.
The data flow diagram created during the analysis phase builds the basis for
this technique. Within structured design the DFD, which has been refined to
a level at which all processes are primitive, is translated into a structure
chart. The structure chart provides information about the organisation of
the modules that eventually form the system and about the data that is
passed back and forward between these modules.
In order to construct a structure chart you need to be able to distinguish
between two kinds of processes (Hamlet and Maybee, 2001): those that
carry out data synthesis and those that carry out data refinement:
• A process said to carry out data synthesis transforms incoming data into
data that did not previously exist.
• A process said to carry out data refinement selects or merges incoming or
outgoing data.
Based on this distinction we refer to the part of a DFD that carries out the
main processes of data synthesis as the central transform of the DFD.
In Figure 6.3 the boundaries of the central transform within the DFD are
indicated by the oval around processes 2 and 3.
A structure chart (see Figure 6.4) can then be represented as follows
(Hamlet and Maybee, 2001): in the first instance the central transform of
the level-1 DFD is identified. The overall level-0 process is then represented
as a box. Underneath each incoming refinement transform, the central
transform, and each outgoing refinement transform is represented as a
branching box (no incoming refinement transforms exist in this example).
Although the refinement transform boxes are labelled with their transform
names, a new name is created for the central transform (in this case
‘Determination of Payments and Deductions’). The central transform is
branched out further into its components. Labelled arrows are introduced to
indicate the data flow between boxes (modules). The data that flows
between the modules at the highest level of the hierarchy (below the
control module) flows via the top box (the control module).
Figure 6.4 shows the structure chart for the level-1 DFD. In a next step
further structure charts need to be created for any lower level DFDs
following the same approach using the previous level DFD as a starting
point. In this case ‘Calculate Deduction and Net Pay’, for example, should be
branched out further. The completed structure chart, together with the data
dictionary, provides a detailed and structured overview of the system’s
modules and the data flows between them.
Interface design
o Interface design can be divided into internal, external and human computer
interface design (Pressman, 2005).
o Internal interface design is concerned with the design of interfaces in between
modules within the system. For example, the design of a system may be made up of
a data entry module, a data storage module and a data reporting module. The
interconnections between these three modules have to be identified clearly. What
happens, for example, when the data entry module receives some data that the
storage module determines to be invalid? Which module is responsible for informing
the system user of the error and obtaining new data?
o External interface design is concerned with the design of interfaces to other external
entities. A software application may require the input of some sensory data which
requires interfacing with an external entity (i.e. a data sensor). Note that external
interface design is also used in the same way within the object-oriented paradigm.
o Finally, human–computer interface design is concerned with providing good
usability for the system user. Although aspects of usability include factors of costs
and efficiency, human factor issues have gained increasing consideration in the
design of the human-computer interface.
o User interface design should be user-centred. The interface should ensure that the
users can interact with the system on their terms. It should be logical and consistent
and should include facilities to help users with the system and to recover from any
mistakes they may make. Graphical interfaces, where the user has multiple
windows, menus, iconic object representations and a pointing device, have the
major advantage that they are easy to use, since they are intuitive due to their self-
evidence.
o A detailed explanation of their use should not be required and consistency can easily
be maintained by using the same representation for the same actions in different
applications, like the use of icons in the windows environment.
o Many software development tools (e.g. programming languages, spreadsheets and
databases) provide user interface development tools. These allow you to design
your own user interface conforming to certain standards within the software. For
example, you may be able to define overlapping windows in various sizes, pull down
menus, dialogue boxes and pointing device support.
Component-level design
o Once data, architectural and interface design have been completed, more detailed
attention is paid to the individual components of the system within the component-
level design (also referred to as procedural design).
o This means that the data structures identified in the data model, the interface
identified during interface design, and the individual modules that have been
determined within the architectural design, now have to be described in more
detail. There are a number of ways in which this can be done. It is possible to use
pseudocode. Within pseudocode simple natural language (e.g. English) is combined
with more structured programming constructs in order to describe an algorithm.
o Pseudocode itself cannot be compiled, but it can easily be translated further into the
source code of a real programming language.
o Alternatively it is possible to use a graphical representation. Flowcharts are a
popular and long-established modelling technique that are particularly useful for the
representation of the algorithms within a module. A flow chart uses graphical
notations for the representation of the programming structures with which you are
familiar from 138 Information and communication technologies. (i.e. sequence,
repetition, selection). A box is used to represent one or a sequence of processing
steps, a diamond represents a logical condition, and the flow of control is indicated
by arrows that link boxes and diamonds. Within component-level design,
pseudocode and flowcharts (and other techniques which are not discussed here)
aim to reduce the level of abstraction of the previous design models. The resulting
procedural specification can then easily be translated into program code.
(pressman)