Xojo Conferences
XDCMay2019MiamiUSA

Wrapping and subclassing... pros and cons. (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Da heck is an IllegalLockingException??
Next thread: Repeating method for causing the 8r5.1 IDE to hang


Reading *CSV Files versus *.Txt Files   -   Claude Stone
  Wrapping and subclassing... pros and cons.   -   Eric dLR
   Re: Wrapping and subclassing... pros and cons.   -   Aaron Bratcher
   Re: Wrapping and subclassing... pros and cons.   -   Rafael Vallejo
   Re: Wrapping and subclassing... pros and cons.   -   Charles Yeomans
   Re: Wrapping and subclassing... pros and cons.   -   Norman Palardy
   Re: Wrapping and subclassing... pros and cons.   -   Charles Yeomans
   Re: Wrapping and subclassing... pros and cons.   -   Eric dLR
   Re: Wrapping and subclassing... pros and cons.   -   Eric dLR
   Re: Wrapping and subclassing... pros and cons.   -   Norman Palardy
   Re: Wrapping and subclassing... pros and cons.   -   Eric dLR
   Re: Wrapping and subclassing... pros and cons.   -   Charles Yeomans
   Re: Wrapping and subclassing... pros and cons.   -   Eric dLR
   Re: Wrapping and subclassing... pros and cons.   -   Peter E. Barck
    Re: Wrapping and subclassing... pros and cons.   -   Joe Strout
    RE: Wrapping and subclassing... pros and cons.   -   Tim Hare
   Re: Wrapping and subclassing... pros and cons.   -   Peter E. Barck
   Re: Wrapping and subclassing... pros and cons.   -   Norman Palardy
   Re: Wrapping and subclassing... pros and cons.   -   Charles Yeomans
   Re: Wrapping and subclassing... pros and cons.   -   Charles Yeomans
   Re: Wrapping and subclassing... pros and cons.   -   Norman Palardy
    Re: Wrapping and subclassing... pros and cons.   -   Emile SCHWARZ
     Re: Wrapping and subclassing... pros and cons.   -   Karen
     Re: Wrapping and subclassing... pros and cons.   -   Tom Benson
     Re: Wrapping and subclassing... pros and cons.   -   Charles Yeomans

Wrapping and subclassing... pros and cons.
Date: 27.01.09 17:40 (Tue, 27 Jan 2009 16:40:22 +0000)
From: Eric dLR
Hi,

I suddenly turn to have a lot of free time for a while, so I've
decided to do something I've always thought about from a long time,
but didn't have the time to do (didn't take the time, indeed!): Wrote
a class to handle all the things you need to do to connect to a
REALSQLdatabase. Including the creation of a brand new database if
needed. And in an event-driven way.

But i'm having trouble to decide if it'll be a wrapper or a subclass
of the REALSQLDatabase Class.

Any hints would be welcome.

Eric.


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Wrapping and subclassing... pros and cons.
Date: 27.03.09 22:03 (Fri, 27 Mar 2009 17:03:38 -0400)
From: Aaron Bratcher
This is VERY cool. Now the question is this: Does the internal
database classes use these interfaces?

Re: Wrapping and subclassing... pros and cons.
Date: 27.03.09 23:04 (Fri, 27 Mar 2009 17:04:52 -0500)
From: Rafael Vallejo
Years ago I developed something I named UniDB, but never released it to
the public, it makes exactly what you want, this is as I can understand
make a class to acces databases transparent isn't it?, if so I can
publish this class.

Regards

Rafael

-----Original Message-----
From: Aaron Bratcher <<email address removed>>
Reply-To: REALbasic NUG <<email address removed>>
To: REALbasic NUG <<email address removed>>
Subject: Re: Wrapping and subclassing... pros and cons.
Date: Fri, 27 Mar 2009 17:03:38 -0400

This is VERY cool. Now the question is this: Does the internal
database classes use these interfaces?

Re: Wrapping and subclassing... pros and cons.
Date: 27.01.09 17:57 (Tue, 27 Jan 2009 11:57:01 -0500)
From: Charles Yeomans

On Jan 27, 2009, at 11:40 AM, Eric dLR wrote:

> Hi,
>
> I suddenly turn to have a lot of free time for a while, so I've
> decided to do something I've always thought about from a long time,
> but didn't have the time to do (didn't take the time, indeed!):
> Wrote a class to handle all the things you need to do to connect to
> a REALSQLdatabase. Including the creation of a brand new database if
> needed. And in an event-driven way.
>
> But i'm having trouble to decide if it'll be a wrapper or a subclass
> of the REALSQLDatabase Class.
>

I've written a set of classes that wrap REALSQLDatabase and
ODBCDatabase that include exceptions and a transaction class that does
automatic rollback. My experience is that this made my code much
cleaner and more reliable. Using wrappers will allow you to have the
interface you want with less struggle.

Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Wrapping and subclassing... pros and cons.
Date: 27.01.09 18:20 (Tue, 27 Jan 2009 10:20:24 -0700)
From: Norman Palardy

On 27-Jan-09, at 9:40 AM, Eric dLR wrote:

> Hi,
>
> I suddenly turn to have a lot of free time for a while, so I've
> decided to do something I've always thought about from a long time,
> but didn't have the time to do (didn't take the time, indeed!):
> Wrote a class to handle all the things you need to do to connect to
> a REALSQLdatabase. Including the creation of a brand new database if
> needed. And in an event-driven way.
>
> But i'm having trouble to decide if it'll be a wrapper or a subclass
> of the REALSQLDatabase Class.
>
> Any hints would be welcome.

Implement the various Database interfaces :)

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Wrapping and subclassing... pros and cons.
Date: 27.01.09 18:41 (Tue, 27 Jan 2009 12:41:32 -0500)
From: Charles Yeomans

On Jan 27, 2009, at 12:20 PM, Norman Palardy wrote:

>
> On 27-Jan-09, at 9:40 AM, Eric dLR wrote:
>
>> Hi,
>>
>> I suddenly turn to have a lot of free time for a while, so I've
>> decided to do something I've always thought about from a long time,
>> but didn't have the time to do (didn't take the time, indeed!):
>> Wrote a class to handle all the things you need to do to connect to
>> a REALSQLdatabase. Including the creation of a brand new database
>> if needed. And in an event-driven way.
>>
>> But i'm having trouble to decide if it'll be a wrapper or a
>> subclass of the REALSQLDatabase Class.
>>
>> Any hints would be welcome.
>
> Implement the various Database interfaces :)
>

Where are they documented?

:)

Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Wrapping and subclassing... pros and cons.
Date: 27.01.09 18:55 (Tue, 27 Jan 2009 17:55:08 +0000)
From: Eric dLR

Le 27 janv. 09 à 17:41, Charles Yeomans a écrit :

> Where are they documented?

That's what I was going to ask... But you beat me on the line!

Eric.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Wrapping and subclassing... pros and cons.
Date: 27.01.09 19:25 (Tue, 27 Jan 2009 18:25:57 +0000)
From: Eric dLR

Le 27 janv. 09 à 16:57, Charles Yeomans a écrit :

> I've written a set of classes that wrap REALSQLDatabase and
> ODBCDatabase that include exceptions and a transaction class that
> does automatic rollback.

Why would you prefer exceptions against checking the Database.Error
property? I can't figure out how it can work.

> My experience is that this made my code much cleaner and more
> reliable.

That's why I'm doing this.

> Using wrappers will allow you to have the interface you want with
> less struggle.

Then, I'll go the wrapper way.

Thanks,

Eric.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Wrapping and subclassing... pros and cons.
Date: 27.01.09 19:54 (Tue, 27 Jan 2009 11:54:10 -0700)
From: Norman Palardy

On 27-Jan-09, at 10:41 AM, Charles Yeomans wrote:

>
> On Jan 27, 2009, at 12:20 PM, Norman Palardy wrote:
>
>>
>> On 27-Jan-09, at 9:40 AM, Eric dLR wrote:
>>
>>> Hi,
>>>
>>> I suddenly turn to have a lot of free time for a while, so I've
>>> decided to do something I've always thought about from a long
>>> time, but didn't have the time to do (didn't take the time,
>>> indeed!): Wrote a class to handle all the things you need to do to
>>> connect to a REALSQLdatabase. Including the creation of a brand
>>> new database if needed. And in an event-driven way.
>>>
>>> But i'm having trouble to decide if it'll be a wrapper or a
>>> subclass of the REALSQLDatabase Class.
>>>
>>> Any hints would be welcome.
>>
>> Implement the various Database interfaces :)
>>
> Where are they documented?

They are VERY brand new so they may not have made it into the
documentation set yet

However, adding them to a class and looking at the prototypes should
make them reasonably self evident

Check out DatabaseConnectionInterface, DatabaseFieldInterface and
RecordSetInterface

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Wrapping and subclassing... pros and cons.
Date: 27.01.09 20:18 (Tue, 27 Jan 2009 19:18:46 +0000)
From: Eric dLR

Le 27 janv. 09 à 18:54, Norman Palardy a écrit :

> They are VERY brand new so they may not have made it into the
> documentation set yet

They will find a lot of fellows along the road! ;-p
Sorry, couldn't resist.

> However, adding them to a class and looking at the prototypes should
> make them reasonably self evident
> Check out DatabaseConnectionInterface, DatabaseFieldInterface and
> RecordSetInterface.

Thanks for the information. These interfaces just look like what I was
missing.

Eric.


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Wrapping and subclassing... pros and cons.
Date: 27.01.09 20:20 (Tue, 27 Jan 2009 14:20:46 -0500)
From: Charles Yeomans

On Jan 27, 2009, at 1:25 PM, Eric dLR wrote:

>
> Le 27 janv. 09 à 16:57, Charles Yeomans a écrit :
>
>> I've written a set of classes that wrap REALSQLDatabase and
>> ODBCDatabase that include exceptions and a transaction class that
>> does automatic rollback.
>
> Why would you prefer exceptions against checking the Database.Error
> property? I can't figure out how it can work.
>>


My wrapper class has a method like this:

Function SQLSelect(query as String) as RecordSet
dim rs as RecordSet = me.DB.SQLSelect(query)
if db.Error then
raise new DatabaseException(me.DB) //copies error info into
exception properties
end if
return rs
End Function

With it I can write code like

dim rs1 as RecordSet = db.SQLSelect(query1)
dim rs2 as RecordSet = db.SQLSelect(query2)

exception dbError as DatabaseException
handleError


instead of

dim rs1 as RecordSet = db.SQLSelect(query1)
if db.Error then
handle error
end if
dim rs2 as RecordSet = db.SQLSelect(query2)
if db.Error then
handle error
end if

Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Wrapping and subclassing... pros and cons.
Date: 27.01.09 20:35 (Tue, 27 Jan 2009 19:35:26 +0000)
From: Eric dLR

Le 27 janv. 09 à 18:54, Norman Palardy a écrit :

> They are VERY brand new so they may not have made it into the
> documentation set yet

Not really that VERY brand new indeed. I tried them with 2008r2 (the
more I can go back), and they are there.
Although, the DatabaseFieldInterface has a richer implementation in
the latest release. Nice.

Eric.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Wrapping and subclassing... pros and cons.
Date: 27.01.09 22:15 (Tue, 27 Jan 2009 16:15:12 -0500)
From: Peter E. Barck
I have maybe a silly question here:

You guys all are talking about Classes here.

For my use I have made an External Module that contains a good number
of global functions, methods, and properties that provide easy
interface to the RealSQLDatabase. This module also contains lots of
local support stuff for the global functions and methods. This was
done similarly the way Joe Strout's StringUtils Module is organized.
I also made one for the REAL SQL Server.

So, how would Classes for this be different? And if it's drastically
different, what's the advantage.

Peter

Re: Wrapping and subclassing... pros and cons.
Date: 27.01.09 22:35 (Tue, 27 Jan 2009 14:35:16 -0700)
From: Joe Strout
Peter E. Barck wrote:

> For my use I have made an External Module that contains a good number of
> global functions, methods, and properties that provide easy interface to
> the RealSQLDatabase. This module also contains lots of local support
> stuff for the global functions and methods. This was done similarly the
> way Joe Strout's StringUtils Module is organized. I also made one for
> the REAL SQL Server.
>
> So, how would Classes for this be different? And if it's drastically
> different, what's the advantage.

Use a class when you need to have more than one instance of a chunk of
functionality (typically, because there is some persistent data you need
to store along with the functionality).

For example, if I were creating something that deals with a set of
strings, let's say Name, Address, Phone Number, Zip Code, etc., and
provides functionality like printing this set of data neatly, convert
to/from a vcard file, etc., then I would make this a class.

But in the case of StringUtils, there isn't any data to be stored; it's
just a collection of methods that operate on a string (either by
extending the String type, or by taking one or more string parameters).
For that, a module is appropriate.

In your case, if these are utility functions that take a RealSQLDatabase
as a parameter (or extend the RealSQLDatabase class), then a module is
fine. But if the module is keeping some persistent data (say, the
database object itself, or connection info, or something like that),
then you should probably make it into a class instead -- otherwise,
you'll never be able to have more than one such database open at a time
in an app. That'd be a bummer if you want to write a utility to copy
data from one DB to another, for example.

Short answer: if as a class, you would never have more than one
instance, or if it would have no properties, then just make it a module.

HTH,
- Joe

RE: Wrapping and subclassing... pros and cons.
Date: 27.01.09 22:37 (Tue, 27 Jan 2009 13:37:02 -0800)
From: Tim Hare
> -----Original Message-----
> From: <email address removed>
> [mailto:<email address removed>]On Behalf Of Peter
> E. Barck
> Sent: Tuesday, January 27, 2009 1:15 PM
> To: REALbasic NUG
> Subject: Re: Wrapping and subclassing... pros and cons.
>
> I have maybe a silly question here:
>
> You guys all are talking about Classes here.
>
> For my use I have made an External Module that contains a good number
> of global functions, methods, and properties that provide easy
> interface to the RealSQLDatabase. This module also contains lots of
> local support stuff for the global functions and methods. This was
> done similarly the way Joe Strout's StringUtils Module is organized.
> I also made one for the REAL SQL Server.
>
> So, how would Classes for this be different? And if it's drastically
> different, what's the advantage.
>
> Peter

The advantage with Classes is that you can have more than one instance at a
time. Ie., each one has its own set of data. It also encapsulates the
logic and is therefore potentially cleaner.

Tim


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Wrapping and subclassing... pros and cons.
Date: 27.01.09 23:09 (Tue, 27 Jan 2009 17:09:37 -0500)
From: Peter E. Barck
Charles Yeomans wrote:

>My wrapper class has a method like this:
>
>Function SQLSelect(query as String) as RecordSet
> dim rs as RecordSet = me.DB.SQLSelect(query)
> if db.Error then
> raise new DatabaseException(me.DB) //copies error info into
>exception properties
> end if
> return rs
>End Function
>
>With it I can write code like
>
>dim rs1 as RecordSet = db.SQLSelect(query1)
>dim rs2 as RecordSet = db.SQLSelect(query2)
>
>exception dbError as DatabaseException
> handleError

I put the following into my library module

Function SQLSelect(ByRef rs RecordSet, query as String) as Integer

if myDB = Nil then Return -1

rs = myDB.SQLSelect(query)

if myDB.Error then
if DebugBuild Then
MsgBox myDB. ErrorMessage
Break
else
raise new DatabaseException(me.myDB)
end if
end if

if rs = Nil Then
Return 0
else
Return rs.RecordCount
end if

End Function

Note that the Database was previously opened

then I use it as follows:

dim rs1 as RecordSet
if SQLSelect(rs1, query1) > 0 Then
:
:
end if

I find this quite handy. Frequently I use the same recordset for
multiple calls.

I also have another version where the recordset is copied into a
multidimensional Array where I can pick and choose what to extract

Peter

Re: Wrapping and subclassing... pros and cons.
Date: 27.01.09 23:23 (Tue, 27 Jan 2009 15:23:41 -0700)
From: Norman Palardy

On 27-Jan-09, at 12:20 PM, Charles Yeomans wrote:

> With it I can write code like
>
> dim rs1 as RecordSet = db.SQLSelect(query1)
> dim rs2 as RecordSet = db.SQLSelect(query2)
>
> exception dbError as DatabaseException
> handleError
>
> instead of
>
> dim rs1 as RecordSet = db.SQLSelect(query1)
> if db.Error then
> handle error
> end if
> dim rs2 as RecordSet = db.SQLSelect(query2)
> if db.Error then
> handle error
> end if

But the two code paths are not quite the same (unless handle error
also has a return or something in it) :)
The first one bails out completely if there's an error in query 1
where the second might not (it may it's hard to tell)
Wouldn't you need to write

dim rs1 as RecordSet
try
rs1 = db.SQLSelect(query1)
catch
handle error
end try
dim rs2 as RecordSet
try
rs2 = db.SQLSelect(query2)
catch
handle error
end try



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Wrapping and subclassing... pros and cons.
Date: 27.01.09 23:41 (Tue, 27 Jan 2009 17:41:31 -0500)
From: Charles Yeomans

On Jan 27, 2009, at 5:23 PM, Norman Palardy wrote:

>
> On 27-Jan-09, at 12:20 PM, Charles Yeomans wrote:
>
>> With it I can write code like
>>
>> dim rs1 as RecordSet = db.SQLSelect(query1)
>> dim rs2 as RecordSet = db.SQLSelect(query2)
>>
>> exception dbError as DatabaseException
>> handleError
>>
>> instead of
>>
>> dim rs1 as RecordSet = db.SQLSelect(query1)
>> if db.Error then
>> handle error
>> end if
>> dim rs2 as RecordSet = db.SQLSelect(query2)
>> if db.Error then
>> handle error
>> end if
>
> But the two code paths are not quite the same (unless handle error
> also has a return or something in it) :)
> The first one bails out completely if there's an error in query 1
> where the second might not (it may it's hard to tell)
> Wouldn't you need to write
>
> dim rs1 as RecordSet
> try
> rs1 = db.SQLSelect(query1)
> catch
> handle error
> end try
> dim rs2 as RecordSet
> try
> rs2 = db.SQLSelect(query2)
> catch
> handle error
> end try
>

Good point. In my little world, "handle error" probably would bail
out of the method.

Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Wrapping and subclassing... pros and cons.
Date: 27.01.09 23:45 (Tue, 27 Jan 2009 17:45:02 -0500)
From: Charles Yeomans

On Jan 27, 2009, at 5:09 PM, Peter E. Barck wrote:

> Charles Yeomans wrote:
>
>> My wrapper class has a method like this:
>>
>> Function SQLSelect(query as String) as RecordSet
>> dim rs as RecordSet = me.DB.SQLSelect(query)
>> if db.Error then
>> raise new DatabaseException(me.DB) //copies error info into
>> exception properties
>> end if
>> return rs
>> End Function
>>
>> With it I can write code like
>>
>> dim rs1 as RecordSet = db.SQLSelect(query1)
>> dim rs2 as RecordSet = db.SQLSelect(query2)
>>
>> exception dbError as DatabaseException
>> handleError
>
> I put the following into my library module
>
> Function SQLSelect(ByRef rs RecordSet, query as String) as Integer
>
> if myDB = Nil then Return -1
>
> rs = myDB.SQLSelect(query)
>
> if myDB.Error then
> if DebugBuild Then
> MsgBox myDB. ErrorMessage
> Break
> else
> raise new DatabaseException(me.myDB)
> end if
> end if
>
> if rs = Nil Then
> Return 0
> else
> Return rs.RecordCount
> end if
>
> End Function
>
> Note that the Database was previously opened
>
> then I use it as follows:
>
> dim rs1 as RecordSet
> if SQLSelect(rs1, query1) > 0 Then
> :
> :
> end if
>
> I find this quite handy. Frequently I use the same recordset for
> multiple calls.
>
> I also have another version where the recordset is copied into a
> multidimensional Array where I can pick and choose what to extract

I'll just say that our coding styles are antipodal :)

Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Wrapping and subclassing... pros and cons.
Date: 28.01.09 00:34 (Tue, 27 Jan 2009 16:34:14 -0700)
From: Norman Palardy

On 27-Jan-09, at 3:41 PM, Charles Yeomans wrote:

> Good point. In my little world, "handle error" probably would bail
> out of the method.

I kind of figured it might to make the code equivalent :)

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Wrapping and subclassing... pros and cons.
Date: 28.01.09 00:58 (Wed, 28 Jan 2009 00:58:26 +0100 (CET))
From: Emile SCHWARZ
Hi all,

I think that I understand what is sub-classing, but what is wrapping ?

wikipedia (http://en.wikipedia.org/wiki/Wrapping) said abour wrapping:

Wrapping
>From Wikipedia, the free encyclopedia

* Wrapping (overflow), a variable that exceeds its maximum value in computing
* Wrapping (graphics), the process of limiting a position to an area in computer graphics
* Wrapping paper, paper used for wrapping a gift
* Word wrapping, a feature supported by most text editors that allows them to insert soft returns at the right-side margins of a document
* Mandrel wrapping, a technique used to modify the modal distribution of a propagating optical signal in multimode fiber optics
* Buddy wrapping, the act of bandaging a damaged (particularly a fractured) finger or toe together with a healthy one
* Wire wrapping, a technique for constructing small numbers of complex electronics assemblies


TIA,

Emile

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Wrapping and subclassing... pros and cons.
Date: 28.01.09 01:29 (Tue, 27 Jan 2009 19:29:22 -0500)
From: Karen

On Jan 27, 2009, at 6:58 PM, Emile SCHWARZ wrote:

> think that I understand what is sub-classing, but what is wrapping ?

I am not a computer science person but I think what is meant is by
the term is composition...

You create a new class which has as one of it's private properties
the class (or classes) to be wrapped. You create the API to the
methods and properties of the wrapped/contained class(es) in the
parent/wrapper class.

From the outside all you see in the wrapper with the desired API/
functinality.

- Karen

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Wrapping and subclassing... pros and cons.
Date: 28.01.09 02:17 (Wed, 28 Jan 2009 01:17:38 +0000)
From: Tom Benson
Karen,

What you are describing is actaully called "encapsulation"...

Emile,

Wrapping is simply creating your own API around another using classes
and functions (models & controllers).

For example, I am in the middle of wrapping the Google Charts API into
a set of REALbasic classes.
e.g. This will enable people using these classes to say:

GoogleCharts.DrawChart(chartType,data(),labels())

and my wrapper will take care of the rest, which in this instance is
formatting an URL and sending it to Google, then interpreting the
result and returning a picture.

So, basically, a wrapper is an "abstraction layer"... you may find a
more applicable entry for that in WikiPedia.

Cheers,
Tom

On 28/01/2009, at 12:29 AM, Karen wrote:

>
> On Jan 27, 2009, at 6:58 PM, Emile SCHWARZ wrote:
>
>> think that I understand what is sub-classing, but what is wrapping ?
>
> I am not a computer science person but I think what is meant is by
> the term is composition...
>
> You create a new class which has as one of it's private properties
> the class (or classes) to be wrapped. You create the API to the
> methods and properties of the wrapped/contained class(es) in the
> parent/wrapper class.
>
> From the outside all you see in the wrapper with the desired API/
> functinality.
>
> - Karen

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Wrapping and subclassing... pros and cons.
Date: 28.01.09 02:29 (Tue, 27 Jan 2009 20:29:08 -0500)
From: Charles Yeomans
Not quite. If I may pontificate...

Encapsulation, in its original meaning, describes the idea of storing
data with the functions that act upon it. Unfortunately, it has
become entangled and confused with information hiding. I think Karen
gave a pretty good description of the idea of a wrapper; it's a
general term. What we've been talking about, classes to wrap the Rb
Database API, is an application of the so-called Adapter pattern.

Charles Yeomans

On Jan 27, 2009, at 8:17 PM, Tom Benson wrote:

> Karen,
>
> What you are describing is actaully called "encapsulation"...
>
> Emile,
>
> Wrapping is simply creating your own API around another using
> classes and functions (models & controllers).
>
> For example, I am in the middle of wrapping the Google Charts API
> into a set of REALbasic classes.
> e.g. This will enable people using these classes to say:
>
> GoogleCharts.DrawChart(chartType,data(),labels())
>
> and my wrapper will take care of the rest, which in this instance is
> formatting an URL and sending it to Google, then interpreting the
> result and returning a picture.
>
> So, basically, a wrapper is an "abstraction layer"... you may find a
> more applicable entry for that in WikiPedia.
>
> Cheers,
> Tom
>
> On 28/01/2009, at 12:29 AM, Karen wrote:
>
>>
>> On Jan 27, 2009, at 6:58 PM, Emile SCHWARZ wrote:
>>
>>> think that I understand what is sub-classing, but what is wrapping ?
>>
>> I am not a computer science person but I think what is meant is by
>> the term is composition...
>>
>> You create a new class which has as one of it's private properties
>> the class (or classes) to be wrapped. You create the API to the
>> methods and properties of the wrapped/contained class(es) in the
>> parent/wrapper class.
>>
>> From the outside all you see in the wrapper with the desired API/
>> functinality.
>>
>> - Karen
>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>