archives
The evils of organically grown code...
Submitted by phrax on Fri, 2005-02-11 09:42. Wonky CodeThanks to Tit Petric for sending in this WTF. He's a courageous guy for submitting this because he wrote it himself. This code uses session variables to keep the last used menu item open when the user navigates to a page that isn't on the menu.
While not apparent, this WTF is a good example of what happens to code that grows to fulfill requirements that were not part of the original design. The original code was written to handle a single tier menu system. Then it grew to handle 2-tiers, 3-tiers, 4-tiers, etc. Right now the production code is sitting at 5-tiers *shudder*.