1

I'm writing a client-server app in Java using RMI, JDBC for communication with the database and JavaFX for the GUI. My question is: is it ok to put all the model classes (like Person, Citizen, Doctors...) on both the server-side and the client-side? Or they should only be put on just one side?

Basically the project is organized in this way: on server-side there is a class which contains all the services (methods) that the server offers (including communication with the database) and all the model classes; on client-side there are all the model classes and all the GUI controller classes which contain methods which internally call the services provided by the server (through a reference to the remote object) in order to display the results.

The point is that it happens that both the client and server use the same model classes: for example on the server-side there are some methods which, after retrieving data from the db, return instances of Person, Citizen...; on the client-side there are some controller classes which contain methods which call remote methods by passing instances of Person, Citizen... (all the model classes are obviously serialized).

Is this considered bad design? Should I restructure the project so that all model classes are just on either server or client side?

Fred_03
  • 31
  • 4

0 Answers0