1 / 55

Title : Object Oriented Systems Paper Code : CA - 205 Course : MCA

Course Description:. Title : Object Oriented Systems Paper Code : CA - 205 Course : MCA Faculty : Ms. Charu Sharma Vikrant Gupta . Course Objectives & Prerequisites:.

booth
Télécharger la présentation

Title : Object Oriented Systems Paper Code : CA - 205 Course : MCA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Course Description: • Title : Object Oriented Systems • Paper Code : CA - 205 • Course : MCA • Faculty : Ms. Charu Sharma Vikrant Gupta

  2. Course Objectives & Prerequisites: The course aims is to introduce the students to Object Oriented Programming Conceptswith special emphasis on Object Oriented Programming in C++. The course begins with a gentle introduction to OOADand OOP concepts. Students will then be presented with detailed discussion of Object Oriented Programming features in C++. At the end the use of few applications of OOAD and OOP concepts in areas like Software Engineering and Operating Systems. In order to take the course the student should be familiar with Digital Computer System and must have completed a basic course in Computer Programming, preferably in C.  

  3. Object Oriented Programming

  4. Programming evolution • Machine code ● programs in binary code, executed directly by the processor Assembly languages ● still low level programming, replaced machine code functions with mnemonics and memory addresses with symbolic labels Procedural programming ● decompose programs into procedures/functions Modular Programming ● decompose programs into modules Object Oriented Programming ● decompose program into a set of objects ● objects interact with each other to form a system

  5. What is OOP? • OOP is a design philosophy. It stands for Object Oriented Programming. Object-Oriented Programming (OOP) uses a different set of programming languages than old procedural programming languages (C, Pascal, etc.). Everything in OOP is grouped as self sustainable "objects“.

  6. What is OOP?(Cont’d) • In order to clearly understand the object orientation, let’s take your “hand” as an example. The “hand” is a class. Your body has two objects of type hand, named left hand and right hand. Their main functions are controlled/ managed by a set of electrical signals sent through your shoulders (through an interface). So the shoulder is an interface which your body uses to interact with your hands. The hand is a well architected class. The hand is being re-used to create the left hand and the right hand by slightly changing the properties of it.

  7. Problem Description • “ customers are allowed to have different types of bank accounts, deposit money, withdrawmoney and transfermoney between accounts”

  8. Procedural Approach boolMakeDeposit(intaccountNum,float amount); float Withdraw(intaccountNum,float amount); struct Account { char *name; intaccountNum; float balance; char accountType; };

  9. Procedural Approach cont’d • Focus is on procedures • All data is shared: no protection • More difficult to modify • Hard to manage complexity

  10. Procedural vs. Object-Oriented • Procedural Withdraw, deposit, transfer • Object Oriented Customer, money, account

  11. 10011 11101 11010 10101 011101 010101 0110100 1110101 Mapping the world to software • Objects in the problem domain are mapped to objects in software

  12. Object Oriented • Data and operations are grouped together Account Interface: Set of available operations Deposit Withdrawl Transfer

  13. Object Oriented Paradigm Provide flexible and powerful abstraction Allow programmers to think in terms of the structure of theproblem rather than in terms of the structure of the computer. ● Decompose the problem into a set of objects ● Objects interact with each other to solve the problem ● create new type of objects to model elements from the problem space An object is an entity that: ● has a local state ● able perform some operation (behavior)

  14. Object Oriented Paradigm(Cont’d) • It may be viewed as a combination of: • ● data (attributes) • ● procedural elements (methods) • Object Oriented Programming is a method of implementation where: objects are fundamental building blocks • ● each object is an instance of some type (class) • ● classes are related to each others by inheritance

  15. Fundamental concepts and properties • Concepts: ●object ● class ● method (message) • Properties: ●encapsulation ● inheritance ● polymorphism

  16. Daria Brittany Jane Jodie Objects and Classes • Classes reflect concepts, objects reflect instances that embody those concepts. object class girl

  17. Objects and Classes (cont’d) • A classcaptures the common properties of the objectsinstantiated from it • A class characterizes the common behavior of all the objects that are its instances

  18. Objects and Classes (cont’d) Operations MakeDesposit Transfer WithDraw GetBalance Class BankAccount Balance InterestYTD Owner Account_number Balance 500 InterestYTD Owner Account_number Balance 10,000 InterestYTD Owner Account_number

  19. Objects as instances of Classes • The world conceptually consists of objects • Many objects can be said to be of the same type or class • My bank account, your bank account, Bill Gates’ bank account … • We call the object type a class

  20. Instantiation • An Object is instantiated from a Class BankAccountmyAccount; myAccount = new BankAccount;

  21. Objects and Classes • Class • Visible in source code • The code is not duplicated • Object • Own copy of data • Active in running program • Occupies memory • Has the set of operations given in the class

  22. Animal Mammal Reptile Rodent Primate Cats Mouse Squirel Rabbit Classification

  23. Account Checking Account Savings Account Value First Select Access First Interest Classification

  24. Encapsulation Abstraction in OOP is closely related to a concept called encapsulation. Data and the ways to get at that data are wrapped in a single package, a class. The only way to access such data is through that package. This idea translates to information hiding.

  25. Encapsulation is the method of combining the data and functions inside a class. This hides the data from being accessed from outside a class directly, only through the functions inside the class is able to access the information. This is also known as "Data Abstraction", as it gives a clear separation between properties of data type and the associated implementation details. There are two types, they are "function abstraction" and "data abstraction". Functions that can be used without knowing how its implemented is function abstraction. Data abstraction is using data without knowing how the data is stored. Encapsulation (Cont’d)

  26. Data Encapsulation class Account { public: float withdraw(); void deposit(float amount); private: float balance; );

  27. Advantages of Encapsulation • Protection • Consistency • Allows change

  28. Inheritance • A class which is a subtype of a more general class is said to be inherited from it. • The sub-class inherits the base class’ data members and member functions

  29. Inheritance (Cont’d) • A sub-class has all data members of its base-class plus its own • A sub-class has all member functions of its base class (with changes) plus its own • Inheritance is meant to implement sub-typing (don’t abuse it)

  30. Inheritance Examples

  31. CommunityMember Employee Student Faculty Staff Administrator Teacher University community members

  32. Abstraction • Management of complexity • Hierarchical classification: • is-a relationship: inheritance • has-a relationship: containment

  33. Abstraction Cont’d • One of the chief advantages of object-oriented programming is the idea that programmers can essentially focus on the “big picture” and ignore specific details regarding the inner-workings of an object. This concept is called abstraction.

  34. Polymorphism • One interface • Multiple implementations • Inheritance • Method overloading

  35. Polymorphism (Cont’d) • Polymorphism describes how programmers write methods to do some general purpose function. • Different objects might perform polymorphic methods differently.

  36. What is a good class ? • A class abstracts objects • A class should be non-trivial in the context of the program (has data structures and operations different from other classes)

  37. Motivation Variables  objects Types  classes Procedural programming: • Low-level, closer to hardware • More intuitive, less abstract • More ‘action’ oriented • Focus on ‘action’, ‘procedure’, ‘method’ • Procedure-oriented Object-oriented programming: • High-level • More abstract • Focus on ‘what to do’ not on ‘how to do’ In the implementation of OOP, we still need sound ‘procedure programming’ skills!

  38. Procedural programming: Object oriented programming: A sequence of ‘procedures’ A sequence of ‘objects’! int main() { int x,y,z; int a,b,c; a=f1(x); b=f2(y); c=f3(z); … } int f1() { } int f2() { } int f3() { } int main() { A a; B b; C c; a.f1(); b.f2(); c.f3(); … } Class A { Int x; Int f1(); } Class B { Int y; Int f2() } Class C { Int z; Int f3(); }

  39. Object-oriented modeling and design

  40. Introduction • It is a new way of thinking about problems using models based on real world concepts. • The basic construct is object which combines both data structure and behavior in a single entity. • Rambaugh presents an object oriented software development methodology, the Object Modeling Technique (OMT) which extends from analysis through design to implementation.

  41. What is object-oriented? • Software is organized as a collection of discrete objects that incorporate both data structure and behavior. • In general it includes- identity, classification, polymorphism and inheritance. • Object Oriented Programming Language = Object Based Programming Language(e.g. '83 Ada a Modula-2,C++and Java,etc.) + Inheritance + Dynamic Binding

  42. Identity • Identity means that data is organized into discrete, distinguishable entities called objects. • Objects can be concrete or conceptual. • In real world an object simply exist but within a programming language each object has a unique handle by which it can be uniquely referenced. • The handle can be implemented by address, arrayindex or unique value of an attribute.

  43. Classification • It means that objects with same data structure (attribute) and behavior (operations) are grouped into a class. • A class is an abstraction that describes important properties and ignores the rest.

  44. Polymorphism • It means that the same operation (i.e. action or transformation that the object performs) may behave differently on different classes. • Specific implementation of an operation by a certain class is called a method.

  45. Inheritance • It is the sharing of attributes and operations among classes based on a hierarchical relationship. • Subclasses can be formed from broadly defined class. • Each subclass incorporates or inherits all the properties of its super class and adds its own unique properties.

  46. Object-Oriented Development? • The theme is the identification and organization of application concepts rather than final representation in a prog. Language. • OOD approach encourages software developers to work and think in terms of the application domain through most of the software engineering life cycle. • It is a conceptual process independent of a programming language until the final stage.

  47. Object-Oriented Methodology • Stages. • Analysis • System design • Object design • Implementation

  48. 3 Models • Object Model • Dynamic model • Functional model

  49. Object Model • Describes basic structure of objects and their relationship. • Contains object diagram. • Object diagram is a graph whose nodes are object classes (Classes) and whose arcs are relationships among classes.

  50. Dynamic model • Describes the aspects of a system that change over time. • It specifies and implement control aspects of a system. • Contains state diagram. • State diagram is a graph whose nodes are states and whose arcs are data-flows.

More Related