1 / 25

Object Oriented Programming

Object Oriented Programming. Dr. Ennis-Cole CECS 5100. Conventional Programming. * Unstructured Programming * Procedural Programming * Modular Programming *Object Oriented Programming. Unstructured Programming. 1. One Main Program 2. What is a program ?. Unstructured Programming.

lindarscott
Télécharger la présentation

Object Oriented Programming

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. Object Oriented Programming Dr. Ennis-Cole CECS 5100

  2. Conventional Programming * Unstructured Programming * Procedural Programming * Modular Programming *Object Oriented Programming

  3. Unstructured Programming 1. One Main Program 2. What is a program ?

  4. Unstructured Programming Program: Statements or commands sequentially ordered that modify data and create output which solves a specific problem.

  5. Unstructured Programming 1. Copied the same programming statements to different locations within the program 2. Redundancy often created errors throughout the program

  6. Unstructured Programming Main Program (data)

  7. Procedural Programming Grouped repetitive statements into a single place called a procedure Call statements invoked the procedure Control resumed at the statement after the procedure was called

  8. Procedural Programming Parameters were introduced to communicate between procedures This approach produced more correct code, made testing easier, and reduced the overall program error rate.

  9. Procedural Programming • Main Program • Procedures • Programs became a sequence of calls to procedures • Procedures could be used in different programs

  10. Procedural Programming Main Program (data) Proc A Proc B Proc C Proc D Sub a1 Sub d1 Sub d2

  11. Modular Programming • Procedures with common actions were grouped together into modules • Programs were divided into smaller entities or modules which worked in concert to produce the desired outcome • Separately testable and programmable units made development faster and more efficient

  12. Modular Programming Modules Packaged with data and procedures all grouped based on functionality

  13. Modular Programming • Conservative • Consistent Main Program (data) Module 1 data + data 1 Module 2 data + data 2 Proc 1 Proc 2 Proc 3

  14. Using Data • In each earlier approach, data represents the symbols, numbers, letters or pictures that the program would manipulate • Several types of data were typically by programming languages: int, bool, trees, sets, arrays, lists, float, string

  15. Object Oriented Programming • OOP - a programming technique that relies on reusable software components that can be applied to different types of problems and applications. The programmer makes the machine work in terms of concepts closer to the user’s every day world. • Principle unit - An Object

  16. Objects • Separate Components (buttons, windows, menus, icons) • Self-Contained Entities • Are Unique • Belong to Classes based on its properties • Is said to be an instance of a class • Created within the Visual Environment

  17. Objects • Private data and the collection of procedures that can access that data • Identified by name and state (values and attributes) • A program can be thought of as a collection of objects

  18. Objects • Receive and act on messages. • Respond to predefined external stimuli. • Interact with each other in a set manner. • Have Properties or distinguishing characteristics (size, shape, pressure, strength). • If people are objects, what are some of their distinguishing characteristics ?

  19. Classes • Hierarchy that allows information to be derived about any instance (object) • Mammal • Human • Animal • Herbivorous • Carnivorous • DOG, COW Rover, Betsy

  20. Class • An actual representation of an ADT (abstract data type). • Provides implementation details for the structure and operations of data that will be processed. • A class is defined as all the information needed to create an object of a particular distinction. (Ex: Integer j, k, m; )

  21. Objects Respond to Messages “What message is conveyed here ?”

  22. Messages • Communication between objects • A request for an object to invoke one of its methods • Messages have names & arguments

  23. What Four Programming Approaches Have Been Discussed to date ?

  24. Methods • Perform useful functions: • interpreting user input • calculating • drawing • Are tied to the events to which an object responds • An object invokes a method as a reaction to the receipt of a message

  25. The End • “That’s all folks.”

More Related