s-news
[Top] [All Lists]

Re: OOP enquiry

To: John Kershaw <kershaw@unb.ca>
Subject: Re: OOP enquiry
From: Ramon Diaz-Uriarte <rdiaz@cnio.es>
Date: Mon, 6 Nov 2006 15:29:08 +0100
Cc: s-news@lists.biostat.wustl.edu
In-reply-to: <Pine.GSO.4.58.0611060747260.21068@jupiter>
References: <Pine.GSO.4.58.0611060747260.21068@jupiter>
User-agent: KMail/1.9.1
On Monday 06 November 2006 12:56, John Kershaw wrote:
> Hello all,
>
> I have used S/Splus/R since the mid1980s.  As a former FORTRAN user, I
> have always built code on the fly for the prupose immediately needed and
> have amassed quite a collection of relatively useless functions because
> they only relate to the job I needed done.  I have been reading a bit
> about the OOP approaches and can see a lot of value in this approach (who
> says old dogs can't learn new tricks?).  I have found bits and pieces on
> the web and in the help files/manuals, but would really like a good
> comprehensive source on OOP preferably in R or Splus.  Is there such a
> beast?  If not, what would be a good starting reference for OOP that I
> could relatively easily transfer to R/Splus?  Sorry for the somewhat
> "Non"group posting, but it would be useful to get a samplingpeople's
> perspectives on this.
>
> JAK

Dear John,

Maybe I'll get into trouble because of my answer, but here it goes anyway. Its 
a digression, and might not be of any practical value :-).

You say:

> have amassed quite a collection of relatively useless functions because
> they only relate to the job I needed done.  

OK, this is the problem you want to solve.


> I have been reading a bit 
> about the OOP approaches and can see a lot of value in this approach (who
> says old dogs can't learn new tricks?).  

Sure, OOP is _one_ way of dealing with your problem above (though what exactly 
is OOP might be vague ---see Graham's link below). But some people say there 
are other approaches for dealing with this problem which are not necessarily 
inferior to OOP. Some people even argue that OOP has been (way too much) 
oversold. So oversold, in fact, that saying "xyz is an object oriented 
language" seems to say something about the inherent value of language xyz 
(something that might end up seeming even more relevant than how expressive 
the language is, or how un-contorted the syntax is, etc).  The conclusion 
that OOP is oversold is something one might reach after reading good, 
reputable programming books such as  "Concepts, techniques, and models of 
computer programming", by van Roy and Haridi, and similar (note I am not 
claiming the authors say this). A short piece on these issues is the comment 
by Paul Graham 
http://paulgraham.com/reesoo.html
which contains additional links.


So maybe there are other ways of dealing with your problem that are better 
suited for the kinds of things you do. 

That said, I find the usage of S3-style classes just fine, and perfectly 
natural, but I feel terribly overwhelmed and imprissoned trying to use 
S4-style classes. (I've used objects in C++ and I've used them in Python, but 
most of my Python is not OOP). But this might be a personal handicap.


As for your original question, I think usage of S3-style classes is present in 
most of the R literature, such as the "S programming" by Venables and Ripley, 
and some of the original S books. Examples of S3 classes are present in many 
(most?) CRAN packages and the recommended and built-in packages.

I think the best place to understand what S4 is about might start 
with "Programming with data", by Chambers. And there is lots of code using S4 
classes in BioConductor.


Best,

R.

P.S. Pardon the rambling; might be a hangover from some discussion with Java 
programmers which seem to think that Java is the cannon that defines what is 
desirable in programming.




>
> --------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu.  To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> the BODY of the message:  unsubscribe s-news

-- 
Ramón Díaz-Uriarte
Bioinformatics 
Centro Nacional de Investigaciones Oncológicas (CNIO)
(Spanish National Cancer Center)
Melchor Fernández Almagro, 3
28029 Madrid (Spain)
Fax: +-34-91-224-6972
Phone: +-34-91-224-6900

http://ligarto.org/rdiaz
PGP KeyID: 0xE89B3462
(http://ligarto.org/rdiaz/0xE89B3462.asc)



**NOTA DE CONFIDENCIALIDAD** Este correo electrónico, y en su caso los ficheros 
adjuntos, pueden contener información protegida para el uso exclusivo de su 
destinatario. Se prohíbe la distribución, reproducción o cualquier otro tipo de 
transmisión por parte de otra persona que no sea el destinatario. Si usted 
recibe por error este correo, se ruega comunicarlo al remitente y borrar el 
mensaje recibido.
**CONFIDENTIALITY NOTICE** This email communication and any attachments may 
contain confidential and privileged information for the sole use of the 
designated recipient named above. Distribution, reproduction or any other use 
of this transmission by any party other than the intended recipient is 
prohibited. If you are not the intended recipient please contact the sender and 
delete all copies.


<Prev in Thread] Current Thread [Next in Thread>