0

Hey guys, i'm having some trouble with this:

In the object "consumer" i need to do a validation for the property Nit.

But i don't know where to put this validation.
Do i have to put it where i set the value,
In a public function to validate the content before setting the value,
or a method inside the object "validateNit"

I'm still learning and i have that doubt.

Ty so much for your help, and sorry about the crappy English.

3
  • 2
    What programming language are you talking about? Commented Feb 6, 2011 at 19:02
  • 2
    Is there a specific language this pertains to? Also, could you maybe use fewer line breaks? The formatting of your question seems more appropriate for a haiku. ;-P Commented Feb 6, 2011 at 19:04
  • Yeah sry, im programming on C#, and sry but i dont know how to structure the question in english. i see a joke about "how many programmer do you need for changing a light bulb"... so i think the best choice is to make the method validateNit Commented Feb 6, 2011 at 19:13

1 Answer 1

1

if the property is set just once on initialization, then validate it during object initialization, with a method validateNit. if it can be set/modified at any time with, say, a setNit(newNit) method, you can call validateNit() from setNit().

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.