On Jan 2, 2010, at 9:04 AM, Ricardo Aráoz wrote:

>>      I've worked for many clients who made claims like "we will never need 
>> more than one phone number per customer" or "part numbers will never be more 
>> than 4 places" 
> 
> That's why I'd never use the part number as a PK and use an auto 
> incremental instead. When my customer wants to use more than 4 places 
> and allow alphabetic characters in the part number (note I said "when" 
> and not "if" ;.) ) it will be easy enough to make the necessary changes.


        That was the exact situation I had with a customer, but it was an 
office supply company. I took over the system that used part numbers as PKs, 
and pointed out the problem, offering to switch to a surrogate key design. The 
client thought I was trying to create work to pad my hours, and confidently 
assured me that the 4-character part number would be all they would need. 

        I registered my concern but said I would respect his decision. I then 
spent the next few months building their system, adding all these features to 
enable their business to grow. Well, it did in fact grow, because within that 
first year, they bought out a competing company. Of course, when we tried to 
merge their operations together, the other company used 6-character part 
numbers. Had we switched to surrogate keys at the beginning, it would have been 
trivial to change a single column and a couple of display fields to fit. Now we 
had lots of SQL and other code that assumed equality that would be broken once 
we switched to 6 chars, since 'abcd' != 'abcde  '.

        It turned out to be several months worth of work to combine the 
systems, and instead of saying "I told you so", I merely mentioned to the 
client that step one of the process would be to switch to surrogate keys in the 
tables. This time I got no resistance.  ;-)


-- Ed Leafe



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to