• Factory Improvement (unregistered)

    public interface FristComment<F extends Frist, I> extends FristMessageTemplate<FristMessage<F, I>, F, I>{ }

  • P (unregistered)

    This looks more like Scala to me than Java.

  • Officer Johnny Holzkopf (unregistered)

    Very nice spilling, but it can be emproved. The accumilator could inhirit more VolumeMirger and return a refirence in a few secinds, as long as the nisting of genirics is not affected; type safity will be provided by the parimeters they dipend on, which is code sewige. I'm not a robot. Trust me, I'm a robot.

  • (nodebb)

    "This code tries to express a transformation pipeline for streaming game data, and instead expresses how much I'd like to be writing in literally anything else."

    hmm... i wonder if this is from Star Citizen codebase, something to do with the object container streaming (volumes), and if this code is the reason why it's so broken...

  • (nodebb)

    I see no problem with the original example (the longer one is obviously problematic. For semantic ease

    class ListOfStringMaps<T> : List<Map<String,T> {}

  • generics... (unregistered)

    cough TRWTF is C++ template metaprogramming cough

  • sizer99 (google) in reply to sh_code

    There are a lot of things wrong with Star Citizen, but I don't think being written in Java is one of them.

    ... though at this point it's such a clutterfunk who knows.

  • sizer99 (google)

    The worst thing about this is that the senior guy who wrote it in the first place is probably extremely proud of it - just the fact that he spent three days getting it to work at all and it technically does work at all - and will savagely resist any attempts to clean it up with something far more readable (and writeable). I've been on the wrong side of that before, the uglier it is the more protective they are.

  • WTFguy (unregistered)

    I date from the days before "structured programming" was the latest thing out of academe.

    One of SP's insights was that when you found yourself writing code twice, you should refactor the repetition into a separate method. Not that we used words like"refactor"or"method". A largely unspoken corollary of the earlier paragidm was that you did not create separate methods until you detected repetition. Now under new-fangled SP in additionto avoidingcodeduplicationit was also OK ,in fact encouraged, to break the problem down into smaller procs according to a vague concept of style and what would later be called a "separation of concerns".

    Then came OO, DRY, the maxim that classes (and especially methods) should have a single concise purpose, and all that other modern post-1980s goodness. Which led to very large numbers of very small named classes, structs, and methods. Many of which ended up being used from a few or only one call site.

    So, starting around 2005 in the name of conciseness and locality of mental (if not in-RAM) reference, we invented lambdas, generics, and all the rest. Which afford the ability to define subtypes and subprocedures at their point of invocation, rather than elsewhere in the source code tied together by a name.

    Said another way we've come come almost full circle back to spaghetti code with a giant do-all method in an uberclass. Once you nest a couple generics and a couple lambda's together figuring out where one begins and where one ends is harder and harder. Obvious entry point?? We don't neeed no steenkin' obvious entry point!!!

    Sheesh! Will we ever learn?

  • (nodebb) in reply to generics...

    TRWTF is looking at this monstrosity and think that C++ is remotely as bad as Java

    Addendum 2019-12-09 14:16: thinking*

  • .. (unregistered) in reply to WTFguy

    I have no idea what you're on about. Generics have existed way before 2005 and have like nothing to do when entrypoints. Lamdas also stem from Lambda calculus which is older

  • Say what (unregistered) in reply to WTFguy

    You're not old enough. Generics were invented in the 1970s (the real name of it is "parametric polymorphism") and lambdas are from the 1960s, if I recall correctly. Neither are new, in fact, "modern" C++/Java-style object-orientation is much newer than either of them! The real problem here is not generics and it is not lambdas. It is a bolting on advanced features to a language where the type-system is a clusterf*ck, thus making it virtually impossible to do reasonable type inference in many important cases. As a result, we have unreadable garbage-looking code that would actually look sweetly elegant in a language with a reasonable type system!

    tl;dr the real WTF isn't this code, it's Java's terrifyingly bad type system...

  • Jinks (unregistered) in reply to felpy

    Those who don't understand C++ are doomed to reinvent it, badly.

  • David Mårtensson (unregistered) in reply to sizer99

    This is not a fault of the language, almost any language can be mistreated and abused and this is just another example of someone using a feature of a language for the sake of the features, not to improve the code and make it easier to read and maintain.

    It could also be the end result of a clever piece of code that was to be extended instead of refactored.

    Generics, used in moderation, can make code so much better, avoiding multiple specialized classes that do the same thing, just to different types of objects, but its very important to always focus on why.

  • NewtonIsaacs (unregistered) in reply to WTFguy

    "Structured programming" wasn't new when JSP was the big thing in 1975, lambda calculus predates Turing machines, and was 'new' in the sixties with LISP - how old are you, really?

  • WTFguy (unregistered)

    @NewtonIsaacs. Not so ancient as to predate the lambda calculus ;).

    But I hope you can agree that lambdas as a syntax feature of mainstream languages widely used to produce commercial apps is a much more recent invention. For example, the .Net framework gained them with v3.5 in 2007, though they weren't the first mainstream toolset to do so.

    My point was that for round numbers the mid-late 2000's was when the vast bulk of typical programmer-for-hire types started to use them. Which is when we began to see these interesting WTFs by mis/overuse.

    Ditto Generics. As David Mårtensson said just above; great when used appropriately but a foot-gun when wielded blindly. The idea was well known in computer science circles years or decades before every they were first built into mainstream commercial development systems like .Net (in 2005), Java (in 2004), etc.

    And it was only once generics where there that clueless doodz began creating monstrosities like the one we're all discussing here today.

    With the meta-point that most of these practitioners are too young to recognize that they're some way along to re-creating the commercial spaghetti code of the 1960s & early 1970s.

  • Some Ed (unregistered) in reply to sizer99

    In my experience, the senior guy who wrote it isn't always that protective of it. It's just that the ones that last long enough to make it here tend to be ones that had a protective senior guy protecting them.

    The two biggest coding monstrosities I've intimately encountered in my career that I didn't proceed to fix almost immediately were ones perpetrated by myself and a coworker (not together. Each WTF had one author.)

    He was protective of his WTF for a few years, after which he started complaining that he seemed to be the only one who ever did support for it. After a few more years, he transferred to another group primarily so that he wouldn't have to continue supporting it.

    I pointed out mine was a WTF before release. "This will work, but it's bad code and a bad solution. We should replace it with something better as soon as we can find something better." That was roughly 19 years ago, and we replaced it with something that almost fit the bill this year. I spent no time protecting it, people just didn't want to touch it with a 1000 mile pole. (Also, those things are fricking heavy. Just saying, the mass adds up, and the leverage aspect is hideous.)

  • BOOKMYAIRTRAVEL (unregistered)
    Comment held for moderation.

Leave a comment on “Crank the Volume”

Log In or post as a guest

Replying to comment #510216:

« Return to Article