Ross Santos - OOP-lates (the marriage of objects and templates)

by Tom Hebenstreit, Review Editor

Published 1997-09-01    Printer-friendly version

This session introduced us to a new concept, coined 'OOP-Lates' by presenter Ross A. Santos. Ross has been an early (and vocal) advocate of the benefits of Object Oriented Programming (OOP), and his presentation put forth his vision of how OOP and Clarion Templates can be combined into a whole greater than their various parts.

Ross is Executive Vice President of X-Gen, LLC; makers of RichX, a full featured word processing OCX which just happens to be heavily object oriented and which comes with a template set which interfaces with the RichX object - do we see a pattern here?<G>

Ross's presentation really covered two areas - an explanation of OOP-Lates, and a more general discussion of OOP, which included two simple example objects for formatting strings and parsing, addresses. The examples were then wrapped in a template to produce an OOP-Late. Ross also used the examples to demonstrate certain OOP programming practices which he favors (and which we'll discuss in greater depth later on).

What are OOP-Lates?

Ross defined OOP-Lates as follows:

"OOP provides the mechanics for defining processes and data through natural code organization. Templates provide a method to create code, over and over, reducing programming redundancy. But, neither is nirvana. However, when married, these two technologies form one of the most powerful code generation and management tools available: OOP-Lates."

In discussing the benefits and drawbacks of OOP and Templates, he broke it down like this:

What's Right

OOP - Reduced code, better maintenance and the ultimate in code re-use.

Templates - Reduced coding, dictionary based generation creating the fastest database RAD solution available.

What's Wrong

OOP - Requires coding and the knowledge of how things fit together to be productive.

Templates - Creates unnecessary code and can be too specific for generic use.

And his solution? (Bet you see it coming...)

"Defining objects to replace redundant in-line code and then Wiring these objects together through "smart" and "flexible" code generation - effectively marrying the best of both technologies to gain the biggest bang for the buck... OOP-Lates"

And what do OOP-Lates consist of? Classes, Templates, Data and Processes (contained in the Classes) and finally, Interfaces and Wrappers (the exposed bits of the Classes which you use to interact with the Data and Processes in the Class).

Writing Classes and OOP-Lates (selected tips)

  • Use commonly accepted conventions when naming data properties in the object, and use meaningful terms to describe object's methods, especially in its interface to the outer world (e.g., 'CustomerStatus' rather than 'CS'). Most importantly, however you decide to do it, BE CONSISTENT.
  • Ross said he had never seen an OOP class which was just written once - most are written, re-written and re-written again in an iterative process as the spec for the class gets closer to solving the actual business problem for which it is designed.
  • Break code down into small manageable pieces that can be re-used.
  • Using a Base class can allow you to build a hierarchy among your classes, gaining benefits in the descendants of the parent for free (inheritance).
  • Interface Classes insulate you from the gory details of the underlying object.
  • Wrapper Classes are essentially Interface Classes with a more pure one-to-one relationship with the underlying object.
  • Extension and Code Templates provide the 'glue' to associate controls, processes, etc., with a Class. These templates provide the 'visual' interface to working with the objects.

The examples

Ross used a pair of simple classes to demonstrate how he implements OOP-Lates. The first example was written to allow for special formatting of strings (phone numbers) in cases where the standard CW picture format fails (for example, it blanks a string if the data doesn't match what it expects). The second example allowed a user to type an address into a text box, which it then parsed out and placed the resulting address components into separate fields (and vice versa). A pair of simple templates completes the package, allowing you to set up your program's interaction with the object without resorting to any hand coding.

If you are interested in downloading these examples, they will be made available AFTER DevCon gets over (and Ross gets home) on the X-Gen web site: http://www.x-gen.com

NOTE: These are EXAMPLES to be used as an instructional aid in your quest to understand OOP, Objects and Templates (OOP-Lates). They work, but do not have a lot of the error checking, etc., which would be required to have them do production work...

Printer-friendly version

Reader Comments

To add a comment to this article you must log in.

 
 

Search

 

Advanced Search
Topical Index

Related Articles

Subscribe to
ClarionMag

One year: $169

(includes all back issues since '99)

Renewals from $119

Two years: $269

Renewals from $219

More Info

Subscribe Now!

ClarionMag Blog

RSS Feeds

Updates via Email

Enter your Email


Powered by FeedBlitz

Quick Links