lecturer 2
TRANSCRIPT
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 1/34
Principles of object oriented
systems
Software Engineering Department
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 2/34
Software Engineering and Databases
y Software engineering is a profession and field of study
dedicated to designing, implementing, and modifying
software
y The term software engineering first appeared in the 1968
NATO Software Engineering Conference, and was meant
to provoke thought regarding the perceived "software
crisis" at the time.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 3/34
Software Engineering and Databases
y Since the field is still relatively young compared to its
sister fields of engineering, there is still much debate
around what software engineering actually is, and if it
conforms to the classical definition of engineering.
y The IEEE Computer Society's Software Engineering Body
of Knowledge defines "software engineering" as the
application of a systematic, disciplined, quantifiable
approach to the development, operation, andmaintenance of software, and the study of these
approaches; that is, the application of engineering to
software.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 4/34
Software Engineering and Databases
y One of the most important techniques reducing complexity
of software syetms is abstraction.
y An abstraction denotes the essential characteristics of an
object that distinguish it from all other kinds of objects andthus provide crisply defined conceptual boundaries, relative to
the perspective of the viewer.
y Exist in any design proceses.
y Allows developers to modularize program easily andnaturally, speeding up designing large software projects.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 5/34
Software Engineering and Databases
y Database systems are often large software systems
with the following features:
y A large data stored in the exteral memory and need to be organized in a way that gurrantee
updating effectivelly
y Data entities have complex inter-relationships
y Data needs to be shared between users and the
integrity must be maintained
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 6/34
Software Engineering and
Databases
y Providing appropriate tools for processing effectively
data, especially with large databases, is a difficult task
of conventional programming languages.
y However, representing complex data objects can be
done with some modern languages.
y This allows us defining abstract data objects and
equivalent methods => important for database
applications.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 7/34
Software Engineering and Databases
y Commercial database systems usually provide
simple data types
y => affects designer and programmers.
y This requires new capabilities for creating complex
data types
y => forming object-oriented databases.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 8/34
Software Engineering and
Databases
y The difference between OOB and conventional
databases is that
y it focuses on defining complex data types and data
abstraction.
y Certainly, it can be benefited from results of research in
OOP.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 9/34
Software Engineering and
Databases
y Objects in OOB and OOP are both used for data
encasulation
y
Differences:y Objects in OOB are persistent (even the loop of creating it
is completed ) as oppose to objects in OOP.
y OOB supports versioning. This allows accessing different
versions of the same objects, i.e databases recording
yOOB can be interleaved with conditions from theapplications.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 10/34
Cycle of databases
y Requirement analysis
y Data modelling and software design
y Execution
y Testing
y Maintenance
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 11/34
Notes on software design
y Three aspects of software design:
y Reliability : The software follows the all
specifications and operate well in both normallas well as abnormal conditions.
y Ex tendability : Can be compatible with some
changes of specifications and database.
yReusability : Modules can be reused in otherapplications.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 12/34
Testing
y Quality of a database system is measured based on
corectness and reliablity.
y
Goals of testing:y Detect errors in periods of modelling and execution.
y Determine if the system satisfies the user needs?.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 13/34
Maintenance
y Practically it is not possible to carry a complete testing
for a large database system. Further, some errors might
happen during later use.
y Tasks:
y Repair corruptions during the usage.
y Implement change sof systems responding to the new
requirements.
y Implement schames to improve effectiveness and user interface.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 14/34
Object Oriented Systems
y The term object-oriented seems to be the buzzword of
the 1980s and 1990s.
y
Everybody is using it, but with such a wide range ofdifferent meanings that no one seems to know exactly
what the other is saying.
y It appears in several disciplines, including programming
languages, databases and knowledge bases, artificial
intelligence and computer systems in general.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 15/34
Object-Orientation - What Does
it Mean?
y Object-orientation can be seen as a kind of technique of
organizing a system in terms of objects.
y The foundation of the whole approach is encapsulation. This
means that the properties of data and the procedures for themanipulation of this data are combined into an object.
y Encapsulation restricts the effects of change by placing a wall
of code around pieces of data.
yThe objects communicate through messages which invoke theobjects procedures, usually called methods.
y Hence, manipulation of the data is provided by those
methods only
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 16/34
Features of OO Systems
y object,
y type,
y inheritance,
y abstraction,
y concurrency, and
y persistence
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 17/34
Object and Abstraction
y The dimensions object and abstraction reflect the basic
principle of encapsulation, which can be found in
conventional languages like Modula-2 or Ada.
y An abstraction denotes the essential characteristics of an
object that distinguish it from all other kinds of objects
and thus provide crisply defined conceptual boundaries,
relative to the perspective of the viewer.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 18/34
Object and Abstraction
y Entity abstraction An object that represents a usefulmodel of a problem domain or solution domain entity
y Action abstraction An object that provides a generalized
set of operations, all of which perform the same kind offunction
y Virtual machine abstraction An object that groupsoperations that are all used by some superior level ofcontrol, or operations that all use some junior-level setof operations
y Coincidental abstraction An object that packages a setof operations that have no relation to each other
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 19/34
Example: defining a class
Class Fruit{
int grams;
int cals_per_gram;
int total _calories() {
return( grams*cals_per_gram);
}
}
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 20/34
Inheritance
y Inheritance is the more innovative part of the approach,
because it is not provided by these conventional
programming languages.
y It is a tool for (automatically) broadcasting definitions
of attributes and methods from already defined pieces
of data and operations to pieces developed separately
and thus supports reusability.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 21/34
Inheritance Example
y Class C is a subclass of class B (itssuperclass) if its declaration has the formclass C extends B {
«
}
y The subclass is a specialization of thesuperclass
y The superclass is a generalization of thesubclass
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 22/34
Concurrency
y The dimension of concurrency introduces the term
process.
y A process-based language extends the autonomy of objects
to the autonomy in time,y that is, operations may be executed concurrently or
separately depending on the systems need or even started
by these needs (triggers, daemons)
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 23/34
Concurrency
y Concurrency focuses on process abstraction andsynchronization. The object is a concept that unifies thesetwo different viewpoints:
y Each object (drawn from an abstraction of the real world)
may represent a separate thread of control (a processabstraction). Such objects are called active.
y In a system based on an object-oriented design, we canconceptualize the world as consisting of a set of cooperativeobjects, some of which are active and thus serve as centers
of independent activity. Given this conception, we defineconcurrency as follows:
y Concurrency is the property that distinguishes an activeobject from one that is not active.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 24/34
Persistency
y Adding the dimension of persistency reflects the fact,
that there is a trend toward extending object-oriented
programming languages in the direction of databases,
y This occurs in parallel with the attempt of extending
database systems with object-oriented ideas.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 25/34
Persistency
y Object oriented languages and object-oriented
databases are natural complements of one another.
y The first one emphasizes processing, complex structuring
and local data,y the second one focuses on a more declarative approach,
consistency, persistency, sharing, and support for very large
amounts of data.
y The merger of these activities could be an object-
oriented database programming language which
combines the aspects of a programming language and a
database model.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 26/34
Polymophism
y Further essential object-oriented concepts are object-identity
and polymorphism.
y The first one means that an object exists independent of the
value it represents. This allows objects to share subobjects
and to be cyclic. Furthermore, such objects can be updated
without loosing their identity.
y The latter one provides the overloading of methods such that
the same message elicits (semantically similar) responses
depending on the class of the receiver object.
y Note, that this is facilitated by the message-passing paradigm
as a message specifies only a method identifier for an object
and not the code to be executed.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 27/34
Principles
y Encapsulation of data and methods:
y Encapsulation provides data abstraction.
y The state of an object is accessible only through its methods. Thestate of the object is generally represented by variables which arehidden from the clients.
y The implementation of the methods are not visible outside of anobject. A method is a piece of code that implements an operation onan object state. The set of methods defined for an object determinethe behavior of the object.
y Objects communicate through message passing.
y Methods and message passing:
y A message consists of an addressee, a method selector, and possiblyseveral actual parameters. In response to a message, the receiverinvokes the method identified by the selector specified within themessage.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 28/34
Principles
y Classification and instantiation:
y Objects are collected into classes. A class determines thestructural and behavioral properties of its instances. Thestructural properties are specified by a set of variables, the
behavioral properties by a set of methods.
y Class taxonomy and inheritance:
y A class is interpreted as a template for the creation of theinstances of the class, i.e., it defines both the type of theseinstances, and the way these instances are created as
reflections of real world 'things'. Classes are organized in alattice. A class may inherit operations from "superclasses" andmay have its operations inherited by "subclasses". Inheritanceis defined narrowly as a mechanism for resource sharing inclass hierarchies.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 29/34
Advantages
y E xtensibility, f lexibility, and changeability:
y Most DBMSs provide a fixed set of data types (e.g., relationalDBMSs provide relations and field types).
y An object-oriented system provides (1) predefined classes/types, (2) mechanisms to define new classes/types, and (3) auniform way of treating system and user definedclasses/types.
y Hence, new object classes/types including their methods canbe incorporated into the system.y Changes of object types/ classes and their methods are localized
to the relevant types/classes and are much easier controlled thanin conventional record-based systems, where many record typesmay be affected by a change.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 30/34
Advantages
y Consistent interpretation of data:
y Because of encapsulation, the behavior associated with an object type ispredetermined by a fixed set of operations.
y
Therefore, the database operations are constrained to be within thespecifications of these operations. This induces a more consistent interpretationof data by application programs.
y Modeling power:
y Inheritance of both variables and methods is a very powerful tool for datamodeling.
y It is a kind of modularization and supports the specification of reusable typedefinitions.
y In general, the modeling principles of generalization/specialization,identification, and aggregation are well supported in some object-oriented datamodels.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 31/34
The motivation for object-
oriented data models
y Impedance mismatch:
y Applications using conventional database technology suffer
under the need of two different languages, a database
language (e.g., SQL) and a host language (e.g., COBOL, PL/1).
y Since the type systems of these languages, different data
must be converted from one language environment to the
other one, and often type checking is lost.
y Different processing strategies require concepts like a cursor
to scan relations. In contrast to the host language the
database language is incomplete with respect to computationand recursion.
y Furthermore, the database language usually is a declarative
one, whereas the host language is procedural.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 32/34
The motivation for object-
oriented data models
y New applications require non-standard and complex
objects and operations:
y The conventional database technology does not satisfy
these special requirements e.g., in the field of AI,CAD/CAM, Engineering, CASE, or (multimedia) office
automation, although database technology plays a crucial
role in all these fields.
y New modelling techniques, the handling of complex
structures and multimedia data are required as well as
extensibility and flexibility, next to a high degree of
modularity and reusability for building these complex
applications.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 33/34
Extended concepts
y Object-oriented programming is a method of implementationin which programs are organized as cooperative collections ofobjects, each of which represents an instance of some class,and whose classes are all members of a hierarchy of classes
united via inheritance relationships.
y Object-oriented design is a method of design encompassingthe process of object oriented decomposition and a notationfor depicting both logical and physical as well as static anddynamic models of the system under design.
y Object-oriented design is a method of design encompassingthe process of objectoriented decomposition and a notationfor depicting both logical and physical as well as static anddynamic models of the system under design.
8/8/2019 Lecturer 2
http://slidepdf.com/reader/full/lecturer-2 34/34
The End