Corporate meetings about how new government regulations are impacting the business aren't the most interesting meetings. The intersection of corporate responsibility and politics is as exciting as watching a pumpkin rot. Derek tuned most of the meeting out, but got the important takeaway: "Due to new government regulations, we will have to massively overhaul our flagship products."
The same year that Google was founded, the Federal government was trying to figure out this whole Interwebs thing. They passed the Child Online Privacy Protection Act, and among its many "think of the children!" provisions, there were rules governing what sort of data web service providers could collect from minors without written parental consent. Derek's company made a set of Java-powered applications designed to let schools run websites that let students do homework online, which meant they needed to be COPPA compliant.
It was a big project, and Derek was assigned to the COPPA compliance team. That team lived outside of the core development teams and had the sole purpose of modifying the applications to comply with the more restrictive data gathering requirements. Most of the time, this was as simple as removing a few fields or making them optional.
After plucking a few of the low hanging fruits, Derek moved on to the flagship application, SCORE. Like he had in the past, he flipped a few constraints to make fields optional, and fired up the application.
ORA-01400: cannot insert NULL into ("TBL_STUD_NAMELIST_003"."STR_LAST_NME")
Ah, the last name field had a database constraint. "No problem," Derek said. He picked up the phone and called Steve, head of the core development team. They owned the database and were responsible for maintaining it. Derek explained the issue and asked that the constraint be removed.
"No," Steve replied.
"What do you mean, 'no'?" Derek asked.
Steve sighed. Speaking very slowly, he explained: "Look, people have names, right? And we collect their name. And their name has a last-name part. So if we want to have names, we need their last names. So last names are required."
Derek stared at the phone handset in silence while his brain tried to follow the path of that tortured logic. After a long moment, he decided that path lead into a deep, dark forest where he would be eaten by wolves. Instead, he went on the offensive. "According to new Federal regulations, we can't require that information. We need to make it optional."
"We can't make their names optional."
"Right, but we can just require their first name," Derek said.
"We need their name," Steve replied.
"Right- their first name."
"No," Steve countered. "They have an entire name. They must give us that name. It's required."
The verbal tennis continued for more volleys than was healthy. The score when Derek gave up was less "Love-Love" and more "Hate-Hate". Derek escalated it up to his manager, who played a few matches of his own with Steve. Eventually, his manager dropped a deuce, threw his hands in the air and told Derek, "Just figure something out."
Derek thought about some work arounds. He also considered the fact that the database would sort the ANSI NULLs to the top of the results, and he really wanted them at the bottom. So he decided to wrap a pair of functions around the read/write steps. On write, if the field were null, it would save "ZZZZZZZZZZ" to the database. On read, it would replace all instances of "ZZZZZZZZZZ" with nothing at all.
Derek named the abomination "Zliminator", documented the change and closed the ticket. The core development team never read the documentation, of course, and they only used test data that contained last names- after all, the field was required! So they never noticed when they failed to wrap the "Zliminator" around a database get.
The result was hundreds of students turning in assignments as "Timmy ZZZZZZZZZZ". Their customers thought this was an excellent feature- if Derek's employer wanted to lose their business. Things quickly got political, and Derek received an angry phone call from Steve.
"You broke the code, you need to fix the damn code."
Derek contemplated the unsavory task of hunting down every database query that touched the last name field each time the core team failed to add the Zliminator to the call. "You want me to fix the last name bug? Any constraints on how I do it?"
"Constraints? Yeah, fix it, and don't break anything else!" Steve hung up.
With such generous constraints, Derek had a solution. He wrote a one-line script that ALTER TABLEd the database and made the last name field optional. He then sent it over to the team responsible for the installer, and told them that it needed to be executed as part of the install process. He then removed all references to Zliminator and called it a day. Steve's team got to keep their constraint, and the customers didn't.