Please join us at the new JavaWorld Q&A Forums. Your existing login will work there. The discussions here are now read-only.


JavaWorld Talkback >> 958783

Pages: 1
Anonymous
Unregistered




The really bad part ...
      #5357 - 01/18/04 11:19 AM

The really bad part is that you are taking a simple concept (field access) and putting a pile of junk around it. This adds unnecessary complexity and makes those who have to maintain your code after you are gone pull their hair out. Believe me I have seen this over and over again. Fools getting religion and writing "good" code that just makes everything more complicated, attempting to fix some problem we never had. All in the name of OO.

The problem/feature is inherent to Java. It's called strong typing. You can't solve it. You must live with it. When types change, use an IDE to change all the places that reference the old type, whether it's a field or use an accessor. That's all.

Yes, you can try to move all the operations to "Money" or where ever so that the types don't leak out but eventually, if "Money" is an API class, a client will need money as a base type in order to do some computation that you have not provided for them. At that point, you have the problem again. They can't add methods to your class.

The only interesting division in the world is API vs. non-API. If you need to provide data to the outside world, then you need to provide a type and nothing can save you from that.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:   

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 4625

Rate this topic

Jump to

Contact us JavaWorld

Powered by UBB.threads™ 6.5.5