0% found this document useful (0 votes)
55 views

Software Construction: Software Complexity Why Object Oriented? Object Oriented Methodology

The document discusses software complexity and object-oriented methodology. It covers factors that affect software quality like complexity and change. It defines complexity and discusses its two types: essential complexity due to the underlying problem, and incidental complexity added unnecessarily. It outlines principles of object-oriented design like abstraction, encapsulation, decomposition, and generalization that help deal with complexity and create better models.

Uploaded by

Suzana Younas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

Software Construction: Software Complexity Why Object Oriented? Object Oriented Methodology

The document discusses software complexity and object-oriented methodology. It covers factors that affect software quality like complexity and change. It defines complexity and discusses its two types: essential complexity due to the underlying problem, and incidental complexity added unnecessarily. It outlines principles of object-oriented design like abstraction, encapsulation, decomposition, and generalization that help deal with complexity and create better models.

Uploaded by

Suzana Younas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 32

Software Construction

Lecture 2
Software Complexity
Why Object Oriented?
Object Oriented Methodology

1
Software Engineering: Definition
Software Engineering is a collection of techniques,
methodologies and tools that help
with the production of

• a high quality software system


• with a given budget
• before a given deadline

while change occurs.

• Factors effecting the quality of software systems


• Complexity 2
• Change
What is Complexity?
• Complexity is a measure of how hard something is to
understand or achieve
• Components — How many kinds of things are there to be aware of?
• Connections — How many relationships are there to track?
• Requirements — Challenging & volatile requirements

• Two kinds of complexity:


• Essential Complexity – How complex is the underlying problem?
• Incidental Complexity – What unnecessary complexity have we added?
3
What is Complexity?
• Structure of Complex Systems
• Structure of a personal computer
• Computer  CPU, Monitor, DVD, Hard disk Drive
• CPU  ALU, RAM
• ALU  Registers, arithmetic logic
• Registers  gates, inverters
• Structure of matter
• Galaxies  arranged in clusters, stars, planets
• Developing large scale software systems is a great challenge
• Applications that maintain the integrity of hundreds of thousands of
records of information while allowing concurrent updates and queries
• e.g. NADRA, Airline reservation system, air traffic control, Microsoft
Windows 4
LOC
Year Operating System
(Millions)
1993 Windows NT 3.1 4-5
1994 Windows NT 3.5 7-8
1996 Windows NT 4.0 11+
2000 Windows 2000 29 +
2001 Windows XP 45 5
2003 Windows Server 2003 50

Source: http://en.wikipedia.org/wiki/Source_lines_of_code
How Big is a Million Lines of Code?
• For 50,000,000 (50 Millions) lines of code
• If you were to try to count that high, and could actually say the
names of the numbers between one and fifty million at a steady
rate of one per second
• It would take you more than 1.5 years to count that high without
pausing to eat, drink, sleep, or even draw a very deep breath

• Even counting at that rate to the 5,000,000 of NT 3.1 would take


you about four months

• 1 million lines of code = 18, 000 pages of printed text

6
source: http://www.informationisbeautiful.net/visualizations/million-lines-of-code/
The inherent complexity of
software
• It is extremely difficult for the individual developer to
comprehend all the details of its design
• The complexity of such systems exceeds the human
intellectual capacity
• This complexity seems to be an essential property of all
large software systems
• Essential means that we may master this complexity, but we
can never make it go away

7
Why Software Is Inherently Complex?
• Brooks suggests
“The complexity of software is an essential property, not an
accidental one” [Brooks. No Silver Bullet]

• This inherent complexity derives from four elements;


• the complexity of the problem domain
• the difficulty of managing the development process
• the flexibility possible through software
• the problems of characterizing the behavior of discrete systems

8
Elements of the inherent
complexity
• The complexity of the problem domain
• Requirements for the electronic system of a multiengine aircraft, or an
autonomous robot
• Effects of nonfunctional requirements
• Communication gap between the users and developers
• Change requirements during development
• Systems tend to evolve over time - software maintenance
• maintenance - when we correct errors
• evolution when we respond to changing requirements
• preservation when we continue to use extraordinary means to
keep an ancient and decaying piece of software in operation.
9
Elements of the inherent
complexity
• The difficulty of managing the development process
• Software development cannot be managed as a set of steps in linear fashion
• Requirements Specification, followed by System Design followed by Implementation
followed by Testing and Delivery
• Software Development is highly nonlinear
• The flexibility possible through software
• It is possible for a developer to express almost any kind of abstraction
• It forces the developer to craft virtually all the primitive building blocks on
which these higher-level abstractions stand
• The problems of characterizing the behavior of discrete systems
• Within a large application, there may be hundreds or even thousands of
variables/states 10
Four Design Principles
These principles help to deal with complexity and
create better object oriented models

1.Abstraction
2.Encapsulation
3.Decomposition
4.Generalization
11
1. Abstraction
• Inherent human limitation to deal with complexity
• The 7 +- 2 phenomena

• Abstraction is the idea of simplifying a concept in the


problem domain.
• It breaks a concept down into a simplified description
that ignores unimportant details and emphasizes the
essentials needed for the concept, within some context

12
1. Abstraction
• The essential characteristics of an abstraction can be
understood in two ways:
(1) through basic attributes and (2) through basic behaviors
or responsibilities.
• Basic attributes are characteristics that do not disappear over
time. Although their values may change, the attributes
themselves do not.
• Example
• The concept of a lion may have an age attribute. value of age
may change, but the lion always has an age attribute.
• A lion may have behaviors such as hunting, eating, and
sleeping. These are also responsibilities that the lion 13
abstraction does for its purpose of living
2. Encapsulation
• This principle involves a concept that allows something to be
contained in a capsule, some of which you can access from the
outside and some of which you cannot.
• There are three ideas behind encapsulation.
1.The ability to “bundle” attribute values (or data) and behaviors
(or functions) that manipulate those values, into a self-
contained object.
2.The ability to “expose” certain data and functions of that
object, which can be accessed from other objects.
3.The ability to “restrict” access to certain data and functions to
only within the object.
14
3. Decomposition
• It consists of taking a whole thing, and dividing it into different parts.

• Alternately, decomposition can also indicate taking separate parts with


different functionalities and combining them to create a whole.

• The general rule for decomposition is to look at the different


responsibilities of a whole and evaluate how the whole can be separated
into parts that each have a specific responsibility.

• Decomposition allows problems to broken into smaller pieces that are


easier to understand and solve.

• Two important hierarchies


• "Part of" hierarchy
15
• "Is-kind-of" hierarchy
Part of Hierarchy
Computer

I/O Devices CPU Memory

Cache ALU Program


Counter 16
Is-Kind-of Hierarchy
Cell

Muscle Cell Blood Cell Nerve Cell

Red White

17
4. Generalization
• Generalization helps reduce redundancy when solving problems.
• In coding, algorithmic behaviors are often modelled as methods.
• A method allows a programmer to generalize a behavior, so the
behavior can be applied to different input data.
• This generality reduces the need to have identical code throughout a
program.
• In object-oriented modelling, generalization is a main design principle,
but beyond creating a method that can be applied to different data,
object-oriented modelling achieves generalization by classes through
inheritance.
• In generalization we take repeated, common, or shared characteristics
between two or more classes and factor them out into another class.
18
4. Generalization
• It is achieved through inheritance
• Two kinds of classes: a parent class, and a child class.
• Parent classes capture general ideas and generally have broader
application.
• Repeated, common, or shared characteristics
• Child classes inherit attributes and behaviors of parent classes.
• It is possible for multiple child classes to inherit from a single parent
class.
• Multiple child classes will all receive these common attributes and
behaviors, child class can have additional attributes and behaviors
that allow them to be more specialized in what they can do.
• Parent class - superclass and child class - subclass.
• Inheritance allows a superclass to form a generalization and for its
19
subclasses to be more specialized
Generalization Example
• Concepts: Cat & Dog

• Attributes: legs, tail, color, name

• Behaviors: walk, eat, sleep

General term: Animal

20
What is a Model?
• A hypothetical representation/description of a complex
entity or process (Abstraction of reality)
• A description of static and/or dynamic characteristics of a
subject area
• Model organizes & communicates the important details of
the real world problem & system to build
• Visualized with views – visual projections of model (e.g.
UML diagrams)
21
Models are used to provide
abstractions
• Object Model: What is the structure of the system? What are the
objects and how are they related? (static model)

• Functional model: What are the functions of the system? How is


data flowing through the system?

• Dynamic model: How does the system react to external events?


How is the event flow in the system ?

Object Model Forward


Engineering

class... Reverse
class... Code Engineering
Functional class...

Model 22
Dynamic Model
Why Do We Model?
• To deal with complexity
• Recall Windows example
• This amount of code is not easily understandable by developers
• Need simpler representations for complex systems
• To understand why a software system is needed, what it should do, and
how it should do it
• To communicate our understanding of why, what and how
• To detect commonalities and differences in the perceptions of various
parties involved
• To detect misunderstandings and miscommunications
23
Why Object-Oriented?
• Provides two strong weapons to deal with complexity

• Decomposition: Decomposition of a bigger problem into small

manageable parts (Divide & Conquer)

• Abstraction: “Focusing on the essential elements of a complex

problem and ignoring those elements that are unessential and

distinguish an object from other objects”

24
Why Object-Oriented?

• Paradigm: “way of looking at things”

Programming Paradigms
Imperative Procedures & Algorithms
Function-oriented Mathematical functions
Logic-oriented Goals, Predicate logic
Object-oriented Classes & Objects

25
Object Oriented Analysis & Design (OOAD)

• Object oriented analysis


• Emphasizes the finding & describing objects in the problem domain.
• Example: flight reservation system - Plane, Flight, Pilot etc.

• Object oriented design


• Emphasizes the defining software objects and how they collaborate
with each other to fulfill the requirements (relationship between the
classes)

• During object-oriented programming, design objects are 26


implemented as classes in Java.
Example: OO Design and Implementation

27
Software Lifecycle Activities
...and their models

Requirements System Object Implemen-


Analysis Testing
Elicitation Design Design tation

Implemented
Expressed in By
Structured By Realized By
Terms Of Verified
By

class...
class...
class... ?
class.... ?
Use Case Application Solution
Domain Subsystems Source Test
Model Domain
Objects Code Cases 28
Objects
Various Concepts

• Object, Class, Instance, Instantiation, Abstract class,

Concrete class, Specialization, Generalization, Subclass,

Super class, Inheritance, State, Event, Operation, Method

29
Application and Solution Domain
• Application Domain (Requirements Analysis)
• The environment in which the system is operating

• Solution Domain (System Design, Object Design)


• The available technologies to build the system

30
Some benefits of object oriented methodology

• Reusability
– classes can be reused or inherited
• Stability
– over time, classes become more stable
• Easier Design
– black box concept
• Faster Design
– create applications from existing components
31
Questions???

32

You might also like