Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclass final class (Boolean) ?



There are hundreds of reasons to extend String.  Maybe you want strings to be able to archive in a special way?  Maybe you need them to be initialized from a special type?

Yes, in those cases, you could use a static helper function.  Inelegant, but functional.

More importantly, there are often times when the instance implementation and the static class methods must be implemented in the same class.  This is the case that I had that originally started this thread.  The problem was, an existing tool took 3 parameters:

1)  The class name of the instance you want to use to represent something in a database
2)  The method ON THAT CLASS that generates the representation you want for the database storage
3)  The static method ON THAT CLASS that can be used to initialize a new instance from database storage

There is no way to make this work without subclassing - and that is why I don't like 'final'.

Everyone - please - there are language capabilities that are good and bad depending on how you use them.  There are functions people may not understand or need, while others might.  I was complaining about 'final' in the midst of trying to accomplish something, not to start a debate.

Ken

On Aug 30, 2006, at 3:57 AM, Marcin Lukasiak wrote:

I'm saying about your design - you can always use composition instead of

inheritance in your design, when class is marked as final.

Still I don't see resonable case when I would like to extend String

especially because it is immutable so what is the real need that you would

like to extend it?


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/email@hidden

This email sent to email@hidden

References: 
 >RE: Subclass final class (Boolean) ? (From: "Marcin Lukasiak" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.