- 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
set @tablestr='Frist'
Admin
I do see a pattern here.
Admin
What? SQL is an awesome language for web pages! WTF this site is implying?
also, SQL Server allows querys to output XML wich could be further processed by xsd, full MVC development model here.
Admin
I am kind of amazed/disgusted that we still rely on stored procs for anything other than large data aggregations that might need to do a bit of conditionals (e.g. for reports) in this day and age. With modern tools and ORMs (incl. micro-ORMs for those who like their SQL) there should never be a reason for stored procs anymore in most web applications (again, outside of maybe some large reports where you might need to do some calculations/checking).
Admin
Wait, HTML is XML is data, and aren't DATAbases designed to manipulate DATA?
This is an excellent example of using the right tool for the job!
What's wrong with that?
Admin
Well, at least the coder used CSS classes and not direct styles.
Admin
The real WTF is Oracle.
That's kind of tangential to the article, but it's something I want to express anyway.
Admin
Admin
TRWTF is that the Oracle side of my office is still actively developing applications this way because the app server supports it and because it's Oracle, it must scale to infinite levels higher than anything us mere C# developers could produce. Databases aside, SQL or Oracle or any, unless this code is from the early 90's... when mullets were still cool... :)
Admin
I'm quite surprised that part of the HTML code wasn't stored in a specific table... or did I missed it?
Admin
And of course strings like "Statut actuel de votre commande:" have to come out of their own table as well. With an integer as message key and iso language codes, this would look like this:
set @tablestr = @tablestr + '' + SELECT str FROM tblStrings WHERE id = 42 and lang=fr + ''
Much better, don't you think?
Admin
What if the definition of HTML changes? You should put the tags in their own table.
set @tablestr = @tablestr + '<' + (SELECT MAX(openTag) FROM tags WHERE tagId=12) + 'nowrap ="nowrap" width = "' + SELECT px FROM tblWidths WHERE id = 180 + '" >' + SELECT str FROM tblStrings WHERE id = 42 and lang=fr + '<'+(SELECT MAX(closeTag) FROM tags WHERE tagId=12)+'>'
Now you're coding for the enterprise!
Admin
Cursors? This is clearly written by someone who doesn't know how to use tally tables...
Admin
Obviously. If you guys used Java, they wouldn't dare challenge your productivity, and life would be good.
But yeah, been there before, and just the memory of it makes my blood boil. No kind of stupidity or retarded company policy should ever justify these atrocities. They'll pay dearly down the road with unmaintanable applications, downtimes, mysterious crashes and whatnot... they will, no matter how their ignorance make them blissfully unaware at the time.
Peace treaty note: I know, C# is a good language (the only one in DotNet)
Captcha: appellatio ...yeah, I know, blame on me, sorry!
Admin
This seems to be an instance of the fairly common "it savvy boss" pattern: Mine tried to force me to port a core business (now 100KLOC) C# ASP.NET intranet web app I’ve written to T-SQL(!), as “Software done the right way is implemented in stored procedures!” Not even mentioning CLR stored procedures was allowed – the only argument that worked (and saved me from hell), was “I simply can’t.” His reply: “I see! You’re merely and simply a web programmer.”
He hired me as an C# developer, later I learnt that he hates OO (“I KNOW Smalltalk. OO is BAD!”, even later I learned why he hates OO: When problems arise and I’m telling him why, in an OO world I am speaking in terms of real world business entities and .aspx views of these he defined himself that way. This makes him angry. About those parts of the system he forced me to implement with triggers and stored procedures, I am speaking in terms of “triggers and stored procedures that somehow interact badly” – and this makes him happy and smile. “I LOVE stored procedures” is his objection when I’m begging to be allowed to refactor out some of them.
And yes, I’m finally looking for a new job.
Admin
Admin
Oh, that's just factually incorrect. F# is the best language in .NET.
Admin
Captcha: acsi - If you knew your ACSI character set better, you could tell me the octagon number for tab. (An IT guy who worked for one of our clients and naturally was smarter than all of us combined, kept referring to the column of "octagon" numbers on the ASCII character set chart.)
Admin
Your spelling of ASCII and misnaming of octal aside, it's actually easier to remember the octal numbers than the ASCII equivalents. The character set is nicely grouped for easy reference in octal... the dude is a bit of a dinosaur, but there's no real WTF in using octal for character references...
Captcha: augue. And that's the start of a new auguement.
Admin
Actually, I think Apex is a great tool for throwing together data entry forms quickly and easily. At my last job, I took over an 80 page Apex application from my predecessor who left before the application was released. The problem was not Apex; the problem was that my predecessor didn't use its higher-level tools, and instead wrote everything from scratch in JavaScript.
Admin
Also, I've often gotten flack for being anti-stored procedure, but this is mostly because I see it something unnecessary. SQL is not a real programming language (especially not T-SQL; PL/SQL is at least a bit better) and you can't solve problems as easily in SQL as you can with real programming. Yet far too often I meet data diddlers that only know SQL and try to shoehorn everything into SQL and the database. Whether it's conditional logic, a loop (i.e. cursor) or entire workflows, these people don't know anything other than writing stored procedures, triggers, and SQL batch jobs to handle what should be done using real code.
Don't get me wrong, stored procs have their place, as I stated earlier mostly big reports that need to aggregate a lot of different things, but 9 times out of 10 whenever I see a truckload of sprocs, it's because most of the team don't know anything other than SQL.
Admin
Admin
What a moronic mix of technologies. So you can generate a piece of shit web page written with ancient html that looks like the web design was done by a manager. Great idea Oracle and the idiots using this. Good luck upgrading to HTML 5.
Admin
I think we've both worked at the same place at some point. A line manager from days gone by used to love stuff like this. His excuse for putting business and presentation logic in stored procedures was "if we deploy at a clients, I don't have to recompile and redeploy the application, I can just edit the procedure in their productive system and we're good to go"
Fuck process, fuck QA, fuck integrity, fuck the client and fuck whoever gets the call to fix this, because it won't be documented.
Admin
Admin
Considering that calculations and business logic don't belong into a SP, then you're basically saying that they have no use whatsoever. Personally, I dislike much more the SQL generated by most ORM, which are often abused nowadays. ORM are not "the answer", they are just one solution like another, and not necessarily the best one.
In case you wonder, I don't "only know SQL", it's just one of the many tools I use every day. Also, I met many more Developers who have no clue about SQL (and, therefore, consider their language of choice like a golden hammer, going the RBAR way) than Developers who only know SQL.
Admin
The RealWTF here, as usual, is Microsoft ...
I was going to say the programmer in todays WTF should have used SqlXML and then an XSLT to generate the HTML, when it struck me like a million bolts of lightning. Microsoft should have developed SqlHTML long ago ... I mean, all the data thats stored in any database, will ultimately be displayed on a web page, right ? After all, the Internets and all that we hear about is big, and the language of Internets is HTML.
Microsoft, please add this urgently required feature to your database server ...
Admin
Same thing I think about ORM, quite often.
Sorry, but this is wrong. SQL is a functional programming language, designed to handle relational data. If used properly, it's much more powerful than an imperative language, in its own domain.
SQL is real code, you just seem to have difficulties accepting it. As for cursors, they are not needed. If one thinks that the only way to process some information is using cursors, then he should read "SQL for Dummies" before touching a database again.
In my experience, to maintain sanity, the rule of thumb is to keep all data integrity logic inside the database, and all business logic outside of it. No "IF", no cursors, no triggers (unless absolutely necessary, since they alter the execution logic on the fly and they are a nightmare to debug).
Then you have worked with poor teams, so far. I worked in many environments, and wrote personally hundreds of Stored Procedures and, yet, SQL is far from being the only thing I know.
On something we agree: Stored Procedures can be used properly, or improperly. In my opinion, the only issue is that you haven't seen them used properly too often.
Admin
Honestly the link at the end was the best, I literally (to my co workers surprise) laughed unfortunately loudly.
Admin
You don't really pick up on things like "sarcasm" and "scare quotes" very well, do you?
Admin
Wise man say "Do not make fun of tool, unless you come to know the tool."
Admin
Admin
Time for another can of spinach, Popeye. T-SQL is Microsoft's procedural database language.
Captcha: valetudo. (Valentino's sickly cousin, I guess.)
Admin
What ? A small product ? Are you insane ? It's from the front-end when you buy our products ! In a multi-million-euros company ! F43R !!!
Admin
Only in France!
Admin
Did you steal this from my old job? Oh wait, we weren't allowed to use stored procs anyway.
Admin
I don't mind using SQL for things like SUM(), since that's the database's strength. I also think that you should have all your data integrity checks (FKs, checks, triggers if necessary) as well as check them server-side in the app and client-side if necessary.
However, my whole career has pretty much just seen a reliance on stored procs for every bit of data access, and often not JUST data access (the aforementioned putting business logic or even entire workflows in SQL. I've even seen some sprocs that use the built-in way to do DOS commands to move files). I would infinitely prefer an ORM (most modern ones generate optimized SQL; I know NHibernate does) or a Micro-ORM (so you can still write your own SQL and just use the mapper part) over having to dig through a massive stored proc.
Admin
Admin
In SQL, you write code to get a computer to do something. If that's not a real programming language, then I'd like to know what you definition of one is.
Admin
Admin
Admin
MSIL is obviously the best one. The rest are just imitators.
Admin
But I can see how it happens. You know what they say, when your only tool is a hammer all problems look like thumbs.
Addendum (2013-04-23 12:29):
This. In my experience, stored procedures and triggers should only be used to enforce data rules, so that if someone tries to manually enter data instead of using the application, or blindly refactor the application without knowing what they're doing, they don't break anything. But the application itself should not be written entirely in stored procedures.But I can see how it happens. You know what they say, when your only tool is a hammer all problems look like thumbs.
Admin
TRWTF is that no-one complains about Visual Studio being slow/laggy/generally retarded with c# - VB.NET does not suffer this particular problem.
Admin
FTFY 0x71 != 071 (0x71 is 'q', 071 is '9')
Admin
The easiest form by far is JFGI.
Admin
This is silly and stupid!
Admin
Which problem? Being laggy? Maybe, because retarded VB.NET obviously is.
Admin
TRWTF is that they didn't use MongoDB, because obviously SQL Server isn't web scale.
Admin
This depressingly reminds me of my last job.