- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
But, if you DO want an explanation, the Lyons book does a pretty adequate job of doing it.
Admin
In my experience, coders that create this type of code never stay in one place for too long, so they're usually gone when the code is discovered. I've seen this is plenty of code, but only code that I've inherited and haven't met the coder.
Admin
So, if someone says "I had my reasons.", the response should be "And they are?".
In my years of programming, writing lucid comments is something that should be encouraged. Maybe a good metric for a programming job should be "words of comments". Unfortunately this can be "cur and paste" abused, but if you can read them, comments can give a vital understanding to the original authors state of mind.
Admin
// they took my stapler, I'm going to burn the place down if ($m == '') $m = 'LLLLSSSSSSSSLLLLLLLL';
Admin
"I Had My Reasons" isn't very helpful, but it seems apparent that this guy was originally coding to some obscure requirement that the replacement implementation doesn't conform to.
The fact that there's no record anywhere else of why that feature existed, is evidence of problems that go way farther than just that one guy.
Admin
Let me guess: the string specifies how the results should be laid out on screen. One row of four "Large" entries (or maybe two rows, if there are only two items per row), followed by one row of eight "Small" entries, followed by two other Large rows. The dataset comes ordered by size from the database, and the loop basically picks from the end of the resultset for the large slots and the beginning for the small slots.
Admin
Admin
Admin
Once PHP is processed into bytecode, there are no variable names... and you do cache your bytecode, right? Same with most compiled languages; as an added bonus, when you strip the symbols from your production binaries you can fit a lot more binary in the same ROM space.
Admin
Eric: "Look, I have my reasons." Kitty: [agitated] "What could they be? What could they possibly be?"
Admin
Admin
Actually I've seen people doing less cryptic version of this so the autosort function of grid works as what the user expected. (Hint: Some grid does not support multiple sort fields)
Yes, there could be a reason, even if the coder refuse to tell you.
Admin
So it is written in Brainfuck then.
Admin
"I Had My Reasons" on the other hand is just another way of saying "I know this is crap but I can't think of a good enough excuse to save face".
Admin
Sure... but PHP still sucks.
Admin
To quote Terry Jones, there's a mess all right, but no messiah!
CAPTCHA: genitus, as in "Dominus filius unigenitus". Seems quite appropriate.
Admin
Wet season and dry season is in Mumbai only, you idiot! Read up on India. I am in Hyderabad. We download source code of the Spring framework and extend it.
Admin
Admin
I'm not very familiar with PHP. Does the replacement code really do exactly the same thing as the original code in one line as opposed to 20, or is the disagreement simply about whether or not the query result should be re-ordered before being displayed?
Admin
Actually I think the story is like this:
The web uses order number in 4 digit "vendor/location code" + yyyyMMdd + sequence number format. There is a grid that will display orders, possibly don't have datetime in the columns if that's considered "detail".
Some random users said they prefer to display things ordered by date, so the "order number" appeared as handy choice and the coder write some code to swap the date part to the front. Case closed.
Then some years later the coder is fired because he care not to explain this, and the grid now returns to the original sorting order.
Nothing critical to the users, just visible.
Admin
I read LOC as Libraries of Congress. Maybe it's not as bad as I assumed.
Admin
Admin
Don't forget Nathan Fletcher, too!
Admin
"I've been using Word "