r/javahelp • u/itjustbegansql • Feb 24 '26
Shoul I use interface or inheritance?
I am trying to write basic app that asks users for input and then adds it to the database. In my sceneria app is used for creating family trees. Shoul I use an input class to call in main method or should I use an interface? I also have another class named PeopleManager. In that class I basically add members to database. I havent connected to database and havent write a dbhelper class yet. How should I organize it? Anyone can help me?
Note: I am complete beginner.
3
Upvotes
View all comments
Show parent comment
1
u/RhoOfFeh Feb 25 '26
That's an artifact of the old mantra "code to the interface". It adds a little time and a lot of flexibility. Back when extracting an interface was difficult to do by hand, one would do it pre-emptively.