“It’s about control,” said Mr. Martinet. “We are a large organization- a Fortune 500 company- and large organizations cannot operate without strong controls.”
Luigi nodded. “I understand the need for checkpoints in such a large team.”
“Yes, well, you’re very smart- you wouldn’t be here if you weren’t. We hire only the smartest people we can, Luigi, but it doesn’t matter how smart people are if you don’t have control.”
“I understand,” Luigi repeated.
“Excellent. Then you understand why we can’t allow this database change to go through.” Mr. Martinet handed Luigi a change request form with “REJECTED” stamped on it in large, red letters.
For weeks, Luigi had been struggling with Mr. Martinet and his organization. In theory, the contract sounded like a good deal. They paid well, they extended benefits to contractors, and they claimed to focus on getting the best possible talent. Of course, they also had to wear suits, and a suspicious number of framed certificates hung from every office and cube wall.
On his first day, Luigi was handed a simple looking request. The sales team wanted to collect data from customers about those customers’ hobbies. There was a predefined list, but the sales beasts wanted to be able to manage the list of hobbies themselves.
Luigi spent the first few days getting an understanding of the company processes, the application, and the database. Once he understood the setup, and saw the database schema- well, he cringed. For all the “smart people”, it was an extremely dumb design. Luigi assumed it was a legacy mistake, so he planned to fix it as part of this change. He wrote and tested some scripts, made some changes in code, and built the RFC document. He submitted it through channels, and then waited for the requisite two week turnaround at the steering committee before the change was approved for testing.
Given the amount of time and effort that went into the change, the rejection shocked Luigi. “Why was this rejected?” Luigi asked.
“Our DBA doesn’t approve of your schema change. Control , Luigi. Control! He controls the database, and he’s an extremely smart person. He wouldn’t-”
“-be here if he wasn’t.”
Luigi had designed the new customer/hobby relationship to be a many-to-many relationship, mediated by a cross-reference table, the obvious solution to the problem. He simply wasn’t smart enough to understand the power of the DBA’s original solution.
The current database had a tbl_customer
table, and the tbl_customer
table had a field called int_hobbyId
. This was a foreign key over to tbl_hobbylist
, which looked like this:
int_id | str_hobbyies |
---|---|
1 | fishing |
2 | photography |
3 | dancing + photography |
4 | climbing |
5 | climbing + fishing + photography |
With this divinely inspired database schema as his guide, Luigi went to sit with the DBAs. Working together, they built the best possible solution. The list of hobbies for the customer form was moved to its own table, “tbl_hobbyListForDropDown”. When a sales beast or customer selected a new hobby for the customer, the web code would do a look-up in tbl_hobbylist
and append the newly chosen value to str_hobbyies
field.
“See?” the DBA said. “Now you don’t even need to add a foreign key!”
Image from The Network (1976)