• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Program Structure

 
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello world,
I am hoping to write a stock controlling program. In that prorgam I want to to have these functions listed bellow. 1) Bill. (User can specify the quantity and the discount and add that entry to a bill.)
2) Inventory (User can add new items, update the item details and delete item details from the databse.)
3) Supplier (User can add new suppliers, update supplier details and delete supplier details.)
4) User (The administrator can add new users and delete. )
5) Reports (Various reports on the transactions, the items to be reordered etc.)
I am hoping to do the program in 'SWING'. The main window has a menubar and for each function I have mentioned above has seperate Menus. For example there is a 'User' menu which has 'Add User', 'Delete User' as menu items.
As you know,for example when adding a user, details are taken about the user such as the name etc.For this I need a GUI. The problem which I am having is do I need to create seperate classes which creates the GUI for each and every sub function ?.(example: adding a user)
So far what I have thought to have is, a main class for each of the main functions (for example supplier), and use the methods in that class to add, delete etc suppliers, and have different frames to get the GUIs in the main GUI. To make it more clearer this is the program structure what I have in mind.

public class abc {
public static void main(String arg[]) {
JFrame jFrame = new RMain();
}
}
class RMain {

/**
* Declare Components for the main gui.
*/

/**
* Declare Components for the Adding of a new user.
*/

/**
* Declare Components for the Deleting of a user.
*/
public RMain() {
}
}
class Supplier {
public Supplier() {
}
}
class User {
public User() {
}
}
program structure.

So is this structure ok?. or other wise do I have to have different classes for let's say 'AddSupplier' class which has the needed GUI components for adding a new Supplier. (I tried this but, I felt restricted when performing actions.)
Could you please advice me on this with your expertise knowledge.
Please if YOU know any online books for 'Good Programming or How to be a good programmer' please do tell me.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is not easy to say if a design is good or not. The key thought given to me by one of my instructors is that the design "works and can be seen to work". That is, the program does what it is supposed to do and if someone looked at the source code, they could figure it out. As for a book on Java, Bruce Eckel's Thinking In Java is online.
 
Whose rules are you playing by? This tiny ad doesn't respect those rules:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic