Designing JAVA client-server application
First of all, I'm aware that this question has a lot of potential to be closed down as "not a real question" or something similar only because it is not straight forward "programming question" but I urge you, please read it first before you close it down and contribute if you feel to.
I am Jr. JAVA developer and will have a task of developing a full blown client-server JAVA application. If I go into more details, application will contain a server which will be connected to a database or will be basically a database onto which many of these clients will be connected to.
My application should be able to:
- (CLient) Send daily reports to the server
- (Client) Update itself when a new client version is available
Can some of the senior JAVA developers and experienced programmers give me some advice on which books or guides to grab especially on topic of good software design principles? I've also searched quite alot on point 2 above but my searches didn't yield any good results..
Your question is simple but there is not one single resource you can refer to get up to speed on "software design". Below are some recommended readings in related areas, by no means comprehensive but which would put you on track, FAST.
You can easily find more serious texts especially on the topic of OOP class design and architecture once you have the basics right. (Getting the basics right is harder than you think and that would be a worthy goal IMHO)
- good code - Try Code Complete. Also Google the phrase Code smells.
- good class design principles - Read and understand SOLID for bare essentials
- good code design aka patterns - Try Heads up design patterns
- good program design - Try The Design of Design and Software Architecture in Practice.
As for point 2 - the methodology which you chose to implement this will decide how and whether you need the auto update. Here's an answer to this question
You can implement it with sockets. If so, you will need to create two threads on your clients-side. One will listen the server for thread updates and the other one will send daily reports to the server. The server will have 2 times numberofClients threads.
You can implement is via RMI which will need more research, after that you can invoke other side methods to send reports or to get updates.
Choose a subject and we may converse a lot around one or more drinks:
- Sockets: local area network, using java.nio.channels and java.nio.ByteBuffer
- HTTP: wide area network
- CORBA: if you're masochist
- RMI: simple in a local area network
As you can imagine, this wheel has been invented many, many times.
Do NOT use raw sockets. There is no reason whatsoever today to do such a thing for commodity business work.
Use something on top of them.
With the 10 second summary you've provided, there's no reason you can't use Web Services (either formal, SOAP based web services, or ad hoc HTTP based).
This way you're using commodity, well documented, widely used infrastructure, with lots of examples. Slap Tomcat or Glassfish on the back end, and have it handle the database chores.
RMI is fiddly to work with. CORBA is pretty much deprecated save for legacy systems nowadays, if you're going to go CORBA you may as well go Remote EJB.
Modern SOAP Web Services are (mostly) drag and drop with modern IDEs. No reason to write sockets, write a server, any of that. We have LOTS of Java server tooling. Servlet containers are ubiquitous and reliable.
I also agree about using Java Web Start for the GUI. It takes some set up, but makes deployment far, far easier for everyone involved.