Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: some advice about building more complex programs

  1. #1
    Member
    Join Date
    May 2011
    Location
    west palm beach, FL
    Posts
    189
    My Mood
    Tired
    Thanks
    41
    Thanked 11 Times in 10 Posts

    Default some advice about building more complex programs

    Ok i have a question not about code but about how you break down a complex program(well complex to me so far) to make sure you get everything without missing something and having to restart.

    I'm making a program now but its getting to be overwhelming as in it has a few combo boxes and textfields and i am having trouble keeping track of all. the reason is and here is an example...if combobox1 gets selection #1 and combobox2 gets this selection do this unless combo box 4 and 5 have this selection or this textfield is enabled etc

    how do i break complex stuff like this down to make it a bit more manageable so im less likely to miss some or a bunch of stuff?


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: some advice about building more complex programs

    I have never been to school for programming or anything, so perhaps dont read what I have to say, or keep in mind this is my way to go at a project:

    STEP 1: A DETAILED DESCRIPTION OF THE PROBLEM TO BE SOLVED VIA CODE.

    Think about the problem. Perhaps a list of the different data sets you will maintain/process, and a list of the processes you are to perform.

    STEP 2: A DETAILED DESCRIPTION OF THE PROBLEM TO BE SOLVED VIA CODE.
    STEP 2 A: sample data type
    sample data type
    sample data type
    STEP 2 B: sample action
    sample action
    sample action

    These actions are to be performed on the data itself. Not necessarily actions to solve the problem; For example if your project was to sort people of a company, you might have classes like: Employee; Customer; Supplier; SisterCompany;
    Data related to those may include: Name; Age; Wages; ID#; ETC;
    Actions related to the data may include getters/setters for each data type. Perhaps a method to calculate money over time, or what ever....
    Note that so far we have not attempted to solve the problem at hand. We have merely organized our thoughts on what we are working with. This is where you make sure nothing has been left out.

    STEP 3: A DETAILED DESCRIPTION OF THE PROBLEM TO BE SOLVED VIA CODE.
    STEP 3 A: Take your list from step 2, and start organizing classes between the data and the methods.


    Note that we ended up with some related classes. For example Employee and Customer are both people. Surely people have some things in common. All people (i hope..) have a name, and an age. Not to mention the ID# is a great key to store the data under. A Person class as a parent class to Employee and Customer may be an idea. Under the same token, Employees will want paid just like Suppliers. They may have some methods in common, but not all Suppliers would be Person. So extending Person to make Supplier would not work, but an interface could be shared among them with methods to get paid.
    I hope the samples are not clouding the idea....

    STEP 3 B: This is where you begin your algorithm to solve the actual problem.

    Just like in step 2, make a list of what needs to be done to what, but in the general sense. Folowing the sample, we want to organize the data in one place so our sister company can share our data. So the idea of setting up this structure has little to do with Mary who answers phones at night. This list is about the steps involved in sharing the data. Maybe a check-out file system. Or what ever seems to fit best... Take this and organize "The Big Picture".

    STEP 4: A DETAILED DESCRIPTION OF THE PROBLEM TO BE SOLVED VIA CODE.
    STEP 4 A: Double check what you have so far

    Go over everything again and make sure you didnt leave anything out. Make sure your overall plan still fits around what you have so far.
    STEP 4 B: Pseudo code
    Now its time to start forming pseudo code from your rough outline. You may (and I usually do) find a better plan during this part. Not to worry, its very easy to redo at this point. Fix up what ever changes you see and continue. Once you have the pseudo code for each class and for the overall project structure, its simply a matter of turning it into real code. Your code will be as good as your outline. Get it right from the start, and spend less time dealing with the code.
    Getting the outline is far more important on big projects than any amount of code.

    I feel like I have been rambling on... Hope that helps.

  3. The Following User Says Thank You to jps For This Useful Post:

    derekxec (July 22nd, 2012)

  4. #3
    Member
    Join Date
    May 2011
    Location
    west palm beach, FL
    Posts
    189
    My Mood
    Tired
    Thanks
    41
    Thanked 11 Times in 10 Posts

    Default Re: some advice about building more complex programs

    that helped a lot! i need very much to make an outline cause im getting too confused remembering all that i have done and need to do...and i dont care if its the proper way just as long as it works so thanks a lot for writing that up i appreciate it very much

Similar Threads

  1. Graphics in programs.
    By tyb97 in forum AWT / Java Swing
    Replies: 6
    Last Post: October 11th, 2011, 09:35 AM
  2. Regular Expression pattern - complex pattern syntax
    By SmartAndy in forum Algorithms & Recursion
    Replies: 3
    Last Post: June 7th, 2011, 05:40 AM
  3. Complex Numbers in Java
    By JavaNovice03355 in forum Member Introductions
    Replies: 1
    Last Post: May 18th, 2011, 08:30 PM
  4. [SOLVED] Very complex project. It's hard to explain.
    By javapenguin in forum What's Wrong With My Code?
    Replies: 55
    Last Post: November 4th, 2010, 12:30 PM
  5. How do you design a complex program
    By mydarkpassenger in forum Java Theory & Questions
    Replies: 5
    Last Post: March 19th, 2010, 07:52 PM