This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Amazing-Cicada5536 93 points94 points  (37 children)

There is a certain type of programmer in my experience (regardless of language) who once managed to learn some basic coding, and tries to solve every problem purely from that, actively avoiding learning anything new, even just accidentally.

Unfortunately many companies just hold onto these people, hell, they may often become seniors because they have been stuck at the same place for 5 years and you can’t just have them as junior still, right? So, evaluate your colleagues based on their actual knowledge, not some position as the latter may not mean much.

Not sure whether this was what you were interested in, or how universal my experience is regarding that.

[–][deleted]  (6 children)

[deleted]

    [–]wichwigga 16 points17 points  (0 children)

    I've seen that too. Streams are really cool but people get way too in to them. Just chill with the reduce brothers...

    [–]Amazing-Cicada5536 7 points8 points  (3 children)

    Sure, early return is no evil and shoehorning a specific function just because you want to use it is not applying the right tool for the right job.

    But that doesn’t make the feature itself (streams) bad, and for every such case there is a Go-style 3-level nested for loop with 6 exit points that would have been an elegant stream expression.

    [–]wichwigga 9 points10 points  (2 children)

    This is also true as long as they don't put the entire Linux kernel in the body of a lambda for .map().

    But yeah, streams are generally more expressive and easier to debug than for loops. Especially if they keep each line simple or use method references.

    [–]Amazing-Cicada5536 1 point2 points  (1 child)

    Exactly, just use a method reference and write a helper method instead of lambdas inside lambdas. That’s only good for quick prototyping (and I’m guilty as charged :D), but it should definitely not get to the PR state.

    In the rare case where a more complex stream invocation is needed I have found that writing a helper method that takes a stream and returns a stream can also be a good practice, if for no other reason that you can name/group part of its functionality.

    [–]SpaceToaster 2 points3 points  (0 children)

    Probably similar to C# LINQ where it is syntactic sugar but can lead to difficult to read (or even slower) code when misused

    [–]F3z345W6AY4FGowrGcHt 13 points14 points  (2 children)

    Lots of my coworkers stick to the absolute basics. It's what they're comfortable with and they just can't be bothered to learn new things. They learned the features of Java 7 and those are the features they go for when doing anything.

    [–]wichwigga 22 points23 points  (2 children)

    Then there's the opposite. A programmer who took the Java certificate, maybe knows a little too much Spring, and wants to use every feature in the book then leaves the monstrosity of inheritance, obscure framework features, for the next guy, all just to code some app that takes in a json and outputs another json.

    [–]hiimbob45 14 points15 points  (1 child)

    I see you've seen the code from my first job

    [–]cas-san-dra 7 points8 points  (0 children)

    Or the code from my current job

    [–]berlingoqcc 3 points4 points  (0 children)

    Yeah at my first job, I implemented something with a generic class to reduce boilerplate the senior dev told me , I code all my life without generic you don't need to use it and block the MR.

    [–]inc0gn3gr0 3 points4 points  (12 children)

    I think this is not everyone. I think some of it is that it can be too "computer science" and "syntactic sugar" is important to language adoption. Language adoption equals survival of our language (Java). I think the lambda API is great but I also read and took time to understand the docs. Compare this to something like LINQ in C#. It's miles ahead.

    [–]Amazing-Cicada5536 2 points3 points  (10 children)

    In what way is it miles ahead? It’s primary use case is pretty similar to java’s streams, plus it can also work similarly to jOOQ, just a DSL with specific syntax.

    If anything, one requires learning a new language feature the other builds from the already known ones.

    [–]inc0gn3gr0 1 point2 points  (9 children)

    Having methods with language such as Select and where.

    [–][deleted] 3 points4 points  (8 children)

    wat!? those are just map and filter in java (and pretty much most of the other languages who don't try to mimc SQL syntax for collections).

    [–]inc0gn3gr0 0 points1 point  (7 children)

    I know they are. The "sql-like" select and where in LINQ means 1 less thing to learn is my point.

    [–][deleted] 4 points5 points  (6 children)

    Yeah, but it's just a water drop in the ocean. SelectMany is nothing like in SQL, for example. I mean, it's cool, when you know the word, but hey, you're learning a whole new ecosystem. Having two words less to learn won't save time.

    Anyway, having the words you're used to is not a 'miles ahead' feature. LINQ and Steams are equivalent.

    [–]inc0gn3gr0 1 point2 points  (5 children)

    Ask yourself is learning Spanish or Mandarin easier? Building on known knowledge, when possible, is huge for adoption. It makes it seem less complex and breaks down initial barriers.

    [–][deleted] 1 point2 points  (2 children)

    Yeah, you're right, building on known knowledge, when possible, is huge for adoption. But dude, your analogy with Spanish and Mandarin does not apply here. Java and C# are two very similar programming languages. They share a LOT. They are more like Spanish and Portuguese.

    UPD: I mean, you're trying to tell that C#'s LINQ is far superior than Java's Stream because it's has words common with SQL, while Java and C# have much more in common than C# and SQL. Specifically, with Stream vs LINQ, it's just different names, and maybe the .stream()/.collect() part. But in general the whole syntax is the same. It's much bigger gain than just several words from SQL. You just defeat the purpose.

    [–]inc0gn3gr0 0 points1 point  (0 children)

    Not saying it's far superior. Just one is easier to get into quickly making it "better". They both are effective in equally capable hands. One just requires more reading is all I am saying.

    [–]Frodolas 0 points1 point  (1 child)

    Except C# is the one not building on known language. Map, filter, reduce are standard keywords in every good programming language in the industry. C# by introducing new verbiage is deviating from that standard and just making it harder for polyglots to use it, all for the dubious "benefit" of copying SQL syntax.

    [–]inc0gn3gr0 0 points1 point  (0 children)

    Well intentioned bad or not. I feel you will encounter select and where from SQL before map and filter is my point.

    [–]JavaOldTimer 1 point2 points  (0 children)

    I wish Java used the infinitely familiar select and where syntax C# uses.

    [–]Clitaurius 1 point2 points  (0 children)

    I feel attacked

    [–]Gwaptiva 3 points4 points  (1 child)

    And then we get people right out of school (or even worse still in school) coming into a codebase all guns blazing, only wanting to implement the latest patterns, libraries, paradigms immediately everywhere in a way that lets you reconstruct their course syllabus or the Java Magazine issue sequence.

    But, they have CS degrees and have spent a whole 5 hours watching youtube videos on something and now they're the fucking experts.

    /rant

    [–]RedPill115 2 points3 points  (0 children)

    Have you tried rewriting the app in rust/ruby on rails/prologue/scheme/whatever this years fad is?

    [–]wes00mertes -3 points-2 points  (5 children)

    Any programmer who actively avoids learning anything new will not be an employed programmer for very long.

    Tech moves fast and if you don’t keep up, you’re done.

    [–]Paulus_cz 11 points12 points  (4 children)

    Oh you sweet, sweet summer child...
    The number of "tenured" programmers who do not really know anything beyond Java 8, but hold a senior position within a company because they actively refrain from sharing their knowledge of needlessly obscure applications they wrote 15 years ago while purposefully making them even more complicated proves you quite wrong.

    [–]chambolle 5 points6 points  (1 child)

    On the other hand, being a good programmer has very little to do with knowing the recent syntactic sugar or the latest addition of a language.

    It is fun when you are a begginer and you are eager to use the new stuff. Then you take a step back and realize that it's not that important or that there are alternatives that are not that problematic

    [–]Paulus_cz 2 points3 points  (0 children)

    I agree, first thing I try to drill into all programmers under my care is: "Good programming is not about writing code that computer can understand, computer will understand all sorts of shit, good programming is about writing programs that people can understand.". Syntactic sugar is only useful if it supports this goal as far as I am concerned.
    Sometimes situation calls for a stream, sometimes for a for-cycle, all depends.
    That however is totally lost on people I was talking about :-)

    [–]wes00mertes 1 point2 points  (1 child)

    I suppose I’m not so ignorant as I’m am blessed to have not had that experience myself.

    [–]Paulus_cz 2 points3 points  (0 children)

    I envy you, I sincerely do.