«« Next » « Previous
«« Next » « Previous

Link Details

Link 101580 thumbnail
User 189277 avatar

By trisa
via jroller.com
Submitted: Aug 06 2008 / 21:28

I lately had to implement instance comparison where the object type determines a part of the result. The classic approach would have been to implement comareTo() with different checks on the object type using instanceof. I usually like perfect OO style and that's why I thought about using the double dispatch pattern, avoid those instanceof checks and end up in a far more elegant implementation.
  • 1
  • 0
  • 156
  • 52

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (1)



Voters Against This Link (0)