Re: Is this a violation of the EOF commandment?
Re: Is this a violation of the EOF commandment?
- Subject: Re: Is this a violation of the EOF commandment?
- From: Chuck Hill <email@hidden>
- Date: Fri, 13 Nov 2009 11:02:41 -0800
On Nov 13, 2009, at 10:29 AM, Pascal Robert wrote:
----- "Chuck Hill" <email@hidden> a écrit :
On Nov 13, 2009, at 7:30 AM, Pascal Robert wrote:
And I guess this is bad too?
Yes, using French in your code is very bad! :-P
Hé que t'es pas fin! :-P And it's not my code.
:-)
public void setRhoc_Desc(final String value) {
takeStoredValueForKey(Utilitaire.enleveCaractereWord(value),
ClefRhoc_Desc);
}
I see two things there:
1. Rhoc_Desc does not match ClefRhoc_Desc
2. Utilitaire.enleveCaractereWord(value)
I have no idea what (1) is. (2) is probably fine.
Ok, I should explain it in more detail,
Utilitaire.enleveCaractereWord() will mangle the value (it's a
method to cleanup some ISO-Latin-1 chars that Word uses),
ClefRhoc_Desc is the equivalent of a attribute key (eg, the name
that the standard veogen standard would have returned would have
been RHODDESC_KEY instead of ClefRhoc_Desc).
That is what I was expecting.
So the setter will probably change the value of the attribute
because of the call to Utilitaire.enleveCaractereWord(). Is this the
good place to do that?
I don't think that doing that in this place will get you in trouble as
EOF does not call this method to set snapshot values. I think.
However, I don't know that this is a "good" place to do this exact
cleaning. I try to restrict the EO methods to business logic (e.g.
alter other EO values to keep the state sane). To me, this seems more
like a UI level task best assigned to a formatter. I'd make a
formatter for this and use it in the UI to clean up text pasted from
Word.
Chuck
Yes, as long as you return the coerced value, not call set...
Making validate... change data is bad.
On Nov 12, 2009, at 3:32 PM, Travis Britt wrote:
validateValueForKey is safe for coercing user input tho right?
tb
On Nov 12, 2009, at 4:59 PM, David Avendasora wrote:
Nope. This is exactly where you should put this type of thing. If
you put this in the validation methods you'd be asking for
trouble.
Dave
On Nov 12, 2009, at 4:49 PM, Ricardo J. Parada wrote:
public void setCpt(String value) {
if (value != null) value = value.toUpperCase();
super.setCpt(value);
}
P.S. I'm using eo-gap generation pattern. So this class extends
the _ class generated by the _WonderEntity.java template.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
----
Pascal Robert
email@hidden
AIM: MacTICanada
Twitter : MacTICanada
LinkedIn : http://www.linkedin.com/in/macti
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
--
-------------------------------------------------------
Pascal Robert
http://www.macti.ca
http://www.linkedin.com/in/macti
Skype: MacTICanada
AIM/iChat : MacTICanada
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden