• 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)

    brilliant.string()

  • Vera (unregistered)

    Really a 5-word coding horror story.

  • (nodebb) in reply to Paul
    brilliant.string()

    brillant.string()

    FTFY

  • (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

    Yup, usually there's something to be figured out, so when I hit the "here's the code" part of the post, I'm usually ready to do some logical thinking and "well if this, then that" simulations.

    Not this time. I hit "JavascriptStringBuilder" and the only thought in my head was "well, would you look at that", and I stared at that one class name for like a full half a minute. There's really nothing to say about it, is there?

  • (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)

    public class Patient extends JavascriptStringBuilder public class Doctor extends InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonPainter public class Nurse extends SimpleBeanFactoryAwareAspectInstanceFactory.getAspectClassLoader public class Coder extends PaulaBean(brillant, 1, TRUE, FALSE, FILE_NOT_FOUND) // what a germ ...

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

Leave a comment on “From a String Builder”

Log In or post as a guest

Replying to comment #:

« Return to Article