This is just a rant. I am not going to mention the name of the software, ok?
So I was working on an open source project, trying to add a new feature to it. The software can display some questions in random order and allow user to enter answers. Say we have five questions, Question A to Question E, randomly shown and the user entered answers as such:
|What is being displayed on screen...|
|Question B||Answer B|
|Question E||Answer E|
|Question D||Answer D|
|Question C||Answer C|
|Question A||Answer A|
And here are the corresponding rows in database when user saved those answers:
|What is being stored on db...|
|1||Question A||Answer B|
|2||Question B||Answer E|
|3||Question C||Answer D|
|4||Question D||Answer C|
|5||Question E||Answer A|
Instead of using one row to store each question and answer pair, whoever wrote that code decided to utilize the "answer" column independently from other columns and store values in the order displayed on screen!!
They even included comments in the code:
# note that answers are stored in display order...
I mean... WTF!? How am I going to retrieve the data? Am I supposed to use the same random seed to see how questions are ordered on screen and match against the answers?
Post a Comment