Results 1 to 4 of 4
  1. #1
    JVAB is offline Member
    Join Date
    Oct 2009
    Posts
    3
    Rep Power
    0

    Default Method Seperation

    Hi,

    I'm pretty new to java and was wondering what the best contruction would be to accomplish the following:

    I have got a class witch contains over 100 methods. They can be easily categorized so i'd like to seperate and spread them out over about 15 different java files. I'd also like to put those 15 files in a directory. (This all to keep the code readable). Now i'd like to be able to refer to the methods in those files as if they were in that main file that used to have all 100 methodes. Is this possible? and if not. What would be the best way to set up this construction?

    thank you all in advance!

  2. #2
    JVAB is offline Member
    Join Date
    Oct 2009
    Posts
    3
    Rep Power
    0

    Default

    BTW. To clarify:

    It doesn't only concern methodes but also variables.
    I'd like to be able not only to REFER to but also able to HANDLE those methdoes and variables as if they were in that main file.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Don't know of any one size fits all solution here. 100 methods is certainly way too many for any one class to hold and so you are right to desire to refactor this. Are any of these methods very similar? I can't help wondering if the total number of methods could be reduced by some simplifications.

  4. #4
    JVAB is offline Member
    Join Date
    Oct 2009
    Posts
    3
    Rep Power
    0

    Default

    well.. the class is actually a collection of different data-storage parts. Each part holds the data of a certain event differently. For example if you have a row of numbers. One part holds the sum of those numbers. While another part holds the Spreading. And another part holds the ammount of numbers > 5. It's something like that, Only with more complicated parts who hold more info.

    Each part uses 10 methods or so to hold and hand out the information in it.

    Now a number of other classes have the reference to the big-database-with-over-100-methods and can therefore easily gather the information in it using only the reference: Database.Method();

    I would like to make a different file for each datapart to make the code more readable without having to change the references.

Similar Threads

  1. Replies: 2
    Last Post: 03-26-2010, 05:12 PM
  2. Replies: 2
    Last Post: 02-04-2009, 02:11 AM
  3. Replies: 29
    Last Post: 09-25-2008, 07:55 PM
  4. seperation of file contents
    By Ms.Ranjan in forum New To Java
    Replies: 5
    Last Post: 07-11-2008, 09:17 PM
  5. cannot call private method from static method
    By jon80 in forum New To Java
    Replies: 3
    Last Post: 05-07-2008, 08:37 AM

Posting Permissions

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