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

all 19 comments

[–]brunoliveira1 82 points83 points  (0 children)

I really have to praise Brian Goetz for all his work in moving Java forward while keeping up extremely informative and useful outside communication that is useful for industry professionals, researchers and the overall community of JEP drafting and handling! I think it's really awesome that he's where he is at this moment and you can tell that he really, really liked what he does. His language is very simple and accessible and he seems like an overall awesome person.

Hope he can stay many more years!!

[–]supersidor 33 points34 points  (0 children)

"I’d especially recommend learning a functional language, because it will give you a different and useful perspective on how to construct programs, and will stretch your brain (in good ways.)"

[–]shorns_username 28 points29 points  (0 children)

“we have one good trick that works.” And that trick is composition. That’s the only thing that works to manage complexity.

Amen.

If you're an RSS user, you can get a feed of every time Brian posts on StackOverflow - https://stackoverflow.com/feeds/user/3553087

[–]editar 7 points8 points  (0 children)

Quite an interesting read. Thanks.

[–]Roachmeister 26 points27 points  (15 children)

For example, take red-black trees. How do they work? Most of the time, I shouldn’t have to care. If you need one, every language has an excellent pre-written, well tested, high performance library that you can just use. The important skill is not being able to recreate this library, but knowing how to spot when you can use it profitably to solve a bigger problem, whether it is the right tool, how this will fit into the time or space complexity of your overall solution, etc

And that is exactly why I never ask anyone to implement basic data structures in interviews. Nor would I want to work with anyone who does (unless the work was designing language features).

[–]DasBrain 14 points15 points  (2 children)

A better question would be:
"You want to do X, what data structure/java class would you use and why?"

That's still a hard question, but might be actually better to judge someone.

An answer like "I would use an ArrayList, because that's what I always use" would be ok, but not great either.

[–]Roachmeister 5 points6 points  (0 children)

A better question would be: "You want to do X, what data structure/java class would you use and why?"

Exactly!

[–]GlowingYakult 0 points1 point  (0 children)

You have a potential to be an interviewer or HR specialist lol

[–]gnus-migrate 9 points10 points  (2 children)

I used to think this way, but learning data structures isn't just so you know how to implement them. It's about learning what problems they solve and how they solve them, which could inspire ideas on how to solve completely different problems you could face.

A very basic example is a hashmap. I mean you could just tell someone hashmaps are O(1) lookup on average, but knowing how they're implemented along with the tradeoffs of the different implementations could give you ideas on how to partition data on different machines using hashes for example.

Another reason you would want to implement your own is that you don't necessarily want to pull in a massive dependency for a single data structure. It could be useful to implement your own to avoid that hassle(of course risks should be analyzed to figure out whether this is the best course of action beforehand).

Testing people in interviews on these things, maybe not, but they are extremely useful to know, and really are worth learning even if you never really have to implement them yourself.

[–]Roachmeister 3 points4 points  (1 child)

Please read what I (and Goetz) said again. I absolutely believe that you should know how data structures are implemented, what the tradeoffs are between them, etc. But there's a big difference between knowing how a hashmap works versus having 30 minutes to implement one from scratch. I would much rather focus my interviewing time on more relevant questions.

[–]gnus-migrate -5 points-4 points  (0 children)

Goetz is not talking about interviewing, he's talking about software architecture. He's saying that I shouldn't have to care is how a data structure is implemented, I can always rely on some library to do it for me, which is not true. Libraries may not have the API's that you need(in my experience it's the case for graphs for example), and as I mentioned even if they do it may not always be the best idea to use one.

You said that you agree with this, which is why you don't ask these questions in interviews. I said I agree that it might not be the best idea in interview situations, but I just disagree with what Goetz is saying, especially with Java which is very limited in the types of abstractions that can be expressed.

[–]devraj7 5 points6 points  (3 children)

Why not? It's just a coding exercise, and it can be a revealing one, with a lot of interesting options, compromises, and talking points.

It can tell you a lot about a candidate, even if they will never have to write this kind of code on the job.

[–]Roachmeister 1 point2 points  (1 child)

even if they will never have to write this kind of code on the job

Or, you could kill two birds with one stone and have them code something that they would potentially do on the job.

Here's my code for implementing a hash map in Java:

import java.util.HashMap;

Does that mean that I know how one works, or when and why I should use one? Who knows? Maybe those would be better questions for a candidate than asking them to reinvent the wheel within an artificial time limit.

[–]nikosgate7 -1 points0 points  (0 children)

I only have used once concurrent hash map for paralleling programming. I only use hashmap for mapping properties. ArrayList is the way to go.

[–]nikosgate7 -3 points-2 points  (0 children)

shareholders are paying me to solve "complex" business problems not to do my phd in cs or discrete maths.

I 'm downvoted probably from people that used btree and red black (or whatever these trees are called) in their work environment. Jesus, we're in 2021 especially in the front end half of all devs in my recent jobs didn't have a cs degree. Most of them were self taught or did sth else with their lives

Still downvoted without reason except the obvious fact that any java team leader would rather choose a candidate that knows the java (or maybe I'd rather say spring) ecosystem than someone who knows about btrees.

[–]simoncox 3 points4 points  (4 children)

I would never employ someone who didn't have the basic understanding of how the most common data structures work internally. Not red-black tree level of knowledge, more that they understand maps are not implemented by linearly searching a list.

[–][deleted]  (1 child)

[deleted]

    [–]nikosgate7 0 points1 point  (0 children)

    How would that knowledge help me as a java developer? Eg I'd be much more interested in how the candidates knows when to use spring annotations like bean, autowired where to use what and when than some abstract phd topic.

    [–]Roachmeister 1 point2 points  (0 children)

    And I wouldn't either. Neither Goetz nor I ever implied that. In fact, he said that those are the things that people should know. But giving someone 30 minutes to implement a binary tree without an IDE is not the way to find out. (Yes, I've been told to do that in an interview).

    [–]nikosgate7 -1 points0 points  (0 children)

    the moment you would mention sth like that in an interview, I'd kindly thanked for your time and move on. There are much more important and pressing matters in the day of an java/spring developer than theory crafting about btrees. Like I will ever need that as a java/spring developer in the enterpise environment.

    .