Results 1 to 2 of 2

Thread: When is Lines and methods too much? Classes responsibility?

Hybrid View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Location
    San Pedro de Macoris, Dominican Republic
    Posts
    211

    When is Lines and methods too much? Classes responsibility?

    So, I've got this class that retrieves a list of values from remote computers via WMI for an inventory program I'm developing.

    http://i1056.photobucket.com/albums/...t/untitled.jpg
    My Question is: When is lines too much? The class's got currently 800 lines and I've got another with 1200.

    Do you think thess methods fall in the same responsibility? (To Obtain Hardware Info about remote computers)


    If these methods are too much, should I inherit another class and keep going from there?
    Last edited by pukisoft; Mar 29th, 2012 at 09:05 AM.

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,038

    Re: When is Lines and methods too much? Classes responsability?

    Those are some pretty large classes. However, the problem is one of organization. If the ideal organization really requires that many lines, then so be it, but that is rarely the case. One thing I would say about it is that the one place where I can see a class having a large number of lines is one that is used as some kind of utility to acdess something, and that pretty well describes your situation.

    You might be able to break it into a series of classes, where one class handles one kind of information while other classes handle other parts of the information. Alternatively, you could break the class into a series of partial class files. This does nothing for simplifying the actual class, but structures the organization better.
    My usual boring signature: Nothing

Posting Permissions

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



Click Here to Expand Forum to Full Width