- 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
This is not w WTF, it's pre-emptive revenge for an imminent firing.
$suite_23_1 = number_format($item -> {'suite_2_1_'.$the_currency}, 2, '.', ''); is used 99% of the time.
$suite_89_3 = number_format($item -> {'suite_2_2_'.$the_currency}, 2, '.', '') is used 1% of the time.
after firing the line suddenly reads: $suite_89_3 = number_format($item -> {'suite_2_2_'.$the_currency}, 2, ',', '')
Admin
TRWTF is money.
Admin
It's even worse, the object is retrieved form the database, so its attributes are columns in the database, and its even more worse when you see how the writing and the updating is done for these tables (yes there are a lot of tables with this design)...
Admin
Guessing this is a pricing application that duplicates exactly the old printed item lists with both annual volume discount levels (per customer) and quantity discount levels (per item per order.) Rather than calculating the price on the fly, and running the unacceptable risk of not matching the printed price sheets to the penny, this app simulates a clerk doing it the way it was done 150 years ago when people were nice and life was good.
Admin
Someone was paid by the line.
Admin
There might be good things to say about having a metric crapload of variables in a class, IFF your class, being part of an options package, constructs by serialization from some moral equivalent of a config file.
As being written, however, this (not being part of something similar) is garden variety crap, upon which I agree they should've bought some arrays.. Perhaps DarkHorse is right.
Admin
Not necessarily paid by the line. As the adage goes, never attribute to malice that which can be adequately explained by stupidity. I've had a huge numbers of intro-to-programming students over the years. Some paid attention and I'm sure went on to fine careers. Others were in a world of their own and never really learned. One student's assignment comes to mind: after a lecture about C's 'toupper()' he wrote a big switch statement whose case statements were lower case letters and the statement was the upper-case version. I'm sure he's out there programming still and botching everything.
Admin
"unacceptable risk of not matching the printed price sheets to the penny" I worked in a place where the software had to match the printed price sheets to the penny. Except the printed price sheets had errors so the software had to match the errors to the penny as well. Talk about your magic numbers....
Admin
Duh, it's a tool issue. It's not the developers' fault that PHP doesn't support -funroll-loops!
Admin
Those are suites/rooms prices for different hotels, the first digit is for the hotel, the second is the number of beds and third for the currency.
Admin
"It's definitely a limitation of the tool, not something the developers can control. PHP just doesn't have support for -funroll-loops!"
Admin
This is just a newb who doesn't understand arrays yet. TRWTF is that they had a job programming at this point in their development :/