• bvs23bkv33 (unregistered)

    mid-2000s is legacy? NO WAY! I can not refer as legacy to anything later than 1998

  • Dlareg (unregistered)

    In my mind Y2k is a few years ago. Somehow it is almost 20 years ago. I'm getting old

  • Warren (unregistered)

    It would be no excuse, but maybe they had a rule "multiple if statements are bad, use a switch" that was misapplied here?

  • Little Bobby Tables (unregistered)

    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.

  • someone (unregistered) in reply to Dlareg

    It's not just you; I'm not exactly old yet I'm surprised how long ago the early 2000s were.

  • Thomas (unregistered)

    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?

  • JB (unregistered)

    Well to be honest that's not the best code but it's hardly a WTF

  • (nodebb)

    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.

  • Pjrz (unregistered) in reply to Thomas

    It wouldn't surprise me if there was JSON encoded in the XML or the other way around!

    I've seen worse.

  • (nodebb)

    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

  • snoofle (unregistered)

    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!

  • RichP (unregistered)

    Legacy code:

    • Code from a developer that left at least two years ago
    • Code from a language we no longer use in our environment
    • Code I wrote long enough ago that I forgot what I was doing ("long enough" varies by language, for PERL "long enough" > 1 month; for VB.net "long enough" > 1 year).
  • not a robot (unregistered)

    So, the problem with legacy code here is using switch statements instead of ifs? Kids these days have it too easy...

  • (nodebb)

    "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.

  • (nodebb)

    What is it when your suite of tests is so old and horrible that it is legacy code itself?

  • aaron (unregistered)

    no if statements,

    must be functional programming

  • (nodebb)

    [pre] public void unitTest() { assert(true) } [/pre]

    There. Code modernized. Problem solved.

  • (nodebb)
        public void unitTest() {

    There. Code modernized. Problem solved. With formatting (hopefully).

  • subaru (unregistered)

    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.

  • (nodebb)

    Maybe he could update this: https://www.xkcd.com/891/

  • Paul Neumann (unregistered)

    Apparently all of my test suites are legacy. I'll need to start writing tests for them!

  • (nodebb) in reply to bvs23bkv33

    mid-2000s is legacy? NO WAY! I can not refer as legacy to anything later than 1998

    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.

Leave a comment on “Legacy Switchout”

Log In or post as a guest

Replying to comment #:

« Return to Article