Results 1 to 5 of 5
  1. #1
    java4deepak is offline Member
    Join Date
    Jan 2011
    Posts
    2
    Rep Power
    0

    Default Multiple private methods

    Hi,

    just have a doubt which came from a discussion, is there any advantage/disadvantage in breaking a private method into multiple private methods in a class. Even though all the private mthod calls once in the class.

    Thanks in advance

    DK

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,834
    Rep Power
    8

    Default

    You get the sames advantage as you always get from breaking a method up into multiple methods. Whether the method is private or public doesn't really make a difference.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    goldest's Avatar
    goldest is offline Senior Member
    Join Date
    Oct 2009
    Location
    Pune, India
    Posts
    469
    Rep Power
    5

    Red face

    Have you tried anything like this through code? Is there any code snippet that you have stuck up with while trying this?

    Just checking,

    Goldest
    Java Is A Funny Language... Really!
    Click on * and add to member reputation, if you find their advices/solutions effective.

  4. #4
    java4deepak is offline Member
    Join Date
    Jan 2011
    Posts
    2
    Rep Power
    0

    Default

    thanks all..

    i read making unnecessary multiple public mathod create performance issue where as for private method it's not as private is like final which doesn't have any reference outside. So apart from this advantage i just wanted to know is there any other concern may have... This came up in a code review session where as the single method is broken into multiple private methods.

  5. #5
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,834
    Rep Power
    8

    Default

    Quote Originally Posted by java4deepak View Post
    i read making unnecessary multiple public mathod create performance issue
    I could see it being a design issue because you might not want to give access to all of the methods to just any class, but I'm not sure that would impact performance at all. Where did you read this?

    Quote Originally Posted by java4deepak View Post
    where as for private method it's not as private is like final which doesn't have any reference outside.
    I'm not sure what you're saying here.

    Quote Originally Posted by java4deepak View Post
    So apart from this advantage i just wanted to know is there any other concern may have... This came up in a code review session where as the single method is broken into multiple private methods.
    If you're in a code review, you pretty much should probably just listen to the reviewer. You might also look into profiling your program to see any actual performance changes (or the lack thereof).
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. problems with multiple methods and paramaters...
    By silafirion in forum New To Java
    Replies: 13
    Last Post: 12-07-2010, 01:10 AM
  2. Replies: 17
    Last Post: 10-14-2010, 10:26 PM
  3. using multiple methods for graphics
    By jforce93 in forum Advanced Java
    Replies: 3
    Last Post: 04-25-2010, 06:05 PM
  4. JDBC that multiple methods will use
    By evermore in forum JDBC
    Replies: 3
    Last Post: 03-16-2010, 07:27 AM
  5. Replies: 5
    Last Post: 07-18-2008, 04:30 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
  •