1 / 11

Advanced Object Oriented Programming – Abstract classes and Interfaces

Advanced Object Oriented Programming – Abstract classes and Interfaces. Chapter 27. Purpose: to simplify the design of medium to large sized programs. Advanced OOD concern with the identification of class structures and inheritance. Chapter facilities:.

december
Download Presentation

Advanced Object Oriented Programming – Abstract classes and Interfaces

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. Advanced Object Oriented Programming – Abstract classes and Interfaces Chapter 27

  2. Purpose: to simplify the design of medium to large sized programs • Advanced OOD concern with the identification of class structures and inheritance

  3. Chapter facilities: • Interfaces: “neatest” way for programs to deal with events • Abstract classes

  4. Abstract classes – set up a class to be reused • Example program “Rectangle” See Author’s web site. Rectangle” extends “Shape” which is an abstract class • Declaring a class abstract forces programmer who uses it (via inheritance,) to provide missing methods – which “enforces” a particular design

  5. Interfaces • Used in “Balloon” • Public interface Balloon { … • Note NO class • An interface describes only the services provided by the class • public class Spheroid implements Balloon …

  6. Compiler checks to see if it complies with the interface declaration • Examples: Programs that use Buttons implement ActionListeners and Scrollbars AdjustmentListeners

  7. Interface can be used to describe classes in a program • Inheritance structure “Is a” relationship • Can Not describe: • Implementations of methods • Classes which use other classes (“has a”) relationship

  8. Multiple Inheritance • Some languages (C++) not Java • Java allows multiple implementations • Example programs: “Entertainment” and program “TV” which extends “Entertainment”

  9. Interfaces versus abstract classes • 1. Abstract classes can provide implementation of one or more methods • 2. Can implement more than one interface but only extend (inherit) from one abstract class • 3. An interface is something that is used at compile time to perform checking • 4. Abstract class implies it’s methods will be fleshed out by the class that extends it

  10. Designing multithreaded programs • 1. Use methods described in chapter 21 • 2. Analyze applications to see activities that need to be carried out in parallel • 3. Identify those objects that need to be threads • 4. Identify the nature of the interaction between threads (independent, mutual, exclusion, producer-consumer)

  11. Other approaches: • Information systems: examples • Airline ticket reservation system • Real time systems • Fly by wire • Knowledge based systems • AI • Parallel or concurrent systems • Any computer systems that can carry on two or more tasks simultaneously • Mathematical “complex” processing • Games especially those with good graphics

More Related