• some guy (unregistered)

    Well, maybe the string builder is like really slow and you need to be patient ...

  • Sauron (unregistered)

    Damn, all these times where I've been in a hospital, I would have never suspected that the Patient instances were also JavascriptStringBuilder instances !

  • Paul (unregistered)


  • Vera (unregistered)

    Really a 5-word coding horror story.

  • (nodebb) in reply to Paul



  • (nodebb)

    you'll hear "favor composition of inheritance"

    Or more likely "composition over inheritance".

  • The MAZZTer (github)

    Of course it should be noted all JS objects already define a .toString() which is meant to serve this purpose anyway. No need to inherit, just define your own .toString(). Which just makes this extra stupid.

    Addendum 2024-02-19 09:49: EditL oh yeah, and presumably they're not using any of the capabilities of the string builder, just blowing away .string () with their own. So no inheritance is needed anyway, especially since JS is typeless.

  • (nodebb)

    Rarely have I felt so gobsmacked by so clear and succinct a bit of code. As Vera said. That's one for the record books.

    I am greatly enstupidated by having this added to my repertoire of syntactically correct statements.

  • Jonathan (unregistered) in reply to WTFGuy
    Comment held for moderation.
  • (nodebb) in reply to The MAZZTer

    This isn't JavaScript, I think it's Java, which is very strongly typed.

    But I think they're using extends when they should be using implements. But that's for interfaces, not classes, so it's still not right.

  • Officer Johnny Holzkopf (unregistered)
    Comment held for moderation.
  • Naomi (unregistered)

    Assuming they want to convert the Patient to a JSON document, the right way to do this is to use Jackson or one of its competitors. Depending on how you've set up the class, you might need to plop down some simple annotations, but for typical use cases you don't even need to do that.

  • Officer Johnny Holzkopf (unregistered) in reply to Naomi

    Meat for doctor Jackson.

  • (nodebb) in reply to WTFGuy

    Henceforth, "enstupidated" is going into my everyday vocabulary.

  • (nodebb)

    Along with George W Bush's "misunderestimate" and Corey Doctorow's "enshittification", it's a very useful piece of a modern vocabulary. And one I invented on my own, although I may not be the first / only.

  • Harris (unregistered) in reply to Barry Margolin

    Java also has a toString method on the Object class which every other class extends automatically.

  • henry magxan (unregistered)
    Comment held for moderation.

Leave a comment on “From a String Builder”

Log In or post as a guest

Replying to comment #:

« Return to Article