- 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
mid-2000s is legacy? NO WAY! I can not refer as legacy to anything later than 1998
Admin
In my mind Y2k is a few years ago. Somehow it is almost 20 years ago. I'm getting old
Admin
It would be no excuse, but maybe they had a rule "multiple if statements are bad, use a switch" that was misapplied here?
Admin
How is newtonking an improvement over the good old tried-and-tested oldtonking? I want to carry on being tonked the same as I always have been.
Admin
It's not just you; I'm not exactly old yet I'm surprised how long ago the early 2000s were.
Admin
The real WTF is that Newtonsoft.Json is a library for JSON parsing and serialization. How the f*** did it pop up in XML-related code, and why would there be XML attributes in this namespace?
Admin
Well to be honest that's not the best code but it's hardly a WTF
Admin
My guess is that they expected the newtonsoft namespace definition to expand and so it'd just be a matter of adding new case statements. Clearly that didn't happen.
Admin
It wouldn't surprise me if there was JSON encoded in the XML or the other way around!
I've seen worse.
Admin
I'm wondering if this was a misapplied attempt to leave room for additional valid values or namespaces in the future. Still not the way I'd implement that, but that's the only reason I can think of that you'd write such different methods on the same day
Admin
I've had to add tests to otherwise untested systems, and it really forced me to trace through a lot of the underlying WTF in the codebase and clean it up.
I'm not sure if the investment was intended more for increased developer knowledge, cleaner code or both, but down the road, I noticed that it took less time to track down bugs, so FTW!
Admin
Legacy code:
Admin
So, the problem with legacy code here is using switch statements instead of ifs? Kids these days have it too easy...
Admin
"Legacy code is just code without unit tests" -- some smartass from a conference
Seems good in theory, except that given how ridicolously badly designed and spaghettified some legacy code is, as soon as you write unit tests, the microsecond after you start refactoring, you most likely have to rewrite your unit tests from scratch, because the original code was so untestable.
Admin
What is it when your suite of tests is so old and horrible that it is legacy code itself?
Admin
no if statements,
must be functional programming
Admin
[pre] public void unitTest() { assert(true) } [/pre]
There. Code modernized. Problem solved.
Admin
There. Code modernized. Problem solved. With formatting (hopefully).
Admin
It's from the book "Working Efficiently with Legacy Code". Highly recommend. I guess the author has made a lot of speeches where this bold statement has come up.
Admin
Maybe he could update this: https://www.xkcd.com/891/
Admin
Apparently all of my test suites are legacy. I'll need to start writing tests for them!
Admin
I started in this company in late 2002 as part of the effort to replace a key system, which we completed in late 2003. In 2006-7 we replaced that system with a new one. In 2014 we replaced it again, because the previous product had been EOLed for some time. (Company was bought out and the product discontinued.)
I'm hoping we can stretch this one out to 10 years. At least nobody's likely to be buying out Oracle any time soon.