1 / 11

Objects Vs. Dino-Fortran

Why you should care about Object Orientation (OO). Objects Vs. Dino-Fortran. Iñaki Serraller Vizcaino. Overview. Objectives OO Vs. Procedural Concepts Objects Classes Inheritance Polymorphism Features When to Use OO?. Objectives.

saima
Télécharger la présentation

Objects Vs. Dino-Fortran

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. Why you should care about Object Orientation (OO) Objects Vs. Dino-Fortran IñakiSerraller Vizcaino

  2. Overview • Objectives • OO Vs. Procedural • Concepts • Objects • Classes • Inheritance • Polymorphism • Features • When to Use OO?

  3. Objectives To explain a different programming paradigm and its possible applications Which programming language do you use? ¡To turn you all into Java programmers! Bua Ha HaHa

  4. OO vs. Procedural

  5. Objects A dog • Tend to correspond to objects in the real world • Two characteristics: State & Behaviour • Dog state: number of legs (permanent), age (changing) • Dog behaviour: bark, fetch, wag tail, etc. • Composition: objects can be made of other objects • Observe and note

  6. Classes A dog blueprint • Object blueprints Class Dog { String name; int age; Colour colour; bark(); sit(); fetch(Object thing); } • Dog class has colour, dog object is black and white // Create a dog instance Dog lassie = new Dog(“Lassie”, 0, new Colour(“Black”, “White”)); lassie.bark();

  7. Inheritance • Different kinds share traits • All mammals have age and colour • Dog and Cat classes extend the Mammal (super) class • Specialisation • getAgeInHumanYears() would use different multipliers. • Extension • Dog would add bark(), while cat would add meow() • Abstraction – no mammals exist • Hierarchies – different dog breeds A lemur, unhappy to be subclassed

  8. Polymorphism • Can be seen as a consequence of inheritance which allows treating Dogs and Cats as mammals. • The same code can process the age of all mammals • Dog’s bark() and cat’s meow() but all animals speak() • Interfaces • Swimmer adds swim() • Parametric polymorphism allows code which works with any kind of object • Lists, maps, etc. Claytonia virginica

  9. Features • Messaging - AYCDISAM • All you can do is send a message • Pass objects around • Modularity • Independent maintenance • Simplifies validation • Data-encapsulation • Facilitates re-use • Application Programmer Interfaces (APIs) Happy programmers are polymorphic A happy programmer

  10. When to use OO? • Large software because it’s extremely good at: • Managing complexity • Facilitating flexibility • Maintainability • Design patterns are common solutions to common problems • Specifically developed and appropriate to OO • For small stuff do whatever you want • Many features are common to procedural languages, just done with more style

  11. Thank You! • Resources • http://java.sun.com/docs/books/tutorial/java/concepts/ • http://en.wikipedia.org/wiki/Object_oriented • http://en.wikipedia.org/wiki/Procedural_programming • http://www.paulgraham.com/reesoo.html • Critique of OO: http://www.paulgraham.com/noop.html

More Related