YAN perfect illustration of the benefits of polymorphism...
Bryce doesn't understand (surprise, surprise!) what Peter is talking about:
>> How would you cope with a contacts table that has to store data from international people? <<
Why is that a concern related to the issues presented?
Because the American formatting rules you put there would reject a perfectly legitimate British post code, you numbskull.
I am not sure British "post codes" are the same thing as a zip-code anyhow.
A "zip code" (let's keep the quotes where they're needed) is EXACTLY the same as what the British (and every other civilised country) calls a 'post code', fuckwit. Only in Amerika it needs, apparently, to have a flash-bang name as if it were a toy for five-year-olds.
Perhaps either make a new field for them, or key the post-codes into the general address textbox.
Whoopee, what a great idea! And then we add one column for every bloody country in the world that has different-format postal codes, and fuck up our application logic with selecting *different columns* depending on the value of the Country column!
Even for *you*, that's AWESOMELY FUCKING BRILLIANT, Bryce!
If 98 percent of all contacts in the DB are U.S., then making special fields or formatting/validation for foreign addresses may not be worth the effort. As long as there is sufficient room to type them in when they do come up.
A) And if NOT "98 percent of all contacts in the DB are U.S."?
B) So what's that "validation" _do_, then... If you can just "type them in when they do come up", with no regard to it?!?
Fuck, you're being even more stupid than usual, today...
Making a truely international contact manager with full validation is an entire topic in itself. (I suggest you fork off a new discussion if you want to delve into that).
Let's finish this validation thing *without* any unwarranted assumptions about "98 percent of all contacts in the DB are U.S." first, shall we...? No trying to gallop off into the sunset on fuck-knows-what tangents that come into your, let's be charitable and call it, mind.
So how did you just "type them in when they do come up", again?
And can we have some example code to see how you handle writing adress labels from a database table with ~150 coulmns to choose the postal code from?
Fix basics like that, before you go whining for repositories and other such stuff -- until you do, those are obviously way over your head.
oop.ismad.com
Not half as mad as you, mr Hatter.