leistware.com

OOP

Objects Everywhere...


The first step in understanding Object Oriented Programming (OOP) or Design (OOD) is understanding objects. If you are a procedural programmer it takes a minute. But when you get it... it hits you like a brick.

Objects are fun... objects are cool... most of all... objects are useful. Objects are like pockets... places to store collections of data. Objects are like tools... they perform tasks. Objects are like Bee's... they have a hierarchy.

Objects break processing down into smaller parts... Divide and Conquer! AND objects save a lot of work ... because they're all about reusable code.

They Didn't Start Out That Way...


In the beginning... objects start out as classes... that's where the code goes. Classes are instantiated into objects.

A class is a blue print or a plan. It is compiled into object or byte code and an object gets instantiated from it. Each class can make many objects. Some classes are boss classes and boss around other classes.

Some classes don't get instantiated into objects in the traditional way. They have to be instantiated (born) in a special way because of what they represent or the functions that they perform. For example... objects that represent physical hardware must be created in other ways than normal objects are created... there can't be too many of them around... they're special.

He Has His Fathers Eyes...


All objects have at least one parent! Not a Mother or a Father... but a parent or parent(s). The object is then said to be a decendant or a child. Decendant objects inherit all of the characteristics of thier parent(s)... but not always directly.

Parent objects are allowed to keep secrets from thier decendants or children under the laws of scope, visibility and which is a whole methodology about keeping secrets. The decendants may or may not be able to get the secrets... but they will have to ask permission. encapsulation

Encapsulation is not just about keeping secrets from decendants... it's about keeping secrets. Under encapsulation, some objects keep information soooo secret... they tell no one. Not because they don't want to... because they can't. But that's another topic.

Links

Server: Ruger

DBID: db.wam

©2019 Leistware Data Systems