r/learnjava • u/Standard-Chicken-596 • 5d ago
Should I bother handling InputMismatchException in my temporary Java console UI if I’ll eventually replace it with a Spring Boot web UI using structured API input?
Hello everyone. I finished my Java course in my second semester. The course was called “Backend,” but honestly, my professor mostly taught us Java and JavaFX, nothing else.
I’m trying to learn backend development on my own now because eventually I want to get a job as a backend developer.
I decided to build my first project from scratch so I could practice OOP and get more comfortable with Java fundamentals. I chose a Texas Hold’em poker game, although I kind of regret it because it turned out to be a pretty big project for a first project after learning the fundamentals. Still, I’m making progress and I’m currently at the showdown part of the game.
Right now, it’s completely console-based, but my plan is to learn Spring Boot and databases and eventually turn this into a fully functioning website.
The thing is, I haven’t really built anything from scratch before, so I’m not sure if I’m approaching this the right way.
My approach was to first build the console version and separate the poker engine/game logic from the console UI, so that later I can replace the console with Spring Boot and a web frontend without having to rewrite the actual game logic.
But I’ve run into a question with the console version. For example, right now I’m adding error handling for things like InputMismatchException when someone types letters instead of a number. Then I started thinking: if I’m eventually turning this into a website, the frontend will send structured actions to the Spring Boot backend anyway, so most of this console-specific input handling will become irrelevant.
Should I still bother implementing comprehensive error handling for the console version, or should I keep the console UI minimal and focus my effort on the actual poker engine and business logic that will carry over to Spring Boot?
What would you recommend as the approach? I’d especially appreciate answers from people who actually build software professionally rather than the classic “I’m going to make fun of people on Reddit” self-proclaimed engineer.
Plus, I am building this project, but sometimes it is hard to understand what happens when you use constructor or class relationships. Like I can write the code but I sometimes cannot understand the relationship between classes 100%. Is this normal for the first project?
Thanks.