Hey everyone! I'm currently developing my own database system using Rust and decided to tackle the same project in Java. It's still in the early stages, and I'm implementing a SQL parser from scratch. While I have a working version in Rust, I'm facing some challenges translating it into Java due to the shift to object-oriented programming (OOP), which doesn't come as naturally to me as Rust's approach does. I'm realizing that I need to think not just about what I'm writing, but also about how I'm structuring it in an OOP style. I've read the book "Crafting Interpreters," but I find the way it explains creating files on the go to be somewhat unappealing. Are there any tips, resources, or books that could help me grasp OOP better, or is it more about me needing to learn the language more thoroughly?
5 Answers
The Crafting Interpreters book isn't really focused on OOP, so it's understandable that you're finding it lacking for your needs. Try starting with a single class for your project and see if you can break off pieces into separate classes as you go—your project is small enough to experiment with this approach.
Remember, you don't have to stick strictly to OOP in Java! Since Java 8, you can use lambdas and Streams for a more functional programming approach. There's also a great book on functional programming that you might find helpful.
Check out this video for a breakdown of Java's OOP concepts. In Java, methods are directly attached to data, which is different from Rust where functions are related to structures instead. The code might look similar, but it'll be more spread out in terms of object locations.
I had a tough time with Java too, but after some time working with Golang, I got used to its structures and packages. When I returned to Java, things made a lot more sense. If you can, give Golang a shot—it might help bridge the gap between Rust and Java for you.
OOP can actually be quite intuitive! Think of your code in terms of real-world entities. Gather the scenarios you want to code and represent them as objects and methods that interact with these objects.

Totally agree! Go gives you less ceremony than Java while maintaining a structured feel. It can definitely help solidify your understanding of OOP concepts once you get back to Java.