ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clinton Begin" <clinton.be...@gmail.com>
Subject Re: How to make dao's / vo's more polymorphic
Date Tue, 14 Mar 2006 01:10:03 GMT
Fair enough, I agree.  You're argument is valid against Sun's design for
JavaBeans and the pattern matching approach of getters/setters -- and how
they are hardly a best OOP practice (I won't get into that OOP itself isn't
necessarily a best practice)....

However, your argument does nothing for or against the use of Maps vs.
classes as domain objects.  I will maintain that Maps are a horrible design
choice for a domain model -- horrible.

The solution to the challenges you present is not to use Maps, instead it is
to avoid the use of JavaBeans.  Unfortunately, at this time, that also means
no iBATIS (it's a JavaBeans based framework -- poo on us for listening to
Sun).

We're definitely adding support for both constructor injection and private
field based injection of data to address this issue.  But until that time,
you're better off with JavaBeans than you are with Maps -- for many, many
reasons.

Don't confuse (ab)using maps in Java, with the dynamic programming
capabilities of languages like JavaScript and Ruby.

Cheers,
Clinton



On 3/13/06, Ben Munat <bent@munat.com> wrote:
>
> Actually, I've long been annoyed with all our frameworks forcing me to
> expose all my
> domain objects' fields via setters and getters. I've toyed with the idea
> of doing all my
> selects as maps (and my input from the UI layer too) and giving the domain
> objects the
> smarts to pick what they need out of the map. Haven't gotten around to
> trying it though as
> I'm always on a team with other people and they think I'm crazy... the
> "bean" paradigm is
> very entrenched. However, I'd say that before you go waving around the
> "best practices"
> ray gun, consider that java beans are hardly best OOP practice.
>
> b
>
> Clinton Begin wrote:
> >
> > ...and by doing that lose all of the performance, type safety, context
> > and compatibility of a proper domain model.  While you're at it, why not
> > dispense with all other best practices as well.
> >
> > Cheers,  ;-)
> > Clinton
> >
> > On 3/13/06, *netsql* <netsql@roomity.com <mailto:netsql@roomity.com>>
> wrote:
> >
> >     You can do that and more including losly coupled by using a HashMap
> as
> >     return type (return ArrayList of Maps from iBatis ) like I do. No
> more
> >     out of sync beans.
> >
> >     .V
> >
> >     Paul Carr wrote:
> >      >
> >      >             Ideally I'd like all my DAO interfaces to extend a
> >     BaseDAO
> >      >             and all my
> >      >             value objects to extend a BaseValueObject
> >     automatically as
> >      >             abator
> >      >             creates them ???
> >      >
> >      >
> >
> >
>

Mime
View raw message