- 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
TRWTF is ColdFusion.
Admin
Cold Fusion Luke Warm DailyWTF
Admin
"With other bugs and priorities, and a system that generally worked, the initiative lost steam and was all but abandoned."
Ah, been there, done that, bought the t-shirt, then bought the business that makes the t-shirts and now I sell them to other people that visit...
Admin
see this already posted in a comment in February. http://thedailywtf.com/Comments/SQL-Sentences.aspx?pg=2
I see dead reposts.
Admin
So... the WTF is why they don't rip out the conditionals when they encounter them? Or replace the else clauses with something that spits out an error message?
Admin
Just don't turn off stored procedures.
Admin
Admin
The mistake was to treat changing the code as a big project, which therefore could be canceled. Better to refactor: a sequence of small steps in which each step given an improvement, however small. The duplication step was a big change that gave no immediate benefit. They would have been better to have tackled one query at a a time, changing that one query to used a stored procedure, before moving on to the next.
Admin
TRWTF is select *
Admin
Yep, because now you've got THREE places to introduce bugs...
The original query... The copy/pasted duplicate query that is one day to be replaced... The stored procedure, for the small fraction of situations that have them.
Admin
Awww I guess they missed that chapter of the Progmatic Programmer book that talks about the DRY principle... wah-wah.
On a side note I had to deal with a system 10x more retarded. Basically it was a Java application which ran jobs which called Oracle Stored Procedures. Now for regular SQL queries there was a table of SQL queries OR a static class which has a bunch of SQL queries. Now some genious decided that the static class is too inefficient and decided to put all those queries into the database...
Wait for it... Wait for it...
To execute a SQL query, you had to execute a SQL query to get a SQL query to execute, then execute the SQL query obtained to get the results, often the SQL query obtained called a stored procedure.
GOOOOO maintainability... On that note most developers could not follow the convoluted path of figuring out where the hell was the SQL query stored (there was at least 10 places completely random) that it was actually easier to put SQL queries hard coded into Struts Action Classes than actually follow the system. No not easier to code, easier to maintain.
As you would guess, the turnover of the company was 6 months.
Admin
Ahh, the dark side of the code.
Err, false side.
Admin
select *
Straight out of the "Build a web app in 5 minutes" booklet.
Admin
Admin
Aside from the obvious condtional WTF, there exist some other core WTFery going on here:
--The Dan
Admin
I've watched this happen several times during my eight years at the same company. And we who remain are left to try to clean up the mess.
Admin
If your mess looks like this one, you should step yourself up to championing it, it needs done already!
Admin
Huge WTF here: 'To avoid breaking existing functionality, all of the original code was left in. If a stored procedure existed to handle an existing query, they'd have a configurable switch to toggle stored procedures or hard-coded SQL. Someone created and ran a script to duplicate the queries for this change:'
Why not just create a flag in the production coldfusion script that writes out which hard coded queries are still being run into a log file? Then replace the active ones and remove duplicates and inactive ones.Good ole pragamatic programmers(those who've read the book) would call this the tracer bullet technique. Oh well glad I don't have to maintain that crap.
Admin
TRWTF is that they were using stored procedures for simple select's.
Admin
This is a classic example of a good idea gone horribly wrong because they didn't think it through.
Good idea: Realizing that your existing solution doesn't scale well.
Really good idea: understanding that small, incremental changes are better than taking the whole thing offline and messing with hundreds of queries at once.
Ridiculously bad idea: Introducing this whole switching mechanism. Seriously, WTF. Why didn't they just, I don't know, replace the existing queries with stored procs as they were written? Isn't that the best way to preserve backwards compatibility?
Ugh. Anyway, I think the best solution was already mentioned, but it might have been a comment the first time this guy was posted a few months ago. Just renamed the boolean "storedProcs" to "shouldWork" and you're all set.
Admin
A couple of weeks later the subject will come up again and we'll agree that in order to get rid of it we have to have a plan and someone has to take ownership. And we'll all slough it off on George, the guy who handles everything because A) he's so good at it and B) he never learned how to say "no". So George will spend the next two or three weeks getting rid of the remains of the initiative, and once again birds will sing and sun will shine and flowers will bloom, until another manager's pet comes up with another bad idea.
Admin
Cold Fusion? It's the biggest WTF itself!
It's probably used only in America, I've never seen it in Europe in production.
Admin
But wtf do I know, I'm a high school dropout.
Admin
Admin
.NET is portable too... You can run it on Windows 2003 and Windows 2008. That's of course if you don't use the core edition. You can also run it on Vista. .NET is super cross platform. I mean you can run it in MONO!!!
Admin
You guys are both retarded. They should've used RoR. RoR magically writes the queries for you, so you don't have anything to worry about.
Admin
I think TRWTF is that a woman coder is the basis of this story.
P.S. Hey Lindsay L do you live in the Chicago area? ;)
Admin
I'm not your guy, friend!
Admin
He's not your friend, buddy!
Admin
I'm all for portability (in fact, I try to strive for it) but how often do you really care about portability for a web app? It runs on your server and that's it. You control what gets loaded on your server.
Besides, if you really want portability, why not use PHP? Yes, lots of WTFs can be written in PHP but if you aren't a moron, you can avoid those pitfalls.
Admin
I'm not your buddy, guy!
Admin
Oh who cares? If your tables are normalized in the first place, select * shouldn't be a big deal. If you need 8 out of 10 columns, it is just a waste of time typing each one out in the select query.
Admin
You might want to be portable in case, I dunno - MS decides to charge you out the wazoo for licensing and you decide to switch from Windows and MS SQL to Linux and MySQL. MySQL does have a conversion utility, but you still have to do a lot of manual work, and my guess is that you'll have to modify quite a lot of code to run well under Mono.
PHP is cross platform, but I wouldn't be caught dead running it on windows. It's insecure enough on Linux on which it comes preinstalled most of the time. Why would you ever run it on windows?
Admin
Wow. You just described a typical meeting of the board of directors of the non-profit organization that I volunteer with. Nice to know that it's not confined to IT.
Except, apparently my name is George... sigh.
Admin
Oh, I don't know, maybe you have some text columns in there? That would cause some issues.
Also I don't think CF deals with with select * when you add and modify the columns and the connection pooling is on. Something about caching the schema in the driver..
Admin
Like Good, PHP can never win, because PHP is dumb.
Seriously, PHP is just a braindead, boring language with a hacked together object system and a flat, inconsistent function namespace that would baby Jesus cry. What's particularly funny about PHP is that in in many PHP frameworks, they've invented a templating language: Smarty. PHP is a templating language. Apparently even programmers don't think PHP is good enough to do what it was designed to for. A templating language written in a templating language, WTF?
Admin
I don't see what the huge difference between running PHP/Apache on Windows and running it on Unix is (except for the glaring obvious differences are with the platforms).
Running PHP on IIS... well I've done it, yes, but you're right, I wouldn't recommend it. Just get Apache going (takes like 5 minutes or less) and use that.
As for converting between MS SQL and MySQL - I've done it. It's not THAT hard.
The main point is, portability is usually less important with web apps. And if you start them out correctly, it's a non-issue anyway.
Admin
Isn't this story a dupe? I clearly remember reading this exact one before a couple months back.
Admin
Arg, not another PHP flame war! :)
Actually, I mostly agree with you. PHP isn't suitable as a templating language. I don't think calling it that is exactly correct though. I think it's fine to use as a back-end but using it for display logic (which is how it's used a lot of the time) can end up being pretty bad.
PHP has a lot of weaknesses but I'd rather use something lightweight and fast than all of the bloated, slow frameworks that are floating around out there.
Admin
He's not your guy, friend!
CAPTCHA: plaga (-rism?)
Admin
MySQL seems to be a wtf in itself. They STILL don't support functions as defaults for the tables. WTF. That's like the most retarded thing I've ever heard. How hard is it to implement that? All other RDBMs do it. It was requested at least 3 years ago.
Wish PostgreSQL had a conversion utility from MS SQL. Anyone know of one?
Admin
From the same post you linked to:
Obviously, Licky Lindsay (the original poster) decided to follow the advice given. What's the problem?
Admin
I've seen a lot of places where there is new functionality, or alternate functionality, introduced, but the old is kept around "just in case". Universally, there is some switch to go back to using the old code.
Problems this causes: *Some parts of the application are using one version, some use the other version. hence, two versions to maintain simultaneously. *If nobody uses the old version, it sits there and rots. It gets in the way of maintaining working code, and makes people unsure about what is used and what isn't. *The worst part: Sometimes, for complicated business or political reasons, the new code wasn't turned on. The test plan was usually something like "make sure the inactive functionality doesn't change the active functionality" and it was moved into production. The drawback of this is that the actual functionality from the turned on state is never tested, and then it sits there for a year or so while changes in the rest of code base break it because nobody could test their changes against the functionality.
Admin
Except, when you get rid of the application, the one user that actually benifitted from the program's alpha/beta version steps up and said, "Why did this stop working?! Holy hell! I can't get any work done!?" At least that's what always happens to me.
I've inherited a handful of applications from a dude who spent his entire tenure at our company putting three medium sized applications together. (Thankfully, only two made it to production.) And by putting them together, I mean he actually placed them in the same application.
He originally programmed in java, moved to asp, but kept writing everything in javascript (<%@language=JScript%>), then moved to C#, but never figured out the page life-cycle/viewstate, and then moved to VB.NET. And somehow all are duct-taped together in one big application. It's actually pretty amazing. The "helpers" folders for the java applications alone is a sight to behold (zztSQLConnection, zvtASQLConnection, zztDBConnection, etc). It calls Web services, windows services, digs hap-hazardly through active directory, and at one point he tried to put it into sharepoint. Thank god he didn't make it. He has layers upon layers of abstraction that do nothing but call another method in another class in a single line; sometimes you have to go through ten layers of a single line calling another method to figure out what one call does. And a handful of people still use the programs so getting rid of them is out of the question. Guess who has to maintain them. Well, most of the time I do, but he's actually made money from us by doing contract work on his programs.
Hmm... that's not a bad idea.
Admin
Yep. An unskilled high school dropout who is a failure even as a script kiddie and likes to post annoying drivel while emulating a close copy of someone else's name. But never fear, russ0519/JimBastard/whoever else you're posting as today - we know who you are.
And for others: http://forums.thedailywtf.com/forums/t/8315.aspx?PageIndex=1
Also the one posting trying to pretend to be me (KenVV)and bstorer (pstorer). Loser.
BTW, you should know that russ0519 tries to get even with people who don't like his drivel; he tries to sign them up with spam sites. However, he's so stupid and untalented that he does it from his OWN job's IP address (vscript.com) - vscript has the distinction of being the designer of Eliot Spitzer's web site (badly) in CF.
Admin
BTW not everyone here works from their mother's appartment, KenW.
Admin
And what happens when you have SELECT * all over your codebase, and over the next year your needs grow and your 10 column table is now 100 columns (a dozen of which are text or large varchar), but you're still only needing the 8?
Being lazy now because "it is just a waste of time typing each one out in the select query" almost always ends up costing you in the long haul, whether it's by choking bandwidth pulling the extra data across your network or by taking up a lot of your time going back and fixing what you should have done right in the first place. Being lazy like that means you're not doing a good job.
Admin
Awww. I wasn't going to tell anyone your secret, but you've let it slip. I guess it won't hurt now to tell everyone you share her bed as well, will it?
Admin
Boy, you just insist on letting people here know what a lack of skills you have, don't you?
PHP is not a "templating language". It's a scripting language. They're not the same thing.
If you have no clue what you're talking about (as is the case in both posts you've contributed to this thread so far), at least don't embarrass yourself by posting and letting everyone see your ignorance.
Of course, I suppose VB is your idea of a powerful language, right?
Admin
I used to wonder if people like you posted idiotic comments on here to be funny or whether they truly are idiots. Considering the amount of WTFuckery I've seen, I'm now inclined to think you are genuinely an idiot. "SELECT *" is stupid. What happens when someone modifies the schema and inserts a column between the existing ones? Something like "ALTER TABLE foo ADD COLUMN bar INTEGER AFTER COLUMN baz"?