- 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
(comment*)(42/42-1);
Admin
I used to work with a bloke who used to post entire swathes of html directly into SQL to be retrieved as objects and blarted out onto the screen as is. His excuse? Because implementing it (properly) by making the required amendments to the application code would take too long (QA process, y'see).
This problem was compounded by the fact that the new project manager for the application itself had added a whole layer of Procedure onto making amendments in the aforementioned application which effectively made quick and efficient throughput from spec to release impossible. By the time I'd left for pastures new, the process had practically ground to a halt (the backlog of changes to be QA'ed had grown to 8 months long, and the QA instructions had grown to a many-many-many-page document (exactly how many nobody knows, because we were never going to print it out, it all existed on an intranet), and the friendly in-house QA person who I had a wonderful working relationship with had been replaced by an offshore team who did not know the application and so needed a whole nother layer of how-to documentation to test the most straightforward things.
But as I say, I left that company, leaving the whole soggy mess for some other poor schmuck to salvage.
Admin
This is the Work of a True Fullstack developer
Admin
As LBT says: So much of apparently illogical design decisions frequently aren't. Once you include the dev/IT shop process dynamics as part of the code's actual requirements.
Over the last 20 years we've realized that in addition to solving the specific business problem, whatever it may be, our app stacks need to provide all the "ilities". IOW ilities are also requirements, however implicit they may be in the requirements docs, use cases, feature lists, etc.
LBT's story, and perhaps the WTF du jour just exposes the next layer of "ility" which I call producability: you have to get your result through the bureaucracy and into production. Often utterly despite the official (and semiofficial) processes.
It may result in code smell, but it's actually the result of doing inventive work in a smelled-up factory. It's a business smell permeating into the tech.
Learning to recognize business smell at the interview and running for the door immediately is, in my experience, THE key skill for lasting career happiness.
Admin
Well... at least the HTML wasn't stored in CLOBs. Makes it much easier to search the code before you drop the table.
I hope this thing single-threaded. If it's not, then I'd hate to see what the pages look like with so many threads inserting HTML code (and deleting the table!) at the same time.
Admin
Ancient Chinese saying: When all you have is a three-headed hammer, everything looks like three nails.
Admin
Yes, nail on the head.
I'm pretty sure I've done things like this over the years, and similar inner platformy abominations. You work with the tools you have, and the process forced on you and the requirements you never got given in the full knowledge that failure to deliver will be firmly planted on you, no matter what bureaucratic ass-covering you try.
Leaving aside the fundamental wrongness of the approach, no-one said it didn't work, it looks to be logically laid out and clearly written so I wouldn't leap to judgement. The WTF is the project manager adding layers of a different approach ... either stick with the paradigm or get that legacy bit frozen or rewritten.
"Learning to recognize business smell at the interview and running for the door immediately is, in my experience, THE key skill for lasting career happiness." How I wish someone had said that to me twenty years ago, my career has been one swim through a sewage farm after another. It's become a specialism.
Admin
Well, we used to have CGI-(ish) programs written in Oracle PL/SQL, executed by mod_plsql. As far as I know, it has been discontinued, so maybe it was not so good idea.
Admin
@MiserableOldGit : I too am old. And it took me about 20 years to learn / discover / distill that lesson. So I too was a slow learner. Good luck getting out of the sewage farm and into a much nicer swamp someplace. It can be done.
Admin
In reply to MiserableOldGit and WTFGuy:
Yes, the old "necessity" issue. I can't count the number of times I knew I was "doing the wrong thing" but, it just had to be done. I remember considering something I wrote to be cringe-worthy:
ReportHeader() && ReportBody() && ReportFooter();
Not that exactly, mind you, I'm going by rough recollection. Why that abomination? It was an a computer that had a whopping 64K of memory. I didn't really have a lot of space to make elegant breaks out of a cancellation inside a function. This thing used function pointers so much it actually had me worried as I put it together. But I did one thing I don't regret: I documented the heck out of every little hack I put in it.
Now I'm remaking software that began life as old-school BASIC. The use of 1-character or character+digit was understandable; I can forgive that. What I can't forgive is the utter lack of documentation.
Admin
Yes, it looks like it could be related to Conway's Law. Either the code reflects the official development process or the official development process doesn't work and the result reflects the unofficial development process that sprang up in its place.
Admin
"What I can't forgive is the utter lack of documentation."
Back in the day, comments took up part of the 64K memory space, and sometimes forced the program to JMP past the comment, slowing things down.
Admin
I don't know because I'm not old, but surely the Compiler would have an option to remove comments?
Admin
"Learning to recognize business smell at the interview and running for the door immediately is, in my experience, THE key skill for lasting career happiness."
In my defence, when I joined that company, there really was no immediate business smell. But they left metaphorical perishables out in the figurative sun and they went off.
Admin
The real WTF is that this was done in SQL Server! Probably with IIS and ASP behind.
FYI:
"#TABLE" is a local temporary table in SQL server, see https://stackoverflow.com/a/2921091
Admin
And for a modern full-stack done with PostgreSQL (no static files): https://github.com/aquametalabs/aquameta
Admin
Some professional products work more or less like this - check out Oracle APEX, which effectively uses PL/SQL to generate HTML dynamically. Here's the kicker - it actually works exceptionally well!
Admin
I dunno. I did a fair amount of interviewing, followed by a fair amount of contracting, before I finally got the job I stuck with. Every business had smells. I stuck with the job that let me fix things.
I admit, it's kind of a race and a struggle. 20 years in, most code reviews feel like a question of how much of a battle do I want to have right now, versus cleaning it up later. My own code is probably the worst - it's rare I get a sanity code review more comprehensive than "needs documentation." Most of the time it feels like a rubber stamp, especially after the fact when the next change is due and everybody says, "Some Ed needs to handle that, I don't understand that code." And then when I get in there, and find code warts the likes of which I'd tried really hard to eliminate, but I find there's still some there. At least in tonight's case, I can look at the code that came before this, and yeah, that was much worse, but there's still this funk.
But at least I don't have raw HTML in my database, I don't have FILE_NOT_FOUND in my booleans, and none of our try catch throw blocks have my name as author, and the only ones that ever got my blessing still return the full stack trace with the original code, they just sort of have this extra blurb of local variable dump in the middle somewhere.