Originally posted by Don Kiddick:
We wanted to factor out the common functionality. One way is to create one SimpleType class that can be used to represent all of these entities. However we are worried this will reduce the typesafety of our application. For instance it could be easy to pass in a list of regions to a method that required a list of status.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
How likely is that to happen? What would be the consequences?
Originally posted by Ilja Preuss:
Can you rely on other means than the compiler to reduce the likeliness of such problems - a good naming scheme, unit- or acceptance tests?
Originally posted by Don Kiddick:
The consequences would be that we would see strange behaviour in the gui. Saving one value, another value being populated in the db. These bugs would be quite hard to find.
We could. However typesafety is a good thing and something that makes a program more robust.
However from your response, I presume the is no easy way to do this without introducing lots of similar classes that vary only in the the fact that thy have different names.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
I don't yet fully follow you - how could a value being populated in the db you didn't save? Can you give a practical example, please?
To some small amount, yes. It also makes the code more verbose and often more complex and inflexible. There probably is a balance you need to find.
Originally posted by Don Kiddick:
Your issue object has a status and a region. Status and region are both the simple {id, description} objects I describe. By mixing these up in your save routine, you end up using the region id when you should be saving status id and vice-versa.
Does that make sense ?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by S Manch:
there is something called Generics in JAVA 1.5 that will help you do this...
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Regards,
Pho
Curse your sudden but inevitable betrayal! And this tiny ad too!
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
|