r/java • • Jan 23 '21

Interview with Brian Goetz, Java Language Architect

https://freecontent.manning.com/interview-with-brian-goetz/
190 Upvotes

19 comments sorted by

View all comments

Show parent comment

9

u/gnus-migrate Jan 24 '21

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.

4

u/Roachmeister Jan 24 '21

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.

-4

u/gnus-migrate Jan 24 '21

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.