ITIS312 Object Oriented Systems Chapter 1 Introduction Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 1 • Object-orientation is so called because this method sees things that are part of the real world as objects. ITIS312 Object Oriented Systems What is Object-Orientation? ü A phone is an object in the same way as a bicycle, a human being, or an insurance policy are objects. • In everyday life, we simplify objects in our thinking – we work with models. • Objects occurring in reality are reduced to a few features that are relevant in the current situation. Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 2 • Instead of real objects, we work with symbols. ü example: in the figure below, we use model to describe a reality ITIS312 Object Oriented Systems What is Object-Orientation? that a teacher owns a bicycle and he reads a book. Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 3 • The characteristics required by an Object Oriented (OO) approach include four aspects: identity, classification, inheritance, ITIS312 Object Oriented Systems What is Object-Orientation? and polymorphism. ØIdentity: data is quantized into discrete, distinguishable entities called objects . ü An object is a representation of a specific entity in the real world. - Objects can be: § Concrete (or tangible), such as printer, computer, person, etc. or § Conceptual (or intangible), such as a job, course, etc. - Two objects are distinct even if their attribute values (such as name and size) are identical. Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 4 ITIS312 Object Oriented Systems Example: Object Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 5 • Two aspects: information and behavior Information : 1. has a unique identity. ITIS312 Object Oriented Systems Object Definition 2. has a description of its structure or the information that is used to create it. 3. has a state representing its current condition, e.g. values of some of its features. Behavior: 1. what can the object do? 2. what can be done to it? Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 6 Object Oriented Systems Example: Object Definition Information : ITIS312 1. serial number. 2. model. 3. speed. 4. memory. 5. status. Behavior: 1. print file. 2. stop printing. 3. remove file from queue. Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 7 Ø Classification: objects with the same data structure (attributes) and behavior (operations) are grouped into a class. ITIS312 Object Oriented Systems Object-Oriented Aspects § A class is an abstraction that describes properties important to an application and ignores the rest. ü Any choice of classes is arbitrary and depends on the application. ü Each class describes a possibly infinite set of individual objects. ü Each object is said to be an instance of its class. ü An object has its own value for each attribute but shares the attribute names and operations with other instances of the class. ü An object contains an implicit reference to its own class. Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 8 ITIS312 Object Oriented Systems Classification: Example Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 9 Ø Inheritance: is the sharing of attributes and operations (features) among classes based on a hierarchical relationship. § A superclass has general information that subclasses refine and ITIS312 Object Oriented Systems Object-Oriented Aspects elaborate. ü Each subclass inherits all the features of its superclass and adds its own unique features. ü ex. ScrollingWindow and FixedWindow are subclasses of Window. - both subclasses inherit the features of Window. - SrollingWindow adds a scroll bar and an offset. The ability to factor out common features of several classes into a superclass can greatly reduce repetition within designs and programs and is one of the main advantage of OO tehnology. Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 10 Ø Polymorphism: the same operation may behave differently for different classes. § An operation is a procedure or transformation that an object performs ITIS312 Object Oriented Systems Object-Oriented Aspects or is subject to. Ex. RightJustify, display and move. ü An implementation of an operation by a specific class is called a method. ü It may have more than one method implementing one operation, each for a different class of object. ü In an OO programming language, the language automatically selects the correct method to implement an operation based on the name of the operation and the class of the object being operated on. Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 11 Ø In this context development refers to the software life cycle: analysis, design, and implementation. ITIS312 Object Oriented Systems What is OO Development? Ø Object Oriented Methodology (OOM) is a system development approach encouraging and facilitating re-use of software components. ØWith this methodology, a computer system can be developed on a component basis which enables the effective re-use of existing components and facilitates the sharing of its components by other systems. Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 12 Ø The process for OO development (software life cycle) consists of building a model of an application and then adding details to it during design. The methodology has the following stages. ITIS312 Object Oriented Systems OO Methodology 1. System conception: conceiving an application and formulating tentative requirements. 2. Analysis: restate of the requirements from system conception by constructing models that should not contain any implementation. ü The analyst must work with the requestor to understand the problem, because problem statements are rarely complete or correct. ü The analysis model is a precise abstraction of what the desired system must do, not how it will be done. Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 13 Analysis: (cont’d) ü The analysis model has two parts: 1. The domain model: a description of the real-world objects reflected within the system, ITIS312 Object Oriented Systems OO Methodology 2. The application model: a description of the parts of the application system itself that are visible to the user. 3. System design: ü The overall architecture of the desired system is decided. ü While designing the system, the stress lies on the objects comprising the system and not on the processes being carried out in the system. Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 14 4. Class design: ü The class designer adds details to the analysis model in accordance with the system design strategy. ITIS312 Object Oriented Systems OO Methodology ü The class designer elaborates both domain and application objects using the same OO concepts and notation. ü The focus of class design is the data structures and algorithms needed to implement each class. 5. Implementation: ü Implementers translate the classes and relationships developed during class design into a particular programming language, database, or hardware. ü Implementers should follow good software engineering practice so that traceability to the design is apparent and so that the system remains flexible and extensible. Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 15 Ø Three models are used to describe a system from different viewpoints: 1. The class model: ü ITIS312 Object Oriented Systems Models for System Description describes the static structure of the objects in a system and their relationships. ü defines the context for software development—the universe of discourse. ü contains class diagrams (graphs whose nodes are classes and whose arcs are relationships among classes). 2. The state model: ü describes the aspects of an object that change over time. ü specifies and implements control with state diagrams (graphs whose nodes are states and whose arcs are transitions between states caused by events). Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 16 3. The interaction model: ü describes how the objects in a system cooperate to achieve broader results. ITIS312 Object Oriented Systems Models for system description ü starts with use cases that are then elaborated with sequence and activity diagrams. ü a use case focuses on the functionality of a system (what a system does for users). ü a sequence diagram shows the objects that interact and the time sequence of their interaction. ü an activity diagram elaborates important processing steps. The three models are separate parts of the description of a complete system but are cross-linked. Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 17 Ø Several themes pervade OO technology and are well supported. ü Abstraction: is the presentation of simple concept (or object) to the external world. § Abstraction concept is to describe a set of similar concrete ITIS312 Object Oriented Systems OO Themes entities. § It focuses on the essential, inherent aspects of an entity and ignoring its accidental properties. § The abstraction concept is usually used during analysis: deciding only with application-domain concepts, not making design and implementation decisions. The ability to abstract is the most important skill required for OO development. Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 18 ü Encapsulation (information hiding): means as much as shielding. ü Each object-oriented object has a shield around it. ITIS312 Object Oriented Systems OO Themes ü Objects can't 'see' each other. They can exchange things though, as if they are interconnected through a hatch. ü The object encapsulates both data and the logical procedures required to manipulate the data. Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 19 ü Encapsulation: Example Ø Encapsulation separates implementation from users or clients. ITIS312 Object Oriented Systems OO Themes Dr. Jihene Kaabi Ø Client depends on interface. óóó University Of Bahrain óóó Second Semester 2019-2020 20 ü Sharing: inheritance of both data structure and behavior lets subclasses share common code. This sharing via inheritance is one of the main advantages of OO ITIS312 Object Oriented Systems OO Themes development. ü Emphasis on the essence of an object: OO development places a greater emphasis on data structure and a lesser emphasis on procedure structure than functional-decomposition methodologies. Dr. Jihene Kaabi óóó University Of Bahrain óóó Second Semester 2019-2020 21