- 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
Spring forward -- Fall back fristly.
CAPTCHA sagaciter it takes a sagaciter to understand that code.
Admin
Job security - Obfuscate what you are doing so that you are the only person who can do it.
Admin
This probably evolved. There may well have been a highly evolved Spring application, from which this came, along the lines:
"Oy, Bodger, stick it in a temp database."
"Ooh aar, temp database? How do I do that?"
"Oh, just copy what they did on blah."
"Ooh aar, that be compickelated ..."
"Stop whining and just get on and do it!"
Admin
This has nothing to do with evolution.
Admin
Evolution means to develop over time. This isn't a biology class.
Admin
<pedant>No: evolve means to develop over time. Evolution is a noun, not a verb.</pedant>
Admin
Needs Hibernate to be more enterprisey.
Admin
Now that's ENTERPRISE QUALITY!
Admin
You are completely certain of this exactly why? Are you not familiar with the concept of code evolving over time? It starts simply, then someone adds a bit, then someone else amends it, then someone else comes in and tidies it up a bit, and ...
Sorry, but this looks to me like it evolved.
Admin
the never ending cycle of reinventing the wheel lol
Admin
Clearly there is a missing segment:
<bean id="brillantPaula" ... >
Admin
In my opinion ORM makes generally more problems than it solves. Except if you work with flat easy data models without joined tables, but why are you using than a relational database in the first place?
Maybe I'm out of date and they have improved by now, my last experience is from 2008.
Admin
Admin
ORM works fine if you stick to data-only classes and don't try to embed functionality (or even worse, polymorphism) into them. People use relational databases for simple problems mainly because the business mandates their use, either cause the data is already there, or they already have infrastructure in place for supporting, administering and maintaining them. Changing the world is hard, and nobody really wants to do it.
Another perfectly valid reason on a green-fields project is to get transactional consistency with real support from an established provider (and I'm not just saying Oracle, DB2 and MS, even Postgres has been around for a while), rather than risk using some incubator project that may be dead in a year (regardless of it's sponsor).
Yeah, ORM has it's difficulties, but if used correctly, it's just a good, strongly typed, object-oriented API for databases. IMHO: much better than the datable or recordset bullshit you get from JDBC / ODBC. Trying to actually use ORM mapped objects as something beyond data access classes will get you in trouble, but you'll only get you're fingers burned once. Then you'll learn.
Addendum (2013-10-15 08:41): If it's easier to do with raw SQL, then DO IT WITH SQL. The idea of ORM systems is to make it easier to integrate relational databases with object oriented languages. NOT to give some astronaut architect a mandate divise convoluted object oriented ways of doing the equivalent of 3 lines of SQL with 5 classes implementing umpteen interfaces, requiring low-level hooks to your favorite ORM's mothership God-Object, which inevitably change every version.
Admin
Well it certainly isn't intelligent design
Admin
Seeing that this is run as a batch job with SpringBatch I wouldn't right away give the Best Obfuscation of the Year -Award. It definitely doesn't look elegant but then again, I've yet to see elegant looking SpringBatch definitions.
Admin
++Roby_McAndrew
Admin
Admin
TRWTF: When someone's comment is smarter than any of the articles posted here within the last month.
Also, Roby++
Admin
Admin
It got done, and aside from a "deletions aren't logged" bug report, it seemed to work fine. Then, months later, about a month before that developer was going to be transferred to some other project, I was hunting down another bug and found the logging code--all of it--in the database model layer.
Instead of doing the obvious thing outlined above, the developer had hooked into Django's "object pre-save" and "object post-save" signals and built an inference engine. The pre-save routine would take a snapshot of the object's fields and store it in a hidden field in the object, then the post-save routine would use that to find the differences in every field in the object, building up a log message, and finally saving the message to the database. (BTW, the "find differences" code wasn't any kind of fancy reflection loop; it was a bunch of
if obj.field1 != obj._orig.field1: msg += "Changed field1.\n"
code copied once per field. So it wasn't even general-purpose code.)There was about 200 lines of this stuff per object type. No comments, of course. And to top it all off, this is where the "deletions aren't logged" bug came from: the log message was generated for the now-deleted object, not its parent.
So I had to call him in, explain that it was very clever, but it couldn't work for the deletion case, and further it was going to be hard for anyone else to figure out, let alone adapt to cover new objects, and then ask him to rip it out and replace it with "LogMessage.objects.create(...)" like it was supposed to be in the first place.
Admin
Rule #1 of software design:
If Rube Goldberg looks at your design and says, "Isn't that a bit too complex?", you're doing it wrong.
Admin
TRWTF is not using Spring annotations to configure this. That way, these relationships are implicit and much harder to find. Putting it in declarative XML seems like giving away too many hints.
The Obfuscators Guild will be lodging a protest.
Admin
Where's the irrelevant dialog lines? Where's the insensitive witty banter? Where's the cultural stereotypes?
Let's make a new -ism out of this. We could target people who like XML. That's Languagism!
A whole new type of group of people could get needlessly offended and angry and use it as an excuse to display their stupidity.
The whole website could shutdown because the .NET developers don't want to offer all their wealth of wisdom to developers in poorer community colleges using Fortran to write their thesis.
Then we could close down the comment section and threaten people who use it with a virus that forces them to stay on the page.
Some troll could go on a power trip and inform everyone that the site is down.
MSDN would be left as is, allowing spammers to populate the site with junk so the young developers won't know how to learn right, and would post all their bad questions on SO.
Then, when we have nothing but bad developers, we could blame our twitter emissions for causing net corrosion.
Admin
I'm astonished. Didn't anyone tell the author that it is illegal to publicly release code from a government website like HeathCare.gov*? The author will be in trouble now :)
(It's not a political statement--it's a technical statement. Agree with it or not, the code is probably packed with bulls** like this, leading to its pitiful release.)
Admin
Admin
Admin
"devolution"
Admin
Yes, definitely a case of someone who doesn't know how to do it the right way, so they do it any way.
Admin
This of course begs the BIG quiestion: Did he change the code?
Admin
Admin
XML is like violence. If it doesn't solve your problem, use more.
Admin
Right, I much prefer the magical SQL that:
will run itself without me setting up a JDBC connection or any of that
where I can assume my table exists
happily truncate a table without bothering anyone else
replace my actual query logic with ...
and not worry about error handling
Admin
"Axiom: 95% of the cost of software is in maintenance and upgrades: if the next person can't figure out what you did without your help, you didn't do as good a job as you might think!"
Hell, I'm likely to have to maintain that in six months.
And I'm not going to want to waste my time trying to figure out something overcomplicated and under-documented.
So KISS, and add comments. Comments are free.
Admin
moans "but that's too easy!"
why? someone else deleted it? fine, add a check to make sure it exists
idiots storing critical data in tables named "TempData" deserve to lose it
no actual logic was replaced with ...
moans "but that's too easy!"
Admin
pedantic troll is pedantic
Admin
This is a beautiful example of how people that are too scared to write code still do it, but use all kinds of crutches just to make sure they don't do anything wrong or hasty.
Admin
The first step in fixing code that's wrong is understanding how it's wrong...
Admin
Funny how at the end he's basically doing a JDBC operation which would have only needed that "write" method.
Admin
Roby+=10
Admin
I thought that it may have been the food stamp glitch.
Admin
Despair.com ftw:
[image]Admin
The government shutdown has gone too far. #ALCS
Admin
Many people in the rest of the world are waiting with breathless anticipation the metaphorical sound of what would in Germany be called "Einstürzende Neubauten".
The basic problem is: it's going to come crashing down sooner or later. The later the crash, the worse it's going to be. So sooner rather than later.
Admin
That has nothing to do with an ORM, only the idiots using it. I've seen the same anti pattern followed by people using raw sql.
It's the architecture astronauts that drive this behavior, not the ORM.
Admin
QUIZ: What nationality are you? Do you:
a) Say: "Very good sir," in an amusing accent, and proceed to make the required changes, albeit with spelling mistakes?
b) Argue the case, and attempt to develop a compromise with your mentor, insisting that your way is not overdesign but a bloody good robust expandable and maintainable system, if only that fucking prick in the manager's office had allowed him the time to do the fucking job properly and not cut corners everywhere?
c) Whine, throw a tantrum and walk out, to go and work for the company next door, scant seconds before the company you just walked out of collapses (either metaphorically or literally)?
If you answered a) you're Indian. If you answered b) you're British. If you answered c) you're American.
Admin
I'm not sure what made a bigger WHOOSH sound, your post or Napoli's homer.
Admin
TRWTF is that the author assumes that three lines of quirky SQL statements will:
Admin
Climate change deniers say they can truncate the temperature data without anyone noticing, but guess what, climate change is permanent.
Admin
In fact you can even do that if you don't know what the code was supposed to do in the first place.