1 / 17

Java & Object-Oriented Programming

Java & Object-Oriented Programming. Dieter W. Storr August 2001. Java & Object-Oriented Programming. OODBMS. OOP. Classes. Objects. Methods. Subclasses. Variables. Instances. Inheritance. UML. Superclasses. OMG. Java & Object-Oriented Programming. Classes

iliana
Télécharger la présentation

Java & 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. Java & Object-Oriented Programming Dieter W. Storr August 2001

  2. Java & Object-Oriented Programming OODBMS OOP Classes Objects Methods Subclasses Variables Instances Inheritance UML Superclasses OMG Dieter W. Storr

  3. Java & Object-Oriented Programming • Classes • Methods are behavioral elements (algorithm, function, procedure) • Variables (data types) • Attributes are data elements (data member, instance variable, data field) • Objects (Instance) • Entities of a Class Dieter W. Storr

  4. Java & Object-Oriented Programming Dieter W. Storr

  5. Java & Object-Oriented Programming • Organize Classes and Class Behavior • InheritanceEnables one class(subclass) to inherit all of the behavior and attributes of another class (superclass) • InterfacesCollection of methods that indicate a class has some behavior in addition what it inherits from its superclasses. • PackagesA grouping of classes and/or sub-packages Dieter W. Storr

  6. Java & Object-Oriented Programming • Creating a Class Hierarchy, e.g. • Dragons and Jabberwocks • Both are large monsters that eat peasants • Both have sharp claws, powerful teeth, type-A personalities • Medusa, Yeti, Sasquasch, Grue, DustBunny==> find a superclass and subclasses Dieter W. Storr

  7. Java & Object-Oriented Programming • Creating a Class Hierarchy, e.g. • Monster Superclass • Behavior: To be ferocious, terrifying, and bad for the neighborhood • Instance variable: Sex, Color • FlyingMonster Subclass • Behavior: Swooping down on prey, carrying peasants of into the sky, dropping them from great hights Dieter W. Storr

  8. Java & Object-Oriented Programming • Creating a Class Hierarchy, e.g. • WalkingMonster Subclass • Behavior: More susceptible to fallen arches • Four Legged Subclass of FlyingMonster • Behavior: • Subclasses Mammal, Reptile, Amphibian Dieter W. Storr

  9. Java & Object-Oriented Programming Dieter W. Storr

  10. Java & Object-Oriented Programming Dieter W. Storr

  11. Java & Object-Oriented Programming class Jabberwock { String color; String sex; boolean hungry; void feedJabberwock() { if (hungry == true) { System.out.println(“Yum -- a peasant!”); hungry = false; } else System.out.println(“No -- already ate.”); } Dieter W. Storr

  12. Java & Object-Oriented Programming void showAttributes() { System.out.println(“This is a “ + sex + “ “ + color + “ jabberwock.”); if (hungry == true) System.out.println(“The jabberwock is hungry.“); else System.out.println(“The jabberwock is full.“); } <snip> Dieter W. Storr

  13. Java & Object-Oriented Programming • Unified Modeling Language • UML (Unified Modeling Language) is a standard notation for the modeling of real-world objects as a first step in developing an object-oriented design methodology. Dieter W. Storr

  14. Java & Object-Oriented Programming • Its notation is derived from and unifies the notations of three object-oriented design and analysis methodologies: • Grady Booch's methodology for describing a set of objects and their relationships • James Rumbaugh's Object-Modeling Technique (OMT) • Ivar Jacobson's approach which includes a use case methodology Dieter W. Storr

  15. Java & Object-Oriented Programming • Use-Case Modeling • An actor represents anything that interacts with the system • A use case is a “chunk” of functionality performed by a system, yielding a measurable result of value for an actor Dieter W. Storr

  16. Java & Object-Oriented Programming A use case diagram is drawn to illustrate that use cases and actors interact by sending stimuli to one another Customer Conduct Bank Transactions Bank Run Reports Maintain ATM Machine ATM Maintainer Dieter W. Storr

  17. Java & Object-Oriented Programming • Scenario • Object (State, Behavior, Identity) • Interaction Diagrams • Sequence Diagrams and Scripts • Collaboration Diagrams • Link Notations • Classes and Objects Dieter W. Storr

More Related