1 / 19

Thinking Objects With A Procedural Brain

Thinking Objects With A Procedural Brain. Jeff Peters jeff@grokfusebox.com. Why Are You Here?. You have a procedural brain You want/need to grok OOP You don't know where to start Available publications are frustrating. Let's Meet The Audience!. A Horror Story. Procedures vs. Objects.

aine
Download Presentation

Thinking Objects With A Procedural Brain

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. Thinking Objects With A Procedural Brain • Jeff Peters • jeff@grokfusebox.com

  2. Why Are You Here? • You have a procedural brain • You want/need to grok OOP • You don't know where to start • Available publications are frustrating Let's Meet The Audience!

  3. A Horror Story

  4. Procedures vs. Objects

  5. Why Procedures Are Comfortable • School teaches us to read and follow the directions. • We learn from an early age to follow A-to-Z and 1-2-3. Start Finish

  6. Why Objects Aren't(Comfortable, That Is) • They seem to have a life of their own (like children sometimes). • They don't have to do things “in order”. Finish? Start

  7. Objects Don't Need to be Scary • Object = Properties with Methods • Properties = characteristics • Methods = actions

  8. Properties Describe • If the object is Jeff: • Jeff's hair color = brown (mostly) • Jeff's eye color = brown • Jeff's family = Peters

  9. Methods Are Procedures(A Safe Haven for Us) • Small (“atomic”) • Specific • Easy to maintain • Ex: Jeff can walk; the walk method might say, “Lean forward. Until you want to stop: put out left foot, put out right foot, repeat.” • Much easier than a long procedure to control who's walking, where they're going, how fast to go, etc. Objects encourage focus.

  10. Class = Object Blueprint

  11. Instance = An Object

  12. Why Use Objects At All? • Objects are Scale Models • Collections of objects model a system • School, for example • Some objects can be pulled out and placed in a different system model without a lot of modification. • A person might go from School to Home

  13. Objects Syntactically • objectName.property • objectName.method()

  14. Quick Buzzwords • Inheritance = “I am what my parent is.” • Polymorphism = “I react differently under different conditions” • Encapsulation = “You can't make me do anything I don't know how to do.”

  15. How to Think Objects • Think in first person perspective • (Procedures represent third person perspective) • Think small • (Procedural programs tend to be big) • Think interaction • (Procedural programs control instead)

  16. How to Think ObjectsFirst Person Perspective Flying a plane is first-personperspective; you only worry about what you can do.Objects should be like this. “God's eye view” is third-person perspective; you worry about everything in the environment. Objects should NOT be like this.

  17. How to Think ObjectsThink Small David only worried aboutone task.Objects should be like this. Goliath worried about his armor, helmet, shield, club, being the biggest, and so on. Objects should NOT be like this.

  18. How to Think ObjectsThink Interaction Players interact to get work done.Objects should be like this. Pointy-Haired Bosses oversee everything.Objects should NOT be like this.

  19. Q&A

More Related