Results 1 to 5 of 5
  1. #1
    stuckonjava is offline Senior Member
    Join Date
    Jan 2012
    Posts
    151
    Rep Power
    3

    Default classes structure

    Lets say I have to build a GUI which has a button and when the user clicks this button information is shown. Could someone explain what classes I would need because at the moment I have everything in one file and will get marked down unless all the code is structured into a set of classes and method. But I am not sure entirely what this means and how to do this.

    Thanks for your time.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,560
    Blog Entries
    7
    Rep Power
    21

    Default Re: classes structure

    Write down your problem as if it were a little story, in plain English. Every noun is a good candidate for a class and every verb is a nice candidate for a method. This is not a law cast in stone but it works fine for starters.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    fatabass is offline Senior Member
    Join Date
    Nov 2011
    Location
    Turkey
    Posts
    380
    Blog Entries
    24
    Rep Power
    3

    Default Re: classes structure

    Study Mode - View - Controller pattern.

  4. #4
    stuckonjava is offline Senior Member
    Join Date
    Jan 2012
    Posts
    151
    Rep Power
    3

    Default Re: classes structure

    I am confused by this, could you explain what you mean for eg if I need to build a GUI that requires the user to click on a button followed by information appearing retrieved from the internet what would the classes be?
    Quote Originally Posted by JosAH View Post
    Write down your problem as if it were a little story, in plain English. Every noun is a good candidate for a class and every verb is a nice candidate for a method. This is not a law cast in stone but it works fine for starters.

    kind regards,

    Jos

  5. #5
    ozzyman's Avatar
    ozzyman is offline Senior Member
    Join Date
    Mar 2011
    Location
    London, UK
    Posts
    797
    Blog Entries
    2
    Rep Power
    4

    Default Re: classes structure

    The verb in that case wouldve been 'get' as in 'getInformation()' method.

    You could have a seperate class for User if you store any info about your users.

Similar Threads

  1. Classes Help!!! two classes with object question.
    By stuckonjava in forum New To Java
    Replies: 16
    Last Post: 02-10-2012, 01:39 AM
  2. Problem using Structure in JNA
    By okaitt in forum New To Java
    Replies: 0
    Last Post: 04-28-2011, 03:59 PM
  3. Which data structure to use?
    By malaguena in forum New To Java
    Replies: 4
    Last Post: 04-05-2011, 04:41 PM
  4. Use if then else structure, help
    By paul in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 05:00 AM
  5. Help with Structure
    By Albert in forum New To Java
    Replies: 1
    Last Post: 07-13-2007, 03:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •