| Table of Contents | 2 |
Introduction | 5 |
Goals | 5 |
Assumptions | 5 |
How
to Use This Book | 5 |
An
example | 7 |
A
text processing program | 7 |
A
non-OOP design | 8 |
Better
organization | 11 |
Polymorphism:
Do, be, do, be, do | 12 |
OOP
Text Input | 15 |
OOP
Connections | 18 |
Modules
— Non-OOP Programming | 20 |
OOP
Text Processing | 21 |
Classes
and subclasses | 23 |
Events,
delegation and inheritance | 26 |
Polymorphism,
again | 29 |
Displaying
the results | 30 |
Wrapping | 32 |
Why
this design is effective | 34 |
Requesting
information from the user | 36 |
Exceptions
— A Summary | 37 |
OOP
Exception Handling | 39 |
Modules
and Scope | 47 |
The
Benefits of Limiting Scope | 50 |
Limits
to the Module Scope Feature | 51 |
Final
Changes | 51 |
Putting
it all together | 53 |
How
it works | 53 |
The
benefits | 53 |
Where
to now | 54 |
Summary | 54 |
REALbasic
OOP Reference | 56 |
Classes | 56 |
Objects
and References | 58 |
Encapsulation | 59 |
Class
Extension | 60 |
Events | 66 |
Event
Handler Example | 69 |
Method
Overriding | 74 |
Method
Overriding vs Events Example | 75 |
Events
vs Method Overriding | 77 |
Uses
for Overriding | 79 |
Class
Interfaces and Polymorphism | 81 |
Class
Interface Example | 83 |
Modules:
More ways to hide | 87 |
No
Windows or ContainerControls in Modules | 88 |
Non-OOP
programming | 88 |
Namespaces | 88 |
Shared
Methods and Properties | 90 |
Constructors | 91 |
User-defined
operators | 92 |
Dynamic
features | 94 |
Dynamic
methods and properties (Operator_Lookup) | 95 |
Conversion
functions | 97 |
Introspection | 98 |
Attributes | 102 |
Pairs | 103 |
Delegates | 104 |
REALbasic’s
OOP Deficiencies and Workarounds | 117 |
Classes
are not Objects | 117 |
Class
Interfaces Don’t Support Properties | 118 |
Classes
Can’t Be Treated As Class Interfaces | 118 |
No
Introspection | 119 |
Summary:
How code gets executed | 120 |
Section
3: Object Oriented Design | 122 |
CRC
Cards | 122 |
Types
of relationships | 124 |
Use
Cases | 124 |
Where
to Learn More | 125 |
Object
Oriented Design Practices | 127 |
From
large to small | 128 |
Design
in General | 129 |
Design
in the large | 130 |
Beware
over-engineering | 130 |
Design
by breaking down responsibilities | 131 |
Retain
semantics | 133 |
Put
shared operations in a separate class or module, accessing a class
via an interface. | 134 |
Start
coding early | 135 |
Use
test-driven design | 135 |
Plan
for errors from the beginning | 137 |
Design
in between | 138 |
Distribute
intelligence broadly | 138 |
A
class should know nothing (or as little as possible) about its
users | 138 |
Split
classes with disjoint method-property usages | 139 |
Make
public methods few in number, high level | 139 |
Beware
of IsA | 140 |
Beware
public properties and accessors | 141 |
A
class should have a single responsibility (reason to change) | 141 |
Liskov
substitution principle | 142 |
Design
up close | 143 |
Place
code and properties as high in an inheritance chain as you can | 144 |
State
available at construction time that doesn’t change should be
modeled as separate classes | 144 |
Superclasses
should know nothing about their subclasses | 145 |
Make
“global” methods and properties that are only accessed by a
class and its subclasses shared | 145 |
Pass
down constructors | 146 |
MVC | 146 |
Index | 148 |