This is a real life story, and it actually got my immediate manager fired (of course this is only part of the reason why she got fired.)

We had a project to replace our entire merchandising system, which is currently running on IBM mainframe. According to the original project plan, it is supposed to be in production already, but it is not, and will not until next Sep. Luckily I was not part of the team. The project is not in Perl, so this is OT. But the lesson it taught is across languages, so I think just share.

Although the system will only be used by internal users, the team decided to make it a web application. That's cool, and I guess that's one of trend going on today.

The code is OO, and as a general principle, the team decided that all the database queries should be wrapped in DAO's (Data Access Object). So to the rest of the system, no code accesses database directly, instead, only accesses database through DAO's. This is still cool, and is still on the right track.

Then the next idea brought the whole design to a level of insanity I had never heard of before, actually even never ever had the slightest thought of. Unfortunately because it was proposed by a senior designer, and backed up by the manager, it got passed the design review, and even had everything implemented. The reusability of those DAO classes seemed to be so important to that designer, and through his past experience, he realized that all the SQL queries were different, thus the DAO's used to wrap them were not reusable. In order to have a quantum leap of reusability, he made a design rule to his team: there shall be no joins in SQL queries, and the join shall be handled in (programmer's own) code. Now instead of having a big number of DAO's for all SQL queries, they only needed to create one DAO for each table to wrap a single dynamic query. The query accepts a string parameter that will be used as where clause, and returns a result set that holds all columns of the table. Now the reusability is largely increased, as there would be only one DAO for each table, and it is reused whenever you need data from that table.

What a brilliant idea! What a stupid crime committed under the beautiful cover of reusability.

It was until the point they started to system test what they created, the team suddenly discovered a nightmare that could never be waken up:

Everyone likes reusability, and it is right and beautiful, but just like any other wonderful things, if you over do it, you kill all of its good purposes, and create evil.

You don't believe this story? me either, it just sounds so unreal, and I really wish it had never happened.


In reply to The crime under reusability by pg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.