Thinking Objects With A Procedural Brain - PowerPoint PPT Presentation

About This Presentation
Title:

Thinking Objects With A Procedural Brain

Description:

School teaches us to read and follow the directions. ... Until you want to stop: put out left foot, put out right foot, repeat. ... – PowerPoint PPT presentation

Number of Views:42
Avg rating:3.0/5.0
Slides: 20
Provided by: cfc5
Category:

less

Transcript and Presenter's Notes

Title: Thinking Objects With A Procedural Brain


1
Thinking Objects With A Procedural Brain
Jeff Peters jeff_at_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
QA
Write a Comment
User Comments (0)
About PowerShow.com