1 / 24

Introduction to Object Oriented Computing and Modeling

Learn about the fundamentals of object oriented programming and how it can be used to model real-world scenarios. Understand concepts like abstraction, encapsulation, generalization, and polymorphism. Explore the anatomy of an object oriented program and how objects interact with each other.

Download Presentation

Introduction to Object Oriented Computing and Modeling

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. Introduction to Object Oriented Computing and Modeling

  2. Think/Pair/Share • “In order, list the tasks you performed this morning before you left for campus.”

  3. Getting Started • You were supposed to: • Read Chapter 1 of OOPUJ • Read the syllabus • Any questions?

  4. [Object Oriented] Programming is a lot like planning out your morning • Some things are required, others are optional. • Certain things must be in a certain order while other things can be done in any order. • Certain tasks are MUCH more involved, but we think about them from “high view” simple terms. • Some tasks you assign to other objects.

  5. So what is OO programming? The world consists of objects that interact to solve a problem. Object-oriented programming encourages us to think about the computer as a simulator of the world. Thus, a program is a map of the world we want to imitate.

  6. So what is OO programming? • Instead of asking • How can I write a program that is structured like the machine on which it runs? • We ask • How can I write a program that is structured like the part of the world it describes?

  7. So what is OO programming? We describe and understand the world around us by: Identifying objects in our world Understanding what the objects can do Interacting with objects to accomplish a task Encapsulation Information confined or hidden inside an object Interact with objects via external properties

  8. An example • Suppose an individual named Chris wishes to send flowers to a friend named Robin, who lives in another city. • Chris walks to a nearby flower shop, run by a florist named Fred. • Chris tells Fred • What kinds of flowers to send • Who to send them to (Robin’s address) • When they should be delivered. • Chris can be assured that the flowers will be delivered expediently and automatically (from his perspective)

  9. From Chris’s perspective Chris sends Fred a “send flowers” message Robin eventually gets flowers. Chris doesn’t have to understand ANY of the details regarding what happens in the process, he just trusts that the flowers will arrive.

  10. The community of agents in the process

  11. The Key Concepts of an OO language/program • Abstraction • Encapsulation • Generalization/Specification • Polymorphism

  12. Abstraction • Abstraction allows us to consider complex ideas while ignoring irrelevant detail that would confuse us.

  13. Encapsulation • Encapsulation allows us to focus on what something does without considering the complexities of how it works. • A different definition: • Encapsulation is a process of binding or wrapping the data and the codes that operates on the data into a single entity. This keeps the data safe from outside use and misuse.

  14. Abstraction vs. Encapsulation • Abstraction hides complexity by giving you a more abstract picture, a sort of 10,000 feet view, while Encapsulation hides internal working so that you can change it later. • In other words, Abstraction hides details at the design level, while Encapsulation hides details at the implementation level.

  15. Abstraction vs. Encapsulation • We have a Vehicle that can move. • This is an Abstraction because all you know is that it moves. It could move on land, water, through the air... It doesn’t matter. It just moves. • We have a Vehicle that moves by saying moveForward(feet). • This is an encapsulation because you don’t actually know how that input parameter is translated into movement. • In fact, it can change at a later time in the code without changing how we use the vehicle.

  16. Generalization/Specialization • Generalization allows us to consider general categories of objects which have common properties and then define specialized sub classes that inherit the properties of the general categories.

  17. Polymorphism • Polymorphism allows computer systems to be extended, with new specialized objects being created, while allowing current parts of the system to interact with new objects without concern for the specific properties of the new objects.

  18. The anatomy of an OO program • The root of object oriented programming is objects • “An object is an entity that has State Behavior, and Identity” (Grady Booch)

  19. Object-Oriented Programming State – information the object needs to remember Property – a characteristic, quality, or feature that contributes to making an object unique Current values of properties From : Modern Software Development Using Java

  20. Object-Oriented Programming Behavior – object’s reaction to state changes, interactions with other objects Methods – model object behavior Methods are invoked From : Modern Software Development Using Java

  21. Object-Oriented Programming (continued) From : Modern Software Development Using Java

  22. Object-Oriented Programming (continued) Identity – way to distinguish objects Reference variables identify objects Refer to one object at a time Equality – are two objects equal? Name equivalent – refer to the same object Compare memory addresses Content equivalent – from the same class Understand the structure of objects From : Modern Software Development Using Java

  23. Object-Oriented Programming (continued) From : Modern Software Development Using Java

  24. Reality Check • Any questions?

More Related