netsql wrote the following on 7/11/2005 3:25 PM:
Rick Reumann wrote:
How does a developer working on your
code know how to even get the properties out of your Map? I guess he
has to look at some API contract saying put date of birth in the Map
as "dob" not "dateOfBirth."
As in iBatis, name of the map property is in my case the field name in
the table, and I do not have to map it, it compes that way.
But my point is users using your API, how do they know what they are
getting back? They have to look at a database model in order to figure
out how to get back a dateOfBirth field? That's crazy imo. Someone is
coding and they call List employees = mapHappyVic.getEmpoyees(); Now
they want to iterate over this list and display some properties. Tell me
how they figure out what the fields are to pull from the Map? Using
regular POJOS and an IDE or even the java docs (for the vi users:)
they'll be able to figure out what to call, for your List of Maps of
employees they'll have to look up the database model.
Some people don't get dynamic langs yet... just like some people took a
long time to get OO. It's much less code.
Come on! what kind of comparison is that - comparing the use of Maps to
coming around to understanding OO? Anyway, use your Maps, I'm not saying
they are a poor choice in all cases, but I think it's an unwise decision
in most cases for model layer objects. I'm just glad I don't have to
work on projects where I have to go to the datamodel to figure out the
names of my properties to use as a key in order to get out a property
from a Map. Not only that, you have no type safety plus think of all the
stupid time wasted debugging because using that approach you'll no
compile time checks. I can type employee.getDOB() if it's
employee.getDateOfBirth, but you certainly won't have a compilation
problem with employee.get("DOB") Also, think of the potential for bugs
to not creep up until odd times... what if you had...
if ( someCondition ) {
Integer age = (Integer)employee.get("DOB");
//other stuff
}
if DOB should be dateOfBirth you might not even find about the error
until "somceCondition" is met. On top of that, look at the other
situation, math operations.... How does the developer know what "type"
was used for the value? I can look at a bean and see...
Double price; but I have not idea what type of value
shippingOrder.get("price") is. The developer just has to guess or where
does he look? The datamodel? Some other docs? Pain in the butt if you
ask me. I swear using Maps will cost a lot of time in the long run. Sure
if only one person has to deal with the code, it 'might' be faster since
he might simply remember all the types etc, but what happens when the
code is inherited? Pity on that developer.
--
Rick
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]