Objection!
or: How I Learned to Stop Worrying and Love the Code
Anthony Blardo
ablardo@gmail.com
@apblardo
Definition
A data structure in object-oriented programming that can contain functions as well as data, variables, and other data structures.
Object-Oriented
- Everything is an Object
- Objects communicate by sending and receiving messages
- Every Object is an instance of a class
Concepts
- Identity
- Behavior
- State
- Encapsulation
- Polymorhpism
Identity
Address of location in memory.
State
- Attributes
- Computed values
Encapsulation
Including all of the methods and attributes that are required for an object to do its job.
Polymorphism
Multiple datatypes responding to the same messages.
USE OBJECTS
- Obvious.
- Primitives are great, but objects are better.
- Abuse polymorphism.
Inheritance
Classes can inherit attributes and behaviors from a parent object.
- Parent, superclass, base class
- Child, subclass, derived class