Você está na página 1de 13

Software Complexity

Elements of software complexity


1) The Complexity of the Problem Domain
- Understanding the problem domain
- Difficulty in capturing requirements
- Frequent changes in requirements
- Lack of expertise in the Domain
- Contradicting requirements
2) Difficulty in managing the Development Process
- Strive to build simple system
- So invent powerful mechanisms to reduce the code
- use existing reusable frameworks and patterns
- select the team as small as possible so that co-ordination can
be maintained
3) Flexibility possible through software
- Allowing the developers to depict any kind of abstraction
(Information in the problem domain)
4) Problem of characterizing the behavior of the systems
- In large systems we have hundreds of modules and with more than
one thread of control in it.
- such large systems may exhibit either continuous or discrete
behavior
- Continuous Systems - whose output can be predicted at any time
and varies continuosly
- Discrete Systems – whose output cannot be predicted, anything can
happen at any time
- eg: Aircraft Control

Software developed will be a best one if all these elements were understood and
handled properly. Else this complexity will result in projects that are
- Late
- Over Budget
- Deficient (lack) in their requirements
This process of developing software that is late, over budget and deficient in
requirements is called as Software Crisis. Solution to solve the Software crisis
problem is Decomposition (Divide and Conquer). It means
- Decompose the system into various modules
- Analyze, design and implement these modules individually
- Then integrate all these individual modules to get the overall
system
Types of Decomposition
1) Algorithmic Decomposition
Each module in the system denotes a major step in some overall process
- Used in Structured/Top-Down Approach
- Difficult to reuse
2) Object Oriented Decomposition
- Decomposing the system according to the key abstractions (classes
and objects) in the system
- It is a Bottom-up Approach
- Reusability is highly ensured
- Better to go for Object oriented than algorithmic decomposition.

The Object Model


- It comprises the set of elements upon which the Object oriented
technology was built.

Foundations of Object Model


Object Oriented Analysis (OOA)
Object Oriented Design (OOD)
Object Oriented Programming (OOP)

Object Oriented Analysis (OOA)


- Earlier phase of software development
- It is the method of analyzing the problem domain
- It is defined as the process of analyzing the requirements in the form of
classes and objects found in the problem domain
- The product of OOA serves as the models from which we may start OOD
- Example:
Use case Analysis, CRC cards...

Object Oriented Design (OOD)


- It is defined as the method of decomposing the system.
- It uses different set of notations to express different views
(Static/Dynamic as well as Physical/Logical) of the system.
- The product of OOD serves as the models from which we may start OOP
- Example:
Booch Notations are used to draw different diagrams. For example
* Class Diagram (Static view)
* Interaction Diagram (Dynamic view)
* Class Diagram (Logical view)
* Module Diagram (Physical view)
Object Oriented Programming (OOP)
- It is the method of implementation in which the programs are organized
in the form of collection of objects, each of which represents an instance of some
class, and whose classes are all members of a hierarchy of classes united via
inheritance relationships.
- Example:
Java, C++, Smalltalk, ada…

Elements of Object Model


- The elements of object model acts as a basis for any object oriented
technology. It is broadly classified into 2 categories. They are
Major Elements:
By major we mean that without any one of these
elements any model/program is not considered as the object oriented one.
They are abstraction, encapsulation, modularity and hierarchy.
Minor Elements:
By minor we mean that they are useful elements but not
essential one. They are typing, concurrency, persistence

Major Elements:

1) Abstraction
- A good abstraction is one that emphasizes details that are
significant to the user and suppresses details that are atleast for the moment
immaterial.
- It denotes the essential characteristics of an object that distinguish
it from all other kinds of objects.
- Example:
Any class is an example of abstraction.
2) Encapsulation
- Encapsulation is the process of compartmentalizing the elements of
abstractions (data members and member functions) that constitute its structure
and behavior
- Encapsulation protects the data from corruption
- Example:
Any class is an example for encapsulation.
3) Modularity
- It is a way of developing the systems architecture.
- It is defined as the property of the system that has been
decomposed into a set of cohesive and loosely coupled modules
- Example:
The java programs are modularized in the form of Packages
(Collection of classes)

4) Hierarchy
- It is the process of ranking or ordering the abstractions (classes &
objects)
- An object-oriented system organizes classes into subclass-super
hierarchy.
- At the top of the hierarchy are the most general classes and at the
bottom are the most specific
- A subclass inherits all of the properties and methods (procedures)
defined in its superclass.
Example:
M o to r V e h ic le

B us T ru c k C ar

- Inheritance is a relationship between classes where one class is the parent class
of another (derived) class.
- Inheritance allows classes to share and reuse behaviors and
attributes
- The real advantage of inheritance is that we can build upon what
we already have and,
- Reuse what we already have

Types of Inheritance:
Single, Multiple, Hybrid, Multi level..
Example:
Multiple Inheritance:
For example utility vehicle inherents from Car and Truck classes
MotorVehicle

Truck Car Bus

UtilityVehicle

Minor Elements:
1) Typing
- It is the enforcement of the class of an object, such that objects of
different types may not be interchanged, or at the most, they may be interchanged
only in very restricted ways.
Examples of Typing:
- Strong/Weak Typing:
- A given programming language may be strongly typed,
weakly or untyped
- eg: int a; float b=10.0;a=b;
- Eiffel is a strongly typed language that it does not accept the
above conversion from float to int.
- Smalltalk, C++ is an untyped language where it truncates the
decimal value any assigns integer 10 to variable ‘a’
Strong Typing:
- In strongly typed languages, the type conformance is strictly enforced.
- The violations are known at the compile time itself.
Weak Typing:
- In Weakly typed languages, the type conformance is not strictly enforced.
- The violations are known only at the run time.
Another example of typing is Static/Dynamic binding:
- Binding is the time the variable are bound to types
- Static binding is the types are bound to variable at compile time itself.
- Example: ‘C’ language supports static binding
-Dynamic binding is the types are bound to variable at run time itself.
- Example: ‘C++’ language supports dynamic binding
2) Concurrency
- It is the property that many objects act at the same time.
- ie more than one processes are executed at the same time
(concurrently)
- It is achieved in JAVA through multi-threading concept
3) Persistence
- Objects have a lifetime.
- An object can persist beyond application session boundaries,
during which the object is stored in a file or a database, in some file or database
form.
- It saves the state and behavior of an object across time and space.

Advantages of object model are:


- The ability to reuse code
- Faster development
- Increased quality
- develop more maintainable systems in a shorter amount of time.
- More resilient to change (easy updations)
- More reliable, since they are built from completely tested and debugged
classes.

Objects:
- Objects are defined as any tangible and/or visible entity in this real world
that exhibits some well defined properties and behavior.
- It is an instance of a class.
- An object possess state, behavior and identity

State of an object:
- State represents all of its both static as well as dynamic properties
- Example:
Attributes describe objects states.
-In the Car example the car’s attributes are:
- Color, manufacturer, cost, owner, model..

Identity of an object:
- Property that distinguishes an object from all other kinds of objects.
- It gives a unique identification to the object

Behavior of an object:
- Behavior is how an object acts/reacts in terms of its state (properties)
changes
- It is nothing but the operations performed by the object.
Example:
- Methods define objects behavior and specify the way in which an
Object’s data are manipulated.
- In the Car example the car’s methods are:
- drive it, lock it, tow it, carry passenger in it.
Types:
- Modifier: operations that alters the state of the object
- Selector: operations that access the selected state of the object and do not
change it.
- Iterator: operations that access the state of the object in a well defined
order and do not change it.
- Constructor: operation that initializes the state of the object
- Destructor: operation that free the memory allocated to the object

Types of object:
- There are two types of objects. They are
Active objects and Passive objects
An active object is one that encompasses its own thread of control. An active
object is autonomous (ie) they exhibit some behavior without being operated
upon by another object.
A passive object is one that does not encompass its own thread of control.
They exhibit some behavior when explicitly being operated upon by another
object
Example:
Main object (active object)

thread1 thread2 thread3 (passive because initiated by main


object)

Relationships between objects


1) Link
- It denotes a physical/conceptual connection between objects.
- It denotes a specific association through which one object applies the
service to another or through which one object may navigate to another.
- It denotes a client/server relationship between objects.
- Message passing between objects is normally unidirectional and
occasionally be bidirectional
- Notation to represent a link is a line connecting objects.
- Example:
Object 1

Object2
: Pilot

: Planes

In a link an object play three important roles they are,


Actor:
An object that can operate upon other objects and is never operated upon
by other objects. (Clients)
Server:
An object that can never operate upon other objects and is operated upon
by other objects
Agent:
An object that can act as both actor and the role of server.

Visibility:
If one object wants to send a message to other object means only if there
are visible to each other. ie either of 4 cases must satisfy for visibility.
1) Supplier object is global to client
2) Supplier object is a parameter to some operations of the client
3) Supplier object is part of the client object
4) The supplier object is a locally declared object in some operations of the
client
Aggregation
It represents a whole/part relationship.
It is a specialized kind of association in which one object represents a
whole thing and other represents part of the whole.
:CAR

:ENGINE :WHEEL
:SEAT

Class:

- Class is defined as an abstract entity that represents a set of objects that


share a common set of properties and behavior.
- Each class has two different views. They are Interface and
Implementation.
- Interface:
 Interface of a class provides its Outside/External view
 Thus it leads to information hiding
 It consists only of the declarations of all operations,
constants and variables.
 We can divide interface normally into three portions.
They are Public, Private and Protected portions.
For example:
C++ ----- all 3 are supported
ADA ----- public and private
Smalltalk ----- variables are private & Methods
are public

- Implementation:
 It is the inside view of the class
 Implementation of all of the operations defined in the
interface of the class

Relationships between classes


1) Inheritance:
 An object-oriented system organizes classes into subclass-
superclass hierarchy.
 At the top of the hierarchy are the most general classes and at
the bottom are the most specific.
 A subclass inherits all of the properties and methods
(procedures) defined in its super class.
 Inheritance is a relationship between classes where one class is
the parent class of another (derived) class.
 Inheritance allows classes to share and reuse behaviors and
attributes.
 The real advantage of inheritance is that we can build upon
what we already have and,
 Reuse what we already have

E m p l o y e e
n a m e
a d d r e s s
s a l a r y
S S #

O f f i c e W o r Mk e ar n a g eP r r o d u c t i o n W o r

d a t a E n t r y d a t a E n t r y d a t a E n t r y
C o m p u t e P a y C r o o l m l p u t e P a y Cr o o l ml p u t e P a y r o l l
p r i n t R e p o r t p r i n t R e p o r t p r i n t R e p o r t

Association :

It denotes some semantic dependency among unrelated classes. It denotes a


physical/conceptual connection between classes. An association is given with
additional details. They are as follows.

1) cardinality
It defines how many occurrence/instance of one class is related to
how many occurrence/instance of another class.
It is also called as multiplicity.
There are different kinds of cardinality exists. They are
One to One
One to Many
Many to One
Many to Many

2) Association role
Role played by the classes in the relationship is placed at the end of
the relationship.

3) Navigability
This gives the direction in which the relationship is read out.

Example:
m 1
Person Company
employer employee

Aggregation:

 It represents a whole/part relationship.


 It is a specialized kind of association in which one object represents a
whole thing and other represents part of the whole.
 A hollow diamond is attached to the end of the path to indicate aggregation

Example:

has
TEAM PLAYERS

Using:
• A special form of association is a client-server relationship called using
relationship.
• This relationship can be viewed as one-way interaction i.e. one way
navigability exists among the classes where one class (client) requests the
service of another class (server).

Example:

P rin tS e rv e r R e q u e s t fo r p r in tin g Ite m

Instantiation:

A parameterized class is a generic class that is type-safe.


A parameterized class cannot have instances unless we instantiate
(creating objects) it.
Instantiation is a relationship between the parameterized class and the
class that instantiate it.

Example:

Item Integer

Queue IntegerQueue

Meta-Classes

A Meta class is a class whose instances are also classes. They are
supported in smalltalk. The primary purpose of metaclasses in smalltalk is
to provide the class variable i.e. static variables that is common to all the
objects.

Você também pode gostar