Question 01
i. Which of the following is not an attribute of complex systems?
A. Hierarchic structure.
B. Easy to disassemble.
C. Stable intermediate forms.
D. Separation of concerns.
Complex Systems and software complexity
Driven by complexity
The complexity of massive scale software systems exceeds the abilities to understand
all the subtle elements of its design. This is evidently an inherent property of these
systems. We have to master it, we cannot eliminate it.
all the subtle elements of its design. This is evidently an inherent property of these
systems. We have to master it, we cannot eliminate it.
World Complexity
More and more software systems have to directly deal with real world complexity.
(ex: think of fly-by-the-wire airplanes or self-driving cars) The complexity of the real
world is virtually limitless and we often have to model it by stochastic processes, rather
than deterministically. Effectively, there is no limit to how complex we can/should make
our software.
(ex: think of fly-by-the-wire airplanes or self-driving cars) The complexity of the real
world is virtually limitless and we often have to model it by stochastic processes, rather
than deterministically. Effectively, there is no limit to how complex we can/should make
our software.
Development issues
Then there is the problem of the software itself affecting planning; as it starts coming
to life, it influences the design plan. (ex: after some design/development, we see issues
we could not anticipate) This feedback increases complexity.
to life, it influences the design plan. (ex: after some design/development, we see issues
we could not anticipate) This feedback increases complexity.
Five attributes of complex systems
- Hierarchic Structure
More complex systems are (or can be) thought as having a hierarchical structure.
In some cases this is : self evident, In many cases this is : a conceptual way for us to
depict them. Without the hierarchical structure we couldn’t be able to see or talk
about complex systems.
depict them. Without the hierarchical structure we couldn’t be able to see or talk
about complex systems.
The hierarchical structure is essential to the functioning of the system, as much as
how the parts work.
how the parts work.
- Relative Primitives
Regarding the nature of the primitive components of a complex system, our
experience suggests that:
experience suggests that:
The choice of what components in a system are primitive is relatively arbitrary
and is largely up to the discretion of the observer of the system.
and is largely up to the discretion of the observer of the system.
What is primitive for one observer may be at a much higher level of abstraction
for another.
for another.
- Separation of Concerns
These hierarchical, complex systems are to some extent decomposable (parts
work per software engineer), but more often are to be modelled as nearly
decomposable because there are in fact dependences among parts.
work per software engineer), but more often are to be modelled as nearly
decomposable because there are in fact dependences among parts.
While it’s essential that intra-component dependencies are stronger than
inter-component ones, the latter are often there.
inter-component ones, the latter are often there.
Separation of concerns means, Identifying components that minimize
inter-component linkages is essential if we want to be able to deal with them
independently.
inter-component linkages is essential if we want to be able to deal with them
independently.
- Common Patterns
Complex systems have common patterns. These patterns may involve the
reuse of small components with minimal variations, such as the cells found in
both plants and animals, or of larger structures, such as vascular systems, also
found in both plants and animals.
reuse of small components with minimal variations, such as the cells found in
both plants and animals, or of larger structures, such as vascular systems, also
found in both plants and animals.
This is a useful property from the point of view of analysing and modelling these
systems.
systems.
- Stable Intermediate Forms / Evolution
As systems evolve, objects that were once considered complex become the
primitive objects, on which more complex systems are built. Furthermore, we
can never craft these primitive objects correctly the first time: We must use them
in context first and then improve them over time as we learn more about the real
behavior of the system.
primitive objects, on which more complex systems are built. Furthermore, we
can never craft these primitive objects correctly the first time: We must use them
in context first and then improve them over time as we learn more about the real
behavior of the system.
As systems evolved, previous systems can become primitives. Think of the
evolution from unicellular to multicellular organisms.
evolution from unicellular to multicellular organisms.
Ii. In a complex system a primitive is
A. a component that is not further decomposed in the hierarchy.
B. a software system before it is re-designed.
C. an initial hierarchy.
D. a native datatype.
Iii. Which of the following is true about complex system components:
A. They are completely decomposable into independent parts.
B. They may have dependencies between them.
iv. Abstraction is the process of:
A. Creating the most general implementation of an object.
B. Identifying the most important characteristics of the objects that
make up a problem domain.
make up a problem domain.
C. Removing details from an object.
D. Making an object reusable.
Principles/elements of Object model
Major elements
Abstraction (entity, action, virtual machine, coincidental)
- To hide information that is not relevant or rather show only relevant
- The process of forming of general and relevant concept from more
- It is the key to simplify a complex design into smaller, manageable parts
- It is the idea of hiding the complexity within a smaller/simple component
- Based on observable behaviour of an object.
- Denotes essential characteristics of an object that will distinguish it from
- Provide crisply defined conceptual boundaries, relative to the perspective
- Focuses on outside of the object, not its implementation.
Principle of least commitment :
interface of an object provides its essential behaviour,
nothing more.
nothing more.
Principle of least astonishment :
Abstraction captures the entire behaviour of some object,
no more no less and offers no surprises/ side effects beyond
the scope of abstraction.
no more no less and offers no surprises/ side effects beyond
the scope of abstraction.
Encapsulation (heart of OOP)
- The localization of the information or knowledge within an object, also called
- Objects encapsulate data and implementation details to the outside world.
- The behavior of this object is useful to the external world or other objects.
- An object encompass its behaviour by means of methods or functions.
- The set of functions an object exposes to other objects or external world acts
- Advantages :
- Code becomes more flexible, easy to change with new requirements,
- Makes unit testing easy.
- Can control who can see what.
- Can write unchangeable classes.
Abstraction
|
Encapsulation
|
Based on the observable
behaviour of an object |
Focuses on the implementation
that gives rise to that behaviour, even though it hides how it does it. |
Modularity (packaging in java)
- Especially for larger applications, we have hundreds of classes in them,
- by using modules is essential to help manage complexity.
- Modules serve as the physical containers in which we declare the classes
- Decompose system into a set of cohesive and loosely coupled modules.
- Group logically related abstractions (classes)
- Minimize dependencies among modules (make each data abstraction
An object ideally provide a crisp boundary, around a single abstraction, and both
encapsulation and modularity provide barriers around this abstraction.
encapsulation and modularity provide barriers around this abstraction.
Hierarchy (inheritance in java)
- A ranking or ordering of abstractions(classes)
- A set of abstractions often forms a hierarchy, by identifying hierarchies in our
- Inheritance is a mechanism of defining a new class based on an existing class.
- Existing class : parent class, super class
- Derived class : child class, sub class
- Inheritance defines a relationship among classes, from where, one class shares
- Single inheritance
- Multiple inheritance (not in java)
Multi Level inheritance (allowed in java)
- Two major hierarchies in an OO system
- Is-A
generalization/specialization relationship
Ex: A Rose Is-A Flower
- Has-A
aggregation/composition relationship
Ex : a Garden object maybe made up of a number of Plant objects.
Garden Has-A Mango_Plant, Garden Has-A Banana_Plant
Aggregation : Pond Has-A Duck, Pond Has-A Tortoise
Composition : Pond Has-A Fish, Car Has-A Carburetor
- Advantage of hierarchy/inheritance : code in base class need not be rewritten
as well.
- Disadvantage of multiple inheritance : when two or more superclasses provide
in the sub class. Is it possible? No, there should not be two members with the same
name or signature in one class.
Minor elements (Useful, but not essential part of the object model)
Typing (static, dynamic)
- Type means -> characterization of a set of elements.
- In OOP, a class is visualized as a type, having properties distinct from any
- Typing is the enforcement of the conception, that an object is an instance
- Objects of different types may not be interchanged, in general, but
- Can be interchanged only in very restricted manner.
Concurrency
In Operating Systems, concurrency allows performing multiple tasks or processes
simultaneously. When a single process exists in a system, it is said that there is a
single thread of control, but most systems have multiple threads, some active, some
waiting for CPU, some suspended and terminated.
simultaneously. When a single process exists in a system, it is said that there is a
single thread of control, but most systems have multiple threads, some active, some
waiting for CPU, some suspended and terminated.
Systems with multiple CPUs inherently permit concurrent threads of control, but
systems running on a single CPU, use appropriate algorithms to give CPU time
slots to the threads so as to enable concurrency. (ex: round robin algorithm)
systems running on a single CPU, use appropriate algorithms to give CPU time
slots to the threads so as to enable concurrency. (ex: round robin algorithm)
- In OOP, there are active and inactive objects.
- Concurrency is the property that distinguishes an active object from an
- Concurrency focuses on process abstraction and synchronization.
- System involving concurrency have many threads of control.
- The objects synchronize/cooperate with one another.
Persistence
“Persistence is the property of an object through which its existence transcends
time and/or space”
time and/or space”
- An object occupies a memory space and exists for a particular period of time.
- In some cases the time is small as the evaluation of an expression.
- In some cases, it is longer than the lifetime of a program. (ex: database)
- Persistence allows an object to continue existing even after its creator
- Persistence allows an object will exist by transcending the space its creator
it was created)
v. Entity abstraction chooses objects that
A. collect together a general set of actions.
B. can be used by a superior control.
C. are convenient for programming.
D. represent useful components of the problem domain.
Four Types of Abstraction;
- Entity Abstraction
An object that represents a useful model of a problem domain or solution domain
entity. It directly mirror the vocabulary of the problem. In an air traffic control system,
some of the entities that would be useful are aircraft, runway, and air corridor.
entity. It directly mirror the vocabulary of the problem. In an air traffic control system,
some of the entities that would be useful are aircraft, runway, and air corridor.
- Action Abstraction
An object that provides a generalised set of operations, all of which perform the
same kind of function. In the case of encryption and decryption of documents,
we can consider an object called scrambler, which embodies a general set of
encryption functions, each of some level of complexity.
same kind of function. In the case of encryption and decryption of documents,
we can consider an object called scrambler, which embodies a general set of
encryption functions, each of some level of complexity.
- Virtual Machine Abstraction
An object that groups operations that are all used by some superior level of control,
or operations that all use some junior-level set of operations. The depiction of the
Unix Operating System as a set of layers, from the kernel to the user file system
is an example of this. Considering a modern computer system as consisting of a
series of layers from the conventional machine level to the microprogramming level
to the machine language level to higher levels is another example of virtual machine
abstraction.
or operations that all use some junior-level set of operations. The depiction of the
Unix Operating System as a set of layers, from the kernel to the user file system
is an example of this. Considering a modern computer system as consisting of a
series of layers from the conventional machine level to the microprogramming level
to the machine language level to higher levels is another example of virtual machine
abstraction.
- Coincidental Abstraction
An object that packages a set of operations that have no (or maybe a little) relation
to each other. This form of packaging is not considered a good thing. We have an
extreme form of coincidental abstraction when we construct an object called security
and embody within this the methods for performing authentication, calculating the net
present value, etc.
to each other. This form of packaging is not considered a good thing. We have an
extreme form of coincidental abstraction when we construct an object called security
and embody within this the methods for performing authentication, calculating the net
present value, etc.
vi. A cohesive module is
A. one that has many dependencies inside it.
B. one that has many methods attached to it.
C. one that has few dependencies inside it.
D. one that allows for quick prototyping.
Issues to be considered when designing classes.
- Coupling
The strength of connection between classes. (depending on other classes) It is
better to have less coupling, limit coupling but there has to be some trade-off.
Inheritance makes for strong coupling.
better to have less coupling, limit coupling but there has to be some trade-off.
Inheritance makes for strong coupling.
- Cohesion
cohesion refers to the degree to which the elements of a module belong together.
Thus, cohesion measures the strength of relationship between pieces of functionality
within a given module. For example, in highly cohesive systems functionality is
strongly related.
Thus, cohesion measures the strength of relationship between pieces of functionality
within a given module. For example, in highly cohesive systems functionality is
strongly related.
- Sufficiency
Does the class capture enough of the details of the thing being modeled, to be
useful? The interface has enough to render the interaction of an object meaningful.
useful? The interface has enough to render the interaction of an object meaningful.
- Completeness
Does the class capture all of the useful behaviour of the thing being modeled to
be re-usable? What about the future users of the class? How much more time takes
to provide completeness?
be re-usable? What about the future users of the class? How much more time takes
to provide completeness?
- Primitiveness
An operation is primitive if it only works when given access to hidden aspects of
an abstraction. Primitiveness means that you shouldn't make a class unnecessarily
complicated. It is a principle that lets you control a large spectrum of behavior with
just a few operations.
an abstraction. Primitiveness means that you shouldn't make a class unnecessarily
complicated. It is a principle that lets you control a large spectrum of behavior with
just a few operations.
vii. A hierarchy may be defined as
A. a set of high-level components.
B. a measure of the importance of a set of objects.
C. an abstract definition of an object.
D. a ranking or ordering of abstractions.
viii. Object persistence is concerned with
A. the time over which an object exists.
B. objects that cannot be deleted.
C. methods that continue to execute until the correct answer is obtained.
D. the ability of objects to be run on independent threads.
ix. Static typing means that
A. the types of all variables and expressions are not known until runtime.
B. the types of all variables and expressions are known at compilation time.
C. the types of all variables and expressions must be specified by the programmer.
D. the types of all variables and expressions are independent of each other.
Static/Dynamic Typing
Static typing/ static binding/ early binding/ strong typing
The types of all variables and expressions (attributes, operations) are fixed/checked
at the compile time.
at the compile time.
Dynamic typing/ late binding/ weak typing
The types of all variables and expressions (attributes, operations) are not
known until runtime.
known until runtime.
x. Choose the best description of Object-oriented design:
A. A software design method that decomposes a problem into objects
and describes the logical and physical design of the system.
and describes the logical and physical design of the system.
B. A software design method which uses an object-oriented language such as C++.
C. A software design method that uses objects and methods.
D. A software design method that uses abstraction.
OOT - Object Oriented Technology
Built on an object model which encompasses principles; abstraction,
encapsulation, modularity, hierarchy, typing, concurrency, persistence.
encapsulation, modularity, hierarchy, typing, concurrency, persistence.
OOT is driven by evolution of programming, from small to large and by
new programming languages.
new programming languages.
OOP - Object Oriented Programming
Method of implementation in which programs are organized as cooperative
collections of objects, which are instances of classes, and these classes are
members of a class hierarchy via inheritance relationship.
collections of objects, which are instances of classes, and these classes are
members of a class hierarchy via inheritance relationship.
OOL - Object Oriented Language
Supports objects (which are data abstractions) to have an interface of
named operations, a hidden local state and an associated type (a class).
named operations, a hidden local state and an associated type (a class).
Supports types to inherit properties from supertypes.
OOD - Object Oriented Design
Method of design. It is about;
- Decomposition or divide a problem into objects
- Describe logical and physical design of a system, as well as static
OOD is based on abstracting (which is an innate activity) : to figure out the
general characteristics of a set of objects to understand them, and classify them.
general characteristics of a set of objects to understand them, and classify them.
OOA - Object Oriented Analysis
Initial part/ precursor of OOD. Method of analysis. Examines the requirements
from the perspective (what we can see) of the classes and objects found in the
vocabulary of problem domain.
from the perspective (what we can see) of the classes and objects found in the
vocabulary of problem domain.
Question 02
i. An object association is
A. a relationship between objects
B. data encapsulated in an object
C. a method to group objects together
D. a related program
ii. The multiplicity of an object association means:
A. the number of times the association is used in an object oriented design.
B. the number of labels used in the association.
C. that the association involves a numerical value.
D. the number of objects that can be connected to an end-point of the
association.
association.
iii. An association class is
A. the set of all possible associations.
B. a class used to describe an association relationship between two
or more other classes.
or more other classes.
C. a class at the end-point of an association link.
D. an abstract class that does not correspond to an entity from the problem
domain.
domain.
iv. The diagram in Figure 1 is an example of which type of UML diagram:
A. Class diagram.
B. Component diagram.
C. Package diagram.
D. Use case diagram.
v. The ball port on the diagram in Figure 1 means that the interface is
A. Provided.
B. Required.
vi. In UML, which of the following is not a behaviour diagram:
A. Use case diagram.
B. Activity diagram.
C. Deployment diagram.
D. State machine diagram.
vii. Which of the following does not represent a generalization relationship.
A. relationship between a mammal and a bear.
B. relationship between a father and a child.
C. relationship between an insect and a bee.
D. relationship between an employee and a manager.
viii. Which one of the following is an aggregation relationship.
A. relationship between a finger and a thumb.
B. relationship between a mother and a child.
C. relationship between a bird and an eagle.
D. relationship between a team and the team players.
Associations between objects → Relationships between objects
- Unidirectional (an arrow directed from owner to owned)
- A Student has a PencilBox
Student know his/her pencil box, but pencil box don’t know whom it belongs
to.
to.
- A Customer purchases an Automobile
Customer knows his/her Automobile, but automobile don’t know its’ owner
- Bidirectional (a line between owner and owned)
- Roles (roles of the relationship. Ex: “owner”, “owned”)
- Multiplicity
- How many objects from one class associate with how many objects in a
Multiplicity
|
Option
|
Cardinality
|
0..0
|
0
|
Collection must be empty
|
0..1
|
No instances or 1 instance
| |
1..1
|
1
|
Exactly 1 instance
|
0..*
|
*
|
0 or more instances
|
1..*
|
At least 1 instance
| |
5..5
|
5
|
Exactly 5 instances
|
m..n
|
At least m but no more than n
instances (m , n are integers) |
- Association Class
If an association’s attribute is more complicated to characterize by a single
data type, can use a separate association class.
Ex: Person works for Company each Person-Company association
needs a Position to complete model. Position will be the association class
that helps to characterize the association.
needs a Position to complete model. Position will be the association class
that helps to characterize the association.
- Aggregation/Composition (Has-A, Is a part of)
Both are same, (ex: Garden has Mango Plant, Garden has Banana Plant)
but in composition the contained classes (Mango Plant, Banana Plant)
are strongly dependent on the life cycle of the container (Garden).
If container class is destroyed,the contained classes are also vanished.
In aggregation, not dependent, Plant objects will remain even when the
Garden is destroyed.
are strongly dependent on the life cycle of the container (Garden).
If container class is destroyed,the contained classes are also vanished.
In aggregation, not dependent, Plant objects will remain even when the
Garden is destroyed.
A House has a Kitchen, and a Kitchen has a Stove.
Using Association Class
|
Has-A
|
- Generalization (Is-A)
The class that holds the generalized characteristics is the base class
(ex: Vehicle)
(ex: Vehicle)
Classes Airplane, Boat, Car are all kinds of Vehicles, these
classes implement any specialized behaviours.
classes implement any specialized behaviours.
A Cas is a Vehicle
A Boat is a Vehicle
- Multiple Inheritance
class Teacher : public Person, public Employee {
private :
void sleep();
void work();
void teach();
}
About Polymorphism
Classification
You will be given a UML diagram, notations. You should be familiar with all these.
01) Structural Diagrams
- Class Diagram
2. Object Diagram
3. Composite Structure Diagram
02) Behavioural Diagrams
- Use Case Diagram
- Sequence Diagram
- State Machine DIagram
- Activity Diagram
- Communication Diagram/Collaboration Diagram
- Interaction Diagrams
- Timing Diagrams
03) Implementation Diagrams
- Component Diagram
- Deployment Diagram
04) Model management Diagrams
- Package Diagram
- Profile Diagram
Vocabulary
No comments:
Post a Comment