1 / 11

BACS 287

BACS 287. Basics of Object-Oriented Programming 1. What is Object-Oriented Programming?. An approach to programming that combines data and procedures into a single unit (i.e., an object ) This produces a tight coupling between the data and the logic that acts upon the data

reuel
Download Presentation

BACS 287

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. BACS 287 Basics of Object-Oriented Programming 1 BACS 287

  2. What is Object-Oriented Programming? • An approach to programming that combines data and procedures into a single unit (i.e., an object) • This produces a tight coupling between the data and the logic that acts upon the data • Results in natural modular programs that promote code reuse BACS 287

  3. What is Object-Oriented Programming? • Objects can be grouped into hierarchies (i.e., trees) that share characteristics via inheritance • The definition of a type of object is called a class • The template of the objects and their inheritance relationships is called the class hierarchy BACS 287

  4. What is Object-Oriented Programming? • Visual Basic is an object-oriented language • True object-oriented languages involve 3 core concepts: • Inheritance • Encapsulation • Polymorphism BACS 287

  5. Object-Oriented Inheritance • Enables you to create a new object based upon an existing object merely my stating what is different • This is called sub-classing • Example: Class: Vehicle • Sub-Classes: Car, Boat, Airplane • The sub-classes share the basic attributes of vehicle but have differences. The differences are said to “specialize” the super-class. BACS 287

  6. Object-Oriented Encapsulation • Means hiding the implementation details within an object • Only the methods and properties needed to make the object perform are exposed to the application (i.e., the “outside world”) • Enables conceptual abstraction • Visual Basic supports encapsulation well BACS 287

  7. Object-Oriented Polymorphism • Enables different objects to respond to the same message in different ways • Each object type does whatever is most appropriate for the data it contains • For Example: the ADD message would produce different results in objects that held dates, times, strings, and numbers BACS 287

  8. Object-Oriented Terminology • Class (sub-class) • Class Hierarchy • Inheritance • Object (instance) • Properties – characteristic of the object • Methods – procedure that an object to perform • Events – actions or situations that trigger methods BACS 287

  9. Object-Oriented Terminology • Message – what the event sends to the method to trigger it to execute • Encapsulation • Polymorphism • Conceptual abstraction – hiding unnecessary details • Code reuse • Collection – group of objects with something in common BACS 287

  10. Object-Orientation and Event-Driven Programming • Event-Driven programming and Object-Oriented programming are closely related • The event model of the programming language determines the events that the objects can respond to • It is possible to separate the two concepts, but this is normally not done BACS 287

  11. Quiz • What are the 3 key characteristics of an object-oriented language? • What is meant by “conceptual abstraction” • How is “polymorphism” related to the class hierarchy? • What does an “event” trigger? • Is Visual Basic a “true” object-oriented language? BACS 287

More Related