Relevant Logic icon

Relevant Logic


Table of Contents

What follows is the Table of Contents from the Book.
Table of Contents2
Introduction5
Goals5
Assumptions5
How to Use This Book5
An example7
A text processing program7
A non-OOP design8
Better organization11
Polymorphism: Do, be, do, be, do12
OOP Text Input15
OOP Connections18
Modules — Non-OOP Programming20
OOP Text Processing21
Classes and subclasses23
Events, delegation and inheritance26
Polymorphism, again29
Displaying the results30
Wrapping32
Why this design is effective34
Requesting information from the user36
Exceptions — A Summary37
OOP Exception Handling39
Modules and Scope47
The Benefits of Limiting Scope50
Limits to the Module Scope Feature51
Final Changes51
Putting it all together53
How it works53
The benefits53
Where to now54
Summary54
REALbasic OOP Reference56
Classes56
Objects and References58
Encapsulation59
Class Extension60
Events66
Event Handler Example69
Method Overriding74
Method Overriding vs Events Example75
Events vs Method Overriding77
Uses for Overriding79
Class Interfaces and Polymorphism81
Class Interface Example83
Modules: More ways to hide87
No Windows or ContainerControls in Modules88
Non-OOP programming88
Namespaces88
Shared Methods and Properties90
Constructors91
User-defined operators92
Dynamic features94
Dynamic methods and properties (Operator_Lookup)95
Conversion functions97
Introspection98
Attributes102
Pairs103
Delegates104
REALbasic’s OOP Deficiencies and Workarounds117
Classes are not Objects117
Class Interfaces Don’t Support Properties118
Classes Can’t Be Treated As Class Interfaces118
No Introspection119
Summary: How code gets executed120
Section 3: Object Oriented Design122
CRC Cards122
Types of relationships124
Use Cases124
Where to Learn More125
Object Oriented Design Practices127
From large to small128
Design in General129
Design in the large130
Beware over-engineering130
Design by breaking down responsibilities131
Retain semantics133
Put shared operations in a separate class or module, accessing a class via an interface.134
Start coding early135
Use test-driven design135
Plan for errors from the beginning137
Design in between138
Distribute intelligence broadly138
A class should know nothing (or as little as possible) about its users138
Split classes with disjoint method-property usages139
Make public methods few in number, high level139
Beware of IsA140
Beware public properties and accessors141
A class should have a single responsibility (reason to change)141
Liskov substitution principle142
Design up close143
Place code and properties as high in an inheritance chain as you can144
State available at construction time that doesn’t change should be modeled as separate classes144
Superclasses should know nothing about their subclasses145
Make “global” methods and properties that are only accessed by a class and its subclasses shared145
Pass down constructors146
MVC146
Index148