Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java GUI and database application  RSS feed

 
Gus Hayes
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I’m a newbie and would much appreciate some advice on a project I have undertaken. I am designing a GUI system for a maintenance team so they can manually input major faults that occur on their machines and how they fixed them. I will be doing this using Java and MySql.

The technicians will logon and can either choose to search historical fault data or submit new fault data. There are three different types of postal automation machines that will be used on the system. Users will search using filters such as Date, Machine ID, Module/Sub-Module etc. The submit new fault data section will consist of fields that the user will fill out (some mandatory) and then submit this to the database.

My problem is identifying the classes I require. The classes I have identified so far are Logon, RetrieveHistData, SubmitNewFault, Users and Logout. I have done use cases and activity diagrams and am ready to do class diagrams. Also, do I need a MachineType Class or Interface (as there is 3 different types) that will take the information from the GUI form and then the program runs that class and sends info to the database or can the user select machine, module etc from a dropdown box on the form page and then this is sent to database as the complete form.

I am a bit confused and would really appreciate some help with this.
Regards,
Gus
 
Campbell Ritchie
Marshal
Posts: 55687
162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gus Hayes wrote: . . . The classes I have identified so far are Logon, RetrieveHistData, SubmitNewFault, Users and Logout. . . .
Good grief! Somebody who designs his app rather than diving in and getting all confused. Well done.

Unfortunately most of those class names look more like method names to me. You might need a User class, a fault class, a Machine class, or something like that. User#logon looks like a method.
Actually, I would suggest you develop the database first. You can have fault tables, and machine tables, linking the fault to the machine with the primary key from the machine table. You can also link the fault to the primary key in the user table to see who reported it, repaired it, etc.
Once you have the database working, then you can add a connection to Java. You need something with a public interface likeThen you can add a GUI on top of that.
And tell me which of those method names will fail to compile.
 
Vishal Shaw
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Good to hear that you are thinking about the blueprint first rather that jumping into code

Like Campbell suggested first identify your entities and chalk out the database.
Then, you can easily chalk out your classes ,like say you have an entity User than you can have a class named User. Then you plan out the methods needed by your entity for working, say addUser(). checkLogin().

As for the coding, just one tip, don't mix up your view layer with your business logic layer, keep them separated by using MVC.

Cheers,
Vishal.
 
J. Kevin Robbins
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gus Hayes wrote:Hi,
The technicians will logon and can either choose to search historical fault data or submit new fault data. There are three different types of postal automation machines that will be used on the system. Users will search using filters such as Date, Machine ID, Module/Sub-Module etc. The submit new fault data section will consist of fields that the user will fill out (some mandatory) and then submit this to the database.


This is a pretty good description of your problem domain and even some use cases. Good start!

Here's general rule that I use to get started. The nouns (fault data, machines, technicians, etc) are usually your classes. The verbs (search, logon, submit, etc) are usually methods. Now think about which methods belong to which classes, for instance, if you are searching for fault data, then the search method will probably be a method of your Fault class.

Again, this is a general guideline, but it's usually a good way to start getting some ideas on paper.
 
Gus Hayes
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys,
This is some great advice. I am nearly through the Head First Java book which is great but when it comes to designing an application from wire to wire it is a lot more challenging than doing exercises in a book. @ Campbell: I think the this() method will fail to compile because this is a Java keyword meaning this.object. I will get cracking and no doubt be back to you with some more challenges.
Thanks and best regards,
Gus
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!