You are on page 1of 10

OT notes By Vivek Kumar in CSE 2014.exe Edit Doc 1. 1.1 What is an object?

? "An object is any thing, real or abstract, about which we store data and those o perations that manipulate the data." (Principles of Object Oriented Analysis and Design - James Martin) Objects are software entities that combine data structures and operations on the data. Together, these enable groups of objects to model real-world entities bas ed on their characteristics (represented by data elements) and their behavior (r epresented by data manipulation operations). In this way, objects can model conc rete things such as people, data entry forms and abstractions such as numbers or geometrical concepts. An object can be any one of the following: An icon An invoice A customer A drawing A component of a drawing A hotel reservation An object can be made up of other objects, which can be made up of other obj ects, and so on. So Object Oriented Technology(OOT) allows developers to solve problems or create applications through a series of objects. 1.2 What Is Object Oriented Programming Language? Object-oriented programming(OOP)is a programming style which incorporates three main characteristics: Inheritance Encapsulation Polymorphism. These characteristics differentiate object-oriented programming from the traditi onal structured programming model. Object-oriented programming builds on the concept of reusing code through the de velopment and maintenance of object libraries. These objects are available for b uilding and maintaining other applications. Some example of OOP languages are C++, SmallTalk, and Eiffel. 1.3 What is Class? When programming in a object oriented language, an objects is called a class whi ch is the software representation of an object. A class packages all the attribu tes and methods of an object. Attributes are the data associated with the object (Class) and the methods are the functions and code which operate on the data and express the behavior of the object. So basically a class is a over glorified ve rsion of a structure in C. An example of a class could be a car class. Some of the attributes of the a car

could be type of transmission and number of doors. Methods could be acceleration and deceleration. 1.4 What is Inheritance? Inheritance allows you to create new objects(derived class) from previously defi ned objects(base class). When a derived class inherits from the base class, it will contain all the attri butes and methods of the base class plus any additional specifications of the de rived class. Any changes which are made to base classes are propagated to all derived classes unless explicitly overridden. This domino effect has its advantages and disadva ntages. Changes to a base class could fix or break your application. For example lets say we wanted to create a new class called sedan. We know that a sedan is a car so we would want to derive this new class from our base car cla ss. Some of the data for this new class may be Horse Power and Top Speed and a f unction would be engine. But because this is a derived class we would also have access to the base class functions accelerations and deceleration plus the data of the base class type of transmission and number of doors. 1.4.1 Some benefits of inheritance Increased productivity Reduced maintenance Standardization 1.4.2 Drawbacks Added overhead 1.5 What is Encapsulation? Encapsulation is the hiding of information. It prevents users from seeing the in ternal workings of an object. The main reason for this is to protecting data tha t should not be manipulated by the user. This makes the code more reliable and r eusable. For example in a sedan class here may be an engine function and data for the eng ine. You would want to protect the data for the engine to prevent the function f orm misbehaving. Another example would a link list class. You don't want to give the user access to the head or tail pointers because then they could break the link list. 1.5.1 Some benefits of Encapsulation Improves program reliability Reduces maintenance Reusability Coding is easier (allows for inefficient code to be optimized later) 1.6 What is Polymorphism? Polymorphism means that different objects respond differently to the same messag e.

There are two types: Early Binding - Which is the overloading of functions. This means that you c an have two functions that have the same name (function signature) but with diff erent number of parameters or different types of parameters passed to it. Late Binding again you could r base class and e the base class - This allows functions to override the base class function. So have two functions that have the same function signature in you your derived class, but the derived class function will overrid function.

An example of early binding polymorphism would be to create two acceleration fun ctions in our base car class. 1.6.1 Some benefits to Polymorphism Improves flexibility 1.7 Benefits of Object Oriented Programming Code reusability - Because new objects can be derived from old objects, and there are many class libraries which have already been written like MFC. Code Modularity - Everything in OOPL is an object, they can be interchanged or removed to meet the users needs. Easier maintenance - Inheritance usually reduces maintenance because of domi no effect it has on derived classes when a change is made in a base class. Design stability - Once you have developed a stable base class, new classes that you derive may have less errors and bugs. Improves communications between developers and users - Because objects can b e broken down into real life entities, it is easier it communicate ideas. Seamless transition from design to implementation - This is mainly because o f the point above, communications is improved. 1.8 Drawbacks of Object Oriented Programming Execution overhead - Derived classes can be very complex because of inherita nce and polymorphism. Once instance of a derived class is initiated all the data and functions from base classes that may not used are carried along with it. High learning curve - OOP is different from traditional programming. You mus t develop strong base classes and understand the fu nctionality of class librari es before you can take advantages it. Difficult to establishing base classes - a good foundation must be created b efore you derive other classes. Base classes have to be generic enough to meet t he needs of your application and any future upgrades to that application.

3.1 What is an Object Oriented Database? An Object Oriented Database (OODB) is a system combining characteristics of a da tabase with the manipulation of objects typically available in object oriented l anguages. The following is a breakdown of the database and object oriented featu res inherent in such a database. Not all characteristics MUST be present for a s ystem to be considered and OODB, but the more it has, the closer it gets to the ideal. 3.1.1 DBMS features: Persistence: the ability of the programmer to have the data survive the exec ution of a process. In OODB, each object is allowed to become persistent indepen

dent of its type, without explicit casting. Secondary Storage Management: these are performance features (such as index management and query optimization) hidden from the user. Concurrency: the ability of the DBMS to offer all users working simultaneous ly the same level of service Recovery: the software is able to bring itself and its data back to some coh erent state in case of hardware or software failure. 3.1.2 OO features: Complex Objects: these are built from simpler ones by applying constructors to them. Constructors must be orthogonal to the objects, meaning they can be app lied to each object. The use of complex objects improves the capability of repre senting of the real world. Object Identity: OO systems are identity-based, meaning that each representa tion of information has its own identifiers. Please note that identity-based mod els are common in OO programming languages but rather new in database technology , since in most relational databases relations are valued based. Encapsulation: an object contains both programs and data and offers to the w orld an interface and an implementation part. The interface part is the specific ation of the set of operations that can be performed on the object; the implemen tation part describes the implementation of each operation. In most OODB, even d ata specification is part of the interface. Types and Classes: a type summarizes the common features of a set of objects ; a class has an extension which contains the set of objects that instantiates t he classes and has a set of operations with which the user can manipulate the ob jects. Inheritance: the ability of a subclass to receive all data and operations co ming from its superclasses. It helps code reusability and is also a better-struc tured and more concise description of the real world and the shared specificatio ns of applications. Overriding, Overloading and Late Binding: when a single identifier is bound to different operation code in different types, one says that the code is overri dden and the operation is overloaded. To provide this functionality, code is not bound to operation identifiers at compile time but at run time, thus performing the so called late binding. Computational completeness: the ability of expressing and computing function s using any combination of the available manipulating operations over the data i s natural for any programming language, but rather new for database languages. I n this respect SQL is not complete. Extensibility: predefined and user-defined types must have the same status, meaning they must be supported by the system as completely equivalent. 3.2 What really sets an OODB apart from a normal RDB? An RDB stores simple, fixed length data, in tables. If your data fits natura lly in tables, this will work fine. An OODB supports arbitrary structures, nested structures, dynamically varyin g structures, arbitrary many-to-many relationships and most others you can think of. An RDB supports simple operations such as select, project, and join over loc alized amounts of data through the use of SQL. An OODB allows arbitrary operations, defined by users, with arbitrary comple xity. These operations might traverse inter-object relationships, affect many ob jects in different databases, or do any number of user-defined tasks. 3.3 An example of database differences A simple example of the differences between the two database styles is storing o ur car in the garage at the end of the day. An OODB models this with an object f

or the car, one for the garage, and one store operation. In an RDB, data must be flattened, normalized, and stored by type in separate tables, so the car, in ou r example, must be disassembled, with all the gears stored in one table, pistons in another, wheels in another, etc. In the morning, before driving to work, you must re-assemble your car. If you wish, you may just as easily re-assemble it i nto an airplane, which might be an advantage to some. Otherwise, there is a lot of extra overhead. For applications with complex objects, this disassembly/reassembly code can be e xpensive to write, error prone and very slow to execute. Instead, in an OODB the structure of the car as a composite containing the other objects via relationsh ips is all modeled directly, naturally, and efficiently. 3.4 When should an OODB be used? Not every application or every user needs an OODB. Any of the following three ch aracteristics are a good indication that you may benefit from an OODB. Use of Objects. If you've designed and built your system with objects, it wi ll be easier and possibly much faster to communicate with the database directly in objects, rather than translating to tables or records. Complex, Interconnected Information. If the information you use doesn't fit naturally into tables (e.g., nested structures, varying sized structures, images , animation, audio, video, etc.), an OODB can help by directly supporting arbitr ary structure, exactly as you define it. Just as importantly, if your informatio n contains many relationships (see previous section about joins), the OODB can r epresent these directly, making it easier for users and dramatically faster. Distributed Environment. Traditional DBMSs (and even some OODBs!) are built on the old mainframe model: everything happens on the central server. If you dep loy your application across multiple computers, with objects on different workst ations, servers, mainframes, etc., then a distributed OODB can provide transpare nt access to all objects, from all users, located anywhere, on any computers, ne tworks, operating systems, and using any languages. 3.5 A speed comparison Sun Benchmark Data small database results only DBMS INGRES UNIFY RAD-UNIFY VBASE VBASE Model Type Relational Relational Relational Relational

Object Name LookUp 35 ms 60 ms 9 ms 11.4 ms 9.8 ms Range LookUp 393 ms 358 ms 76 ms 95.9 ms 84.1 ms Group LookUp 116 ms 85 ms 24 ms 6.0 ms 5.1 ms Reference LookUp 165 ms 50 ms 6 ms 30.6 ms 9.8 ms Record Insert 56 ms 230 ms 43 ms 95.44 ms

24.3 ms Sequential Scan 2 ms 11 ms 3 ms 1.53 ms 1.6 ms Database Open 1300 ms 580 ms 580 ms 1020 ms 1036 ms Actual Size 6.3 Mb 3.8 Mb 3.8 Mb 12.1 Mb 10.4 Mb This table summarizes the results of the small version of the Sun Benchmark, and allows for comparison of both Vbase models to the existing relational versions. Vbase itself is the object-oriented database platform developed by Ontos Inc Overall, these numbers indicate that an object system can meet and in many cases exceed the performance of a fast relational system. However, it would be desire d to make the assessment of databases at a higher, more complex level. Furthermo re, this application benchmark would need to take into account the kinds of comp lex modeling relationships object databases have been created to model. 3.5.1 The Sun Benchmark The Sun Benchmark is intended for use across different kinds of database systems . It attempts to provide generic, data model independent definitions and benchma rk tests that are suitable for benchmarking databases of any data model. The Benchmark is comprised of seven individual benchmark operations, defined as follows: Name LookUp: fetch the name of a person with a randomly generated ID Range LookUp: fetch the names of all people with birthdates within a particu lar randomly generated 10 day range.

Group LookUp: fetch the author ID's for a given random document ID Reference LookUp: Record Insert: store a new author record Sequential Scan: serially fetch records from the document table, fetching the ti tle from each, but without performing any pattern match computation on the title . Database Open: perform all operations necessary to open files, database schema i nformation, etc, but not time to load the application program itself. Each of these operations is performed a number of times. They are measured in te rm of their time response, the elapsed time between the invocation and run of th e operation. 3.6 OODB's on the market Objectivity/DB is a high-performance client/server objectbase for technical and commercial applications. It is best suited for workgroup applications that i nvolve distributed information, require flexible data modeling, involve complex relationships, and demand high performance and capacity. OpenODB is an advanced object-oriented database management system (ODBMS) fr om Hewlett- Packard for complex commercial application needs. With OpenODB, you can take advantage of new object-oriented features combined with a robust databa se management system. Persistence is an application development tool which provides object oriente d access to existing relational data. It uses an automatic code generator to con vert object models into C++ classes which know how to read and write themselves to a relational database. Matisse is an OODB which combines the search capacity of an RDBMS all along with a performance that the manufacturer claims is ten to one hundred times grea ter than RDBMS for the manipulation of complex and large objects.

4.1 Definition of an Object Oriented Operating System An object oriented operating system is an operating system that has the followin g characteristics: The operating system uses a dynamic collection of objects as it's kernel and resources (Object-Based). This means that every command issued to the operating system such as "ls" or "dir" is a call to an object located within the class st ructures. The operating system supports an object-oriented application interface based on local and distributed objects, inheritance, and polymorphism. This means tha t every program ran on the operating system can use the objects and classes prov ided through the operating system and polymorphism and inheritance is supported. The operating system's subsystems are defined through the framework of class es. This means that all substructures such as I/O are built as class structures. 4.2 Advantages of Object Oriented Operating Systems Here are some of the advantages of object oriented operating systems: Can be hardware customized by simply replacing the subsystems and objects. T his is possible because all the subsystems are built from base classes, so by re placing the hardware specific base classes, the operating system can run on othe r platforms. Forces modularity and data encapsulation. Since object oriented language is

very modular, we can maintain a low coupling and if we need to change a module, it will not effect any others. Faster development time. Since object oriented code takes advantage of re-us able code and pre-written modules, the development time of object oriented opera ting systems is faster. Easier maintained because of highly organized object oriented code. Object o riented code is usually much smaller than structured code since we can take adva ntage of classes and objects written. So it is usually more organized. 4.3 Disadvantages of Object Oriented Operating Systems Here are some of the disadvantages of object oriented operating systems: They carry a big overhead performance cost. This is a common trait of object oriented systems since they have a great amount of classes and objects that are used Object oriented systems are only accessible through specific languages (C++) and homogenous systems. So object oriented operating systems have some restrict ions in the languages used. Difficult to build since object oriented programming has a high learning cur ve and one needs to familiarize themselves with the classes and objects availabl e. 4.4 Some Object Oriented Operating Systems It is easy to mistake Windows 95 and Windows NT for object oriented operating sy stems, but their subsystems are not fully constructed through the framework of c lasses. Here are three of the most popular distributed object oriented operating systems that are distributed: Apertos - This OS was developed by Sony computer science lab using C++. In t his OS, the application interface is a collection of kernel objects exported the application/kernel layer. Choices - This OS was developed by University of Illinois using C++. It's ma in purpose was to run on massively parallel computers facilitating a high perfor mance interconnection network. NachOS - This OS was developed by University of Berkley using C++. It's main purpose was for research and operating systems course material. It has been use d at many universities such as UofC as an undergraduate operating systems course . 4.5 Object Oriented Graphics Systems Object oriented graphics systems are graphics systems which have an architecture organized into frameworks of objects that are hierarchically classified by func tion and performance. They allow the user to implement complex graphics programs with the use of objects and classes (polygon meshes, nurbs, ray shading, ). They do, however, run quite a bit slower than the implementations such as in C or ass embly language. This is due to the object oriented frame work. 4.6 Examples Of Object Oriented Graphics Systems Here are a few examples of object oriented graphics systems. All of them are bui lt using C++ and Open-GL. GRAMS System GEO++ System GAP System 4.7 Summary Of Findings for OOS

Although great strides have been made in the speed, look, and feel of systems, l ittle progress has been made in making systems easy to use. Typical systems toda y still force the user to interact with the system at a level of abstraction con venient to the machine, rather than a level convenient to the user. By capitaliz ing on the benefits of the object-oriented paradigm, many of the problems in tra ditional systems can be overcome. Here are the most common Pros and Cons about O bject Oriented Systems: 4.7.1 Disadvantages of OO Technologies carry an overhead cost have a very high learning curve 4.7.2 Advantages of OO Technologies speak the users language are very easy to maintain

---------------------------------------------------------------------------------------

You might also like