Scsa1401 - Ooase - Unit 4
Scsa1401 - Ooase - Unit 4
Characteristics of OOD
Objects are abstractions of real-world or system entities and manage themselves
During the design phase the Classes in o-o- analysis must be revisited with a shift
in focus to their implementation. New Classes or attributes and methods must be added
for implementation purposes and their user interfaces.
The o-o design process consists of the following activities (Fig 4.1):
A theorem = is a proposition that may not be self-evident but can be proven from
accepted axioms. Therefore, is equivalent to a law or principle?
A theorem is valid if its referent axioms & deductive steps are valid.
A corollary = is a proposition that follows from an axiom or another proposition
that has been proven.
Suh‘s design axioms to OOD :
Axiom 1 : The independence axiom. Maintain the independence of
components
Axiom 2 : The information axiom. Minimize the information content of
the design.
Axiom 1 states that, during the design process, as we go from requirement and
use-case to a system component, each component must satisfy that requirement,
without affecting other requirements
Axiom 2 concerned with simplicity. Rely on a general rule known as Occam’s
razor.
Occam’s razor rule of simplicity in OO terms :
The best designs usually involve the least complex code but not necessarily
the fewest number of classes or methods. Minimizing complexity should be the
goal, because that produces the most easily maintained and enhanced application.
In an object-oriented system, the best way to minimize complexity is to use
inheritance and the system’s built-in classes and to add as little as possible to what
already is there.
COROLLARIES
From the two design axioms, many corollaries may be derived as a direct
consequence of the axioms. These corollaries may be more useful in making specific
design decisions, since they can be applied to actual situations more easily than the
original axioms. They even may be called design rules, and all are derived from the two
basic axioms (see Figure 4.2 ):
Fig 4.2 The origin of corollaries. Corollaries 1, 2, and 3 are from both axioms,
whereasCorollary 4 is from axiom 1 and corollaries 5 and 6 are from
axiom 2.
Corollary 1. Uncoupled design with less information content. Highly cohesive
objects can improve coupling because only a minimal amount of essential
information need be passed between objects.
Corollary 2. Single purpose. Each class must have a single, clearly defined
purpose. When you document, you should be able to easily describe the purpose
of a class in a few sentences.
Corollary 3. Large number of simple classes. Keeping the classes simple allows
reusability.
Corollary 4. Strong mapping. There must be a strong association between the
physical system (analysis's object) and logical design (design's object).
Corollary 5. Standardization. Promote standardization by designing
interchangeable components and reusing existing classes or components.
Corollary 6. Design with inheritance. Common behavior (methods) must be
moved to super classes. The super class-subclass structure must make logical
sense.
Highly cohesive objects can improve coupling because only a minimal amount of
essential information need be passed between objects.
The main goal is to maximize objects cohesiveness among objects and
software components in order to improve coupling because only a minimal
amount of essential information need be passed between components.
Coupling
Cohesion
Cohesion deals with interaction within a single object or software component.
Need to consider interaction within a single object or sw component Cohesion
Cohesion reflects the ‘single-purposeness‘ of an object ( see corollaries 2
&3)
Highly cohesive components can lower coupling because only a minimum of
essential information need be passed between components.
Cohesion also helps in designing classes that have very specific goals and
clearly defined purposes.
Method cohesion a method should carry only one function.
A method carries multiple functions is undesirable.
Class cohesion means that all the class's methods and attributes must be highly
cohesive, meaning to be used by internal methods or derived classes' methods.
Inheritance cohesion is concerned with the following questions: 1.How
interrelated are the classes? 2.Does specialization really portray specialization or
is it just something arbitrary? See Corollary 6, which also addresses these
questions.
Corollary 2. Single Purpose
Each class must have a purpose. Every class should be clearly defined and
necessary in the context of achieving the system's goals.
When you document a class, you should be able to easily explain its purpose in a
sentence or two.
If you cannot, then rethink the class and try to subdivide it into more independent
pieces. In summary, keep it simple; to be more precise, each method must provide only
one service.
Each method should be of moderate size, no more than a page; half a page is
better.
Object-oriented analysis and object-oriented design are based on the same model.
As the model progresses from analysis to implementation, more detail is added, but
it remains essentially the same. For example, during analysis we might identify a
class Employee.
During the design phase, we need to design this class design its methods, its
association with other objects, and its view and access classes.
A strong mapping links classes identified during analysis and classes designed
during the design phase (e.g., view and access classes).
Corollary 5. Standardization
To reuse classes, you must have a good understanding of the classes in the object
oriented programming environment you are using. Most object-oriented systems, such as
Smalltalk, Java, C+ +, or PowerBuilder, come with several built-in class libraries.
Similarly, object-oriented systems are like organic systems, meaning that they grow
as you create new applications.
The knowledge of existing classes will help you determine what new classes
are needed to accomplish the tasks and where you might inherit useful behavior
rather than reinvent the wheel. However, class libraries are not always well
documented or, worse yet, they are documented but not up to date.
The concept of design patterns might provide a way to capture the design
knowledge, document it, and store it in a repository that can be shared and reused
in different applications.
When you implement a class, you have to determine its ancestor, what attributes it
will have, and what messages it will understand. Then, you have to construct its methods
and protocols. Ideally, you will choose inheritance to minimize the amount of program
instructions. Satisfying these constraints sometimes means that a class inherits from a
superclass that may not be obvious at first glance.
For example, say, you are developing an application for the government that
manages the licensing procedure for a variety of regulated entities. To simplify the
example, focus on just two types of entities: motor vehicles and restaurants. Therefore,
identifying classes is straightforward. All goes well as you begin to model these two
portions of class hierarchy. Assuming that the system has no existing classes similar to a
restaurant or a motor vehicle, you develop two classes, MotorVehicle and Restaurant.
Subclasses of the MotorVehicle class are Private Vehicle and
CommercialVehicleo These are further subdivided into whatever level of specificity
seems appropriate (see Figure 4.4 ).
You know you need to redesign the application-but redesign how? The answer
depends greatly on the inheritance mechanisms supported by the system's target
language. If the language supports single inheritance exclusively, the choices are
somewhat limited. You can choose to define a formal super class to both MotorVehicle
and Restaurant, License, and move common methods and attributes from both classes
into this License class (see Figure4.5 ).
Fig 4.5 The single inheritance design modified to allow licensing food trucks.
Achieving Multiple Inheritance in a Single Inheritance System
Single inheritance means that each class has only a single superclass. This
technique is used in Smalltalk and several other object-oriented systems. One result of
using a single inheritance hierarchy is the absence of ambiguity as to how an object
will respond to a given method; you simply trace up the class tree beginning with
the object's class, looking for a method of the same name.
However, languages like LISP or C++ have a multiple inheritance scheme
whereby objects can inherit behavior from unrelated areas of the class tree. This could be
desirable when you want a new class to behave similar to more than one existing class.
However, multiple inheritance brings with it some complications, such as how to
determine which behavior to get from which class, particularly when several ancestors
define the same method. It also is more difficult to understand programs written in a
multiple inheritance system.
One way of achieving the benefits of multiple inheritance in a language with
single inheritance is to inherit from the most appropriate class and add an object of
another class as an attribute or aggregation. Therefore, as class designer, you have two
ways to borrow existing functionality in a class. One is to inherit it, and the other is to use
the instance of the class (object) as an attribute. This approach is described in the next
section.
Avoiding Inheriting Inappropriate Behaviors
DESIGN PATTERNS
Object-oriented development :
Object-oriented development Object-oriented analysis, design and programming
are related but distinct OOA is concerned with developing an object model of the
application domain OOD is concerned with developing an object-oriented system model
to implement requirements OOP is concerned with realising an OOD using an OO
programming language such as Java or C++
The UML is a graphical language with a set of rules and semantics. The rules and
semantics of the UML are expressed in English, a form known as OBJECT
CONSTRAING LANGUAGE. OCL is a specification language that uses simple logic
for specifying the properties of a system.
Many UML modeling constructs require expression: For eg; there are expressions
for types, Boolean values and numbers.
Expressions are stated as strings in ocl. The syntax for some common
navigational expressions is shown here. These forms ca be chained together. The
Leftmost element must be an expression for an object or a set of objects. The expressions
are meant to work on sets of values when applicable.
O-O design is an iterative process. After all, design is as much about discovery as
construction.
CLASS VISIBILITY: DESIGNING WELL-DEFINED PUBLIC, PRIVATE,
AND PROTECTED PROTOCOLS
In designing methods or attributes for classes, you are confronted with two
problems. One is the protocol, or interface to the class operations and its visibility; and
the other is how it is implemented.
Often the two have very little to do with each other. For example, you might have
a class Bag for collecting various objects that counts multiple occurrences of its elements.
One implementation decision might be that the Bag class uses another class, say,
Dictionary (assuming that we have a class Dictionary), to actually hold its elements. Bags
and dictionaries have very little in common, so this may seem curious to the outside
world. Implementation, by definition, is hidden and off limits to other objects.
The class's protocol, or the messages that a class understands, on the other hand,
can be hidden from other objects (private protocol) or made available to other objects
(public protocol).
Public protocols define the functionality and external messages of an object;
private protocols define the implementation of an object.
A class also might have a set of methods that it uses only internally, messages to
itself. This, the private protocol (visibility) of the class, includes messages that normally
should not be sent from other objects; it is accessible only to operations of that class. In
private protocol, only the class itself can use the method.
The public protocol (visibility) defines the stated behavior of the class as a citizen
in a population and is important information for users as well as future descendants, so it
is accessible to all classes.
If the methods or attributes can be used by the class itself or its subclasses, a
protected protocol can be used.
In a protected protocol (visibility), subclasses the can use the method in addition
to the class itself.
Lack of a well-designed protocol can manifest itself as encapsulation leakage. The
problem of encapsulation leakage occurs when details about a class's internal
implementation are disclosed through the interface. As more internal details become
visible, the flexibility to make changes in the future decreases. If an implementation is
completely open, almost no flexibility is retained for future carefully controlled.
However, do not make such a decision lightly because that could impact the flexibility
and therefore the quality of the design.
Items in these layers define the implementation of the object. Apply the design
axioms and corollaries, especially Corollary 1 (uncoupled design with less information
content, see Chapter 9) to decide what should be private: what attributes (instance
variables)? What methods? Remember, highly cohesive objects can improve coupling
because only a minimal amount of essential information need be passed between objects.
PUBLIC PROTOCOL LAYER: EXTERNAL
Items in this layer define the functionality of the object. Here are some things to
keep in mind when designing class protocols:
*. Good design allows for polymorphism.
*. Not all protocol should be public; again apply design axioms and corollaries
Attribute Types
Attributes represent the state of an object. When the state of the object changes,
these changes are reflected in the value of attributes. The single-value attribute is the
most common attribute type. It has only one value or state. For example, attributes such
as name, address, or salary are of the single-value type.
OCL can be used during the design phase to define the class attributes. The
following is the attribute presentation suggested by UML :
visibility name: type-expression =initial- value
The multiplicity of 0..1 provides the possibility of null values: the absence of a
value, as opposed to a particular value from the range. For example, the following
declaration permits a distinction between the null value and an empty string: name[O..lj:
String
In this section, we go through the ViaNet bank ATM system classes and refine the
attributes identified during object-oriented analysis.
Fig 4.6 A more complete UML class diagram for the ViaNet bank system.
The main goal of this activity is to specify the algorithm for methods identified so
far. Once you have designed your methods in some formal structure such as UML
activity diagrams with an OCL description, they can be converted to programming
language manually or in automated fashion.
Corollary 1, that in designing methods and protocols you must minimize the
complexity of message connections and keep as low as possible the number of messages
sent and received by an object. Your goal should be to maximize cohesiveness among
objects and software components to improve coupling, because only a minimal amount of
essential information should be passed between components. Abstraction leads to
simplicity and straightforwardness and, at the same time, Increases class versatility. The
requirement of simplification, while retaining functionality, seems to lead to increased
utility. Here are five rules :
1. If it looks messy, then it's probably a bad design.
2. If it is too complex, then it's probably a bad design.
3. If it is too big, then it's probably a bad design.
4. If people don't like it, then it's probably a bad design.
5. If it doesn't work, then it's probably a bad design.
The following operation presentation has been suggested by the UML. The
operation syntax is this :
Fig 4.7An activity diagram for the BankClient class verifyPassword method, using OCl
to describe the diagram. The syntax for describing a class's method is Class
name::methodName.
BankClient Class VerifyPassword Method
The following describes the verifyPassword service in greater detail. A client PIN
code is sent from the ATMMachine object and used as an argument in the verify-
Password method. The verify Password method retrieves the client record and checks the
entered PIN number against the client's PIN number. If they match, it allows the user to
proceed. Otherwise, a message sent to the ATMMachine displays "Incorrect PIN, please
try again" (see Figure 4.7).
The verifyPassword methods' performs first creates a bank client object and
attempts to retrieve the client data based on the supplied card and PIN numbers. At this
stage, we realize that we need to have another method, retrieveClient. The
retrieveClientmethod takes two arguments, the card number and a PIN number, and
returns the client object or "nil" if the password is not valid. We postpone design of the
retrieveClient method to next chapter.
Fig 4.8 An activity diagram for the Account class deposit method.
Fig 4.9 An activity diagram for the account class withdraw method.
Fig 4.10An activity diagram for the Account class createTransaction method.
Checking Account Class withdraw method
This is the checking account-specific version of the withdrawal service. It takes
into consideration the possibility of withdrawing excess funds from a companion savings
account. The description is as follows. An amount to be withdrawn is sent to a checking
account and used as the argument to the withdrawal service. If the account has
insufficient funds to cover the amount but has a companion savings account, it tries to
withdraw the excess from there. If the companion account has insufficient funds, this
method returns the appropriate error message. If the companion account has enough
funds, the excess is withdrawn from there, and the checking account balance goes to zero
(0). If successful, the account records the withdrawal by creating a transaction object
containing the date and time, posted balance, and transaction type and amount.
Persistence refers to the ability of some objects to outlive the programs that
created them.
Object lifetimes can be short for local objects (called transient objects) or long
for objects stored indefinitely in a database (called persistent objects).
Most object-oriented languages do not support serialization or object persistence,
which is the process of writing or reading an object to and from a persistence storage
medium, such as disk file.
A program will create a large amount of data throughout its execution. Each item
of data will have a different lifetime.
Atkinson et al. describe six broad categories for the lifetime of data:
1. Transient results to the evaluation of expressions.
2. Variables involved in procedure activation (parameters and variables with a
localized scope).
3. Global variables and variables that are dynamically allocated.
4. Data that exist between the executions of a program.
5. Data that exist between the versions of a program.
6. Data that outlive a program.
The first three categories are transient data, data that cease to exist
beyond the lifetime of the creating process.
The other three are nontransient, or persistent, data.
Programming languages provide excellent, integrated support for the first
three categories of transient data.
The other three categories can be supported by a DBMS, or a file system.
The same issues also apply to objects; after all, objects have a lifetime, too. They
are created explicitly and can exist for a period of time (during the application session).
However, an object can persist beyond application session boundaries, during which the
object is stored in a file or a database. A file or a database can provide a longer life for
objects-longer than the duration of the process in which they were created. From a
language perspective, this characteristic is called persistence. Essential elements in
providing a persistent store are :
Identification of persistent objects or reachability (object ID).
Properties of objects and their interconnections. The store must be able to
coherently manage nonpointer and pointer data (i.e., interobject
references).
Scale of the object store. The object store should provide a conceptually
infinite store.
Stability. The system should be able to recover from unexpected failures
and return the system to a recent self-consistent state. This is similar to
the reliability requirements of a DBMS, object-oriented or not.
DATABASEMANAGEMENT SYSTEMS
Databases usually are large bodies of data seen as critical resources to a company.
A DBMS is a set of programs that enable the creation and maintenance of a collection of
related data.
DBMSs have a number of properties that distinguish them from the file-based
data management approach.
In traditional file processing, each application defines and implements the files it
requires. Using a database approach, a single repository of data is maintained, which can
be defined once and subsequently accessed by various users (see Figure ).
Database Views
*. The DBMS provides the database users with a conceptual representation that
is independent of the low-level details (physical view) of how the data are stored.
*. The database can provide an abstract data model that uses logical concepts
such as field, records, and tables and their interrelationships. Such a model is understood
more easily by the user than the low-level storage concepts.
*. This abstract data model also can facilitate multiple views of the same
underlying data.
*. Many applications will use the same shared information but each will be
interested in only a subset of the data.
*. The DBMS can provide multiple virtual views of the data that are tailored to
individual applications. This allows the convenience of a private data representation with
the advantage of globally managed information.
Database Models
Hierarchical Model: The hierarchical model represents data as a single rooted tree.
Each node in the tree represents a data object and the connections represent a parent-
child relationship.
For example, a node might be a record containing information about Motor vehicle and
its child nodes could contain a record about Bus parts (see Figure 4.12).
Fig. 4.12 A hierarchical Model
Network Model : A network database model is its’ record can have more than one
parent. For example, in Figure 4.13 , an Order contains data from the Soup and Customer
nodes.
Fig 4.13: An order contains data from both customer and soup
Relational Model: This database model is the relation, which can be thought of as a
table. The columns of each table are attributes that define the data or value domain for
entries in that column. The rows of each table are tuples representing individual data
objects being stored. A relational table should have only one primary key.
A primary key is a combination of one or more attributes whose value
unambiguously locates each row in the table.
In Figure , Soup-ID, Cust-ill, and Order-ill are primary keys in Soup, Customer, and
Order tables.
A foreign key is a primary key of one table that is embedded in another table to
link the tables. In Figure 4.14 , Soup-ill and Cust-ill are foreign keys in the Order table.
Fig 4.14 : The fig depicts primary and foreign key in a relation database.
Database Interface
For example, to create logical structure or schema, the following SQL command
can be used:
CREATE SCHEMA AUTHORIZATION (creator)
CREATE DATABASE (database name)
For example,
CREATE TABLE INVENTORY (Inventory_Number CHAR(10) NOT NULL
DESCRIPTION CHAR(25) NOT NULL PRICE DECIMAL (9, 2));
Data and objects in the database often need to be accessed and shared by different
applications. With multiple applications having access to the object concurrently, it is
likely that conflicts over object access will arise. The database then must detect and
mediate these conflicts and promote the greatest amount of sharing possible without
sacrificing the integrity of data. This mediation process is managed through concurrency
control policies, implemented, in part, by transactions.
Concurrency Policy
*. When several users (or applications) attempt to read and write the same object
simultaneously, they create a contention for object.
*. A basic goal of the transaction is to provide each user with a consistent view
of the database. This means that transactions must occur in serial order.
*. Thus, a process can be allowed to obtain a read lock on an object already write
locked if its entire transaction can be serialized as if it occurred either entirely
before or entirely after the conflicting transaction. The reverse also is true:
*. A process may be allowed to obtain a write lock on an object that has a read
lock if its entire transaction can be serialized as if it occurred after the conflicting
transaction. In such cases, the optimistic policy allows more processes to operate
concurrently than the conservative policy.
Many modern databases are distributed databases, which imply that portions of
the database reside on different nodes (computers) and disk drives in the network.
Usually, each portion of the database is managed by a server, a process responsible for
controlling access and retrieval of data from the database portion.
The server dispenses information to client applications and makes queries or data
requests to these client applications or other servers.
Clients generally reside on nodes in the network other than those on which the
servers execute. However, both can reside on the same node, too.
*. The server can take different forms. The simplest form of server is a file
server.
*. With a file server, the client passes requests for files or file records over a
network to the file server. This form of data service requires large bandwidth (the range
of data that can be sent over a given medium simultaneously) and can considerably slow
down a network with many users.
*. Traditional LAN computing allows users to share resources, such as data files
and peripheral devices.
*. More advanced forms of servers are database servers, transaction servers,
application servers, and more recently object servers.
*. With database servers, clients pass SQL requests as message to the server and
the results of the query are returned over the network. Both the code that process the SQL
request and the data reside on the server, allowing it to use its own processing power to
find the requested data. This is in contrast to the file server, which requires passing all the
records back to the client and then letting the client find its own data.
*. With transaction servers, clients invoke remote procedures that reside on
servers, which also contain an SQL database engine. The server has procedural
statements to execute a group of SQL statements (transactions), which either all succeed
or fail as a unit.
*. The applications based on transaction servers, handled by on-line transaction
processing (OLTP) tend to be mission-critical applications that always require a 1-3
second response time and tight control over the security and the integrity of the database.
The communication overhead of a single request and reply (as opposed to multiple SQL
statements in database servers).
*. Application servers are not necessarily database centered but are used to serve
user needs, such as downloading capabilities from Dow Jones or regulating an electronic
mail process. Basing resources on a server allows users to share data, while security and
management services, also based on the server, ensure data integrity and security.
* The logical extension of this is to have clients and servers running on the
appropriate hardware and software platforms for their functions. For example, database
management system servers should run on platforms especially with special elements for
managing files.
*. In a two-tier architecture, a client talks directly to a server, with no
intervening server. This type of architecture typically is used in small environments with
less than 50 users. A common error in client-server development is to prepare a prototype
of an application in a small two-tier environment then scale up by simply adding more
users to the server. This approach usually will result in an ineffective system, as the
server becomes overwhelmed. To properly scale up to hundreds or thousands of users, it
usually is necessary to move to three-tier architecture.
*. A three-tier architecture introduces a server (application or Web server)
between the client and the server. The role of the application or Web server is manifold.
It can provide translation services (as in adapting a legacy application on a mainframe to
a client-server environment), meeting services ( as in acting as a transaction monitor to
limit the number of simultaneous requests to a given server), or intelligent agent services
(as in mapping a request to a number of different servers, collating the results, and
returning a single response to the client).
1. User interface. This major component of the client-server application interacts with
users, screens, windows, Windows managements, keyboard, and mouse handling.
2. Business processing. This part of the application uses the user interface data to
perform business tasks. In this book, we look at how to develop this component by
utilizing an object-oriented technology.
3. Database Processing. This part of the application code manipulates data within the
application. The data are managed by a database management system, object oriented or
not. Data manipulation language , such as SQL or a dialect of SQL (perhaps, an object –
oriented query language). Ideally , the DBMS processing is transparent to the business
processing layer of the application.
IDL Definitions are stored in an interface repository, a sort of phone book that
offers object interfaces and services. For distributed enterprise computing, the
interface repository is central to communication among objects located on
different systems.
Microsoft’s ActiveX/DCOM
Microsoft’s component object model (COM) and its successor the distributed
component object model (DCOM) are Microsoft’s alternatives to OMG’s distributed
object architecture CORBA.
Microsoft and the OMG are competitors, and few can say for sure which
technology will win the challenge.
Although CORBA benefits from wide industry support, DCOM is supported
mostly by one enterprise, Microsoft.
However, Microsoft is no small business concern and hold firmly a huge part of
the microcomputer population, so DCOM has appeared a very serious competitor to
CORBA. DCOM was bundled with Windows NT 4.0 and there is a good chance to see
DCOM in all forthcoming Microsoft products.
The distributed component object model, Microsoft’s alternative to OMG’s
CORBA, is an Internet and component strategy where ActiveX (formerly known as
object linking and embedding, or OLE) plays the role DCOM object. DCOM also is
backed by a very efficient Web browser, the Microsoft Internet Explorer.
1. The system must support complex objects. A system must provide simple atomic types
of objects (integers, characters, etc.) from which complex objects can be built by applying
constructors to atomic objects or other complex objects or both.
2. Object identity must be supported. A data object must have an identity and
existence independent of its values.
3. Objects must be encapsulated. An object must encapsulate both a program and its
data. Encapsulation embodies the separation of interface and implementation and the
need for modularity.
4. The system must support types or classes. The system must support either the type
concept (embodied by C++ ) or the class concept (embodied by Smalltalk).
5. The system must support inheritance. Classes and types can participate in a class
hierarchy. The primary advantage of inheritance is that it factors out shared code and
interfaces.
6. The system must avoid premature binding. This feature also is known as late binding
or dynamic binding Since classes and types support encapsulation and inheritance, the
system must resolve conflicts in operation names at run time.
7. The system must be computationally complete. Any computable function should be
expressible in the data manipulation language (DML) of the system, thereby allowing
expression of any type of operation.
8. The system must be extensible. The user of the system should be able to create new
types that have equal status to the system's predefined types. These requirements are met
by most modem object-oriented programming languages such as Smalltalk and C+ +.
Also, clearly, these requirements are not met directly (more on this in the next section) by
traditional relational, hierarchical, or network database systems. Second, these rules make
it a DBMS:
9. It must be persistent, able to remember an object state. The system must allow the
programmer to have data survive beyond the execution of the creating process for it to be
reused in another process.
10. It must be able to manage very large databases. The system must efficiently manage
access to the secondary storage and provide performance features, such as indexing,
clustering, buffering, and query optimization.
11. It must accept concurrent users. The system must allow multiple concurrent users
and support the notions of atomic, serializable transactions.
12. It must be able to recover from hardware and software failures. The system must be
able to recover from software and hardware failures and return to a coherent state.
13. Data query must be simple. The system must provide some high-level mechanism for
ad-hoc browsing of the contents of the database. A graphical browser might fulfill this
requirement sufficiently. These database requirements are met by the majority of existing
database systems. From these two sets of definitions it can be argued that an OODBMS is
a DBMS with an underlying object-oriented model.
4.17.1 Object-Oriented Databases versus Traditional Databases
OBJECT-RELATION MAPPING
TABLE-CLASS MAPPING
Fig 4.19 Table-multiple classes mapping. The custiD column provides the discriminant.
If the value for custlD is null, an Employee instance is created at run time; otherwise, a
Customer instance is created.
In this approach, each row in the table represents an object instance and each column in
the table corresponds to an object attribute. This one-to-one mapping of the table-class
approach provides a literal translation between a relational data representation and an
application object. It is appealing in its simplicity but offers little flexibility.
In table-inherited classes mapping, a single table maps to many classes that have
a common superclass. This mapping allows the user to specify the columns to be shared
among the related classes. The superclass may be either abstract or instantiated.
In Figure 4.21 , instances of salariedEmployee can be created for any row in the
Person table that has a non null value for the Salary column. If Salary is null, the row is
represented by an hourly Employee instance.
Fig 4.22 Tables-inherited classes mapping. Instances of Person are mapped directly from
the Person table. However, instances of Employee can be created only for the rows in the
Employee table (the joining of the Employee and Person tables on the ssn key).The ssn is
used both as a primary key on the Person table and.as a foreign key on the Person table
and a primary key on the Employee table for activating instances of type Employee.
Figure 4.22 shows an example that maps a Person table to class Person and then
maps a related Employee table to class Employee, which is a subclass of class Person. In
this example, instances of Person are mapped directly from the Person table. However,
instances of Employee can be created only for the rows in the Employee table ( the
joining of the Employee and Person tables on the SSN key). Furthermore, SSN is used
both as a primary key on the Person table for activating instances of Person and as a
foreign key on the Person table and a primary key on the Employee table for activating
instances of type Employee.
Keys for Instance Navigation
MULTIDATABASE SYSTEMS
ODBC is similar to Windows print model, where the application developer writes to
a generic printer interface and a loadable driver maps that logic to hardware-
specific commands. This approach virtualizes the target printer or DBMS because
the person with the specialized knowledge to make the application logic work with the
printer or database is the driver developer and not the application programmer. The
application interacts with the ODBC driver manager, which sends the application
calls (such as SQL statements) to the database. The driver manager loads and unloads
drivers, perform status checks and manages multiple connections between applications
and data sources
The main idea behind creating an access layer is to create a set of classes that
know how to communicate with the place(s) where the data actually reside. Regardless of
where the data reside whether it be a file, relational database, mainframe, Internet,
DCOM or via ORB, the access classes must be able to translate any data-related requests
from the business layer into the appropriate protocol for data access. These classes also
must be able to translate the data retrieved back into the appropriate business objects. The
access layer‘s main responsibility is to provide a link between business or view objects
and data storage. Three-layer architecture is similar to 3-tier architecture. The view layer
corresponds to the client tier, the business layer to the application server tier and the
access layer performs two major tasks:
Translate the request: The access layer must be able to translate any data related
requests from the business layer into the appropriate protocol for data access.
Translate the results: The access layer also must be able to translate the data
retrieved back into the appropriate business objects and pass those objects back
into the business layer.
Here design is tied to any base engine or distributed object technology such as
CORBA or DCOM. Here we can switch easily from one database to another with
no major changes to the user interface or business layer objects. All we need to
change are the access classes‘ methods.
• Unlike object oriented DBMS systems, the persistent object stores do not
support query or interactive user interface facilities.
• Controlling concurrent access by users, providing ad-hoc query capability and
allowing independent control over the physical location of data are not possible with
persistent objects.
• The access layer (AL), which is a key part of every n-tier system, is mainly
consist of a simple set of code that does basic interactions with the database or any other
storage device. These functionalities are often referred to as CRUD (Create, Retrieve,
Update, and Delete).
• The data access layer need to be generic, simple, quick and efficient as much as
possible. It should not include complex application/ business logics.
• I have seen systems with lengthy, complex store procedures (SP), which run
through several cases before doing a simple retrieval. They contain not only most part of
the business logic, but application logic and user interface logic as well. If SP is getting
longer and complicated, then it is a good indication that you are burring your business
logic inside the data access layer.
The view layer objects are responsible for two major aspects of the applications:
1. Input-responding to user interaction. The user interface must be designed to translate
an action by the user, such as clicking on a button or selecting from a menu, into an
appropriate response. That response may be to open or close another interface or to send
a message down into the business layer to start some business process. Remember, the
business logic does not exist here, just the knowledge of which message to send to which
business object.
2. Output-displaying or printing business objects. This layer must paint the best picture
possible of the business objects for the user. In one interface, this may mean entry fields
and list boxes to display an order and its items. In another, it may be a graph of the total
price of a customer's orders.
The process of designing view layer classes is divided into four major activities:
After all, use cases concentrate on describing what the system does rather than how it
does it by separating the behavior of a system from the way it is implemented, which
requires viewing the system from the user's perspective rather than that of the machine.
However, in this phase, we also need to address the issue of how the interface must be
implemented. Sequence or collaboration diagrams can help by allowing us to zoom in on
the actor-system interaction and extrapolate interface classes that interact with human
actors; thus, assisting us in identifying and gathering the requirements for the view layer
objects and designing them.
3. Testing usability and user satisfaction. "We must test the application to make sure it
meets the audience requirements. To ensure user satisfaction, we must measure user
satisfaction and its usability along the way as the UI design takes form. Usability experts
agree that usability evaluation should be part of the development process rather than a
post-mortem or forensic activity. Despite the importance of usability and user
satisfaction, many system developers still fail to pay adequate attention to usability,
focusing primarily on functionality" . In too many cases, usability still is not given
adequate consideration.
The interface object handles all communication with the actor but processes no
business rules or object storage activities. In essence, the interface object will Effective
interface design is more than just following a set of rules. It also involves early planning
of the interface and continued work through the software development process. The
process of designing the user interface involves can fying the specific needs of the
application, identifying the use cases and interface object and then devising a design that
best meets users' needs. The remainder of this chapter describes the micro-level VI
design process and the issues involved.
Part-A
Q.No Questions Competence BT Level
BTL 4
1. Compare Coupling and Cohesion. Analysis
BTL 1
2. List out the types of Database models. Remember
BTL 1
3. Define Corollaries. Remember
BTL 1
4. List out the types of attributes. Remember
BTL 1
5. Define DDL and DML. Remember
BTL 1
6. Define Axiom. Remember
BTL 1
7. What is meant by Coupling? Remember
BTL 1
8. What is OCL? Remember
BTL 4
9. Analyze the purpose of DBMS. Analysis
BTL 1
10. List out the various Visibility modes. Remember
Part-B
Q.No Questions Competence BT Level
BTL 1
1. Elaborate Object Oriented Design process in detail. Remember
BTL 1
2. Explain the steps involved in designing the access layer classes. Remember
Explain the activities involved in the macro and micro level BTL 1
3. Remember
processes while designing the view layer classes.
BTL 1
4. Explain about Corollaries in detail. Remember
Discuss in detail about BTL 2
5. (i)Client Server computing Understand
(ii)Distributed Database
(i)Compare Traditional Database and Object Oriented BTL 4
Database.
6. Analysis
(ii)Analyze the Characteristics of OOD
BTL 1
7. Explain OODBMS in detail. Remember