Tim Ruppert wrote: > Everybody's got their own style dude - I could find you 10 articles that > will flip it. Besides - there are no absolutes in this world, so I'll > refrain from spending my day trying to prove that the instance that you > were referring to IS a bad practice. > > When writing object oriented code I also think it's generally a "bad" > practice to just use Object, but instead tend to not use that catch all > as the way I write my code - but hey that's just me. I think better > thought thru designs yield cleaner interfaces that doing things like > "instanceof" and setting everything to object. > > Just my two cents - feel free to drop them on the floor (face up) for > the next lucky person walking by :)
You said "instance of is bad practice." That means you think it is wrong in almost all situations. And that is what I was commenting about. Using Object for types is a side-effect of ofbiz's tendency to use Maps for tons of things. So we *have* to do this kind of run-time object testing. Using Object is also useful when you want to support graceful upgrades of a low-level object to some higher level. Like auto-converting String to a Number.
