Hi, Terry:
Thanks for the comments. I too vastly prefer S3 to S4. Your
comparison is based on much greater experience than mine.
Could you please check the link you sent? I couldn't get it to
work.
Thanks again.
Spencer
Terry Therneau wrote:
For 90 percent of what I do I strongly prefer the loose (S3) rather than the
rigid (S4) classes. So I'm closer to Rolf. My summary of S4 vs S3
A large increment in
1. nuisance to write
2. difficulty to debug
3. ability to write very obscure code
4. design
Gain
5. ability to direct automatic conversions
6. validate the contents of a class object
For simple objects 5 and 6 can be critical. Consider a date for instance,
which will often be turned into a character, added or subtracted as a numeric,
plotted, etc. Conversely, aspects of 1-4 are less worrisome for a simple
object, particularly #4: I have a reasonable chance of "getting it right" the
first time.
For a complex object such as the result of a coxph fit
fit <- coxph(Surv(time, status) ~ age + sex + treatment)
#5 makes no sense at all: as.numeric(fit)??? Number 4 and 6 are really hard;
after 15+ years of tuning I am still modifying the list of components in a coxph
object. I know more about the computational aspects of Cox models than almost
anyone and still it's not enough. Changes are harder with rigid classes.
With reference to #3 above, for your amusement, look at
www.netfunny.com/rhf/jokes/98/May/straustrup.html
the key line (to me) being "..every C++ programmer feels bound by some mystic
promise to use every damm element of the languange on every project..."
Terry T.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Spencer Graves, PE, PhD
President and Chief Operating Officer
Structure Inspection and Monitoring, Inc.
751 Emerson Ct.
San José, CA 95126
ph: 408-655-4567
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.