Results 1 to 5 of 5
  1. #1
    nhmllr's Avatar
    nhmllr is offline Member
    Join Date
    Aug 2011
    Posts
    51
    Rep Power
    0

    Default Is this a bad habit?

    I have a lot of 1 class programs that are mostly a main. They are all in the same Java Project. Are there any downsides to this?
    Thanks

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default Re: Is this a bad habit?

    The down-side is that your code uses no OOPs technique which means that none of your code can be re-used. Also extending the code will be problematic. Say for instance you have a simple program that analyzes medical data (like one I'm working on now). If you create your analysis methods in an OOP fashion (allowing some library methods to be static, sure), you can run your program now as a simple console program, but then later should you decide to make a GUI with it, it will be much easier to extend, and you wouldn't even have to modify the existing classes.

    But I think that most important for you is that you practice and learn object-oriented programming with true OOP classes, and the only way to do this is to create a lot of OOP programs.
    Last edited by Fubarable; 10-16-2011 at 05:30 PM.

  3. #3
    nhmllr's Avatar
    nhmllr is offline Member
    Join Date
    Aug 2011
    Posts
    51
    Rep Power
    0

    Default Re: Is this a bad habit?

    Sorry, what's an OOP?
    Last edited by nhmllr; 10-16-2011 at 05:35 PM.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default Re: Is this a bad habit?

    Quote Originally Posted by nhmllr View Post
    Sorry, what's an OOP?
    OOP = object oriented programming.

  5. #5
    nhmllr's Avatar
    nhmllr is offline Member
    Join Date
    Aug 2011
    Posts
    51
    Rep Power
    0

    Default Re: Is this a bad habit?

    Quote Originally Posted by Fubarable View Post
    OOP = object oriented programming.
    Oh, I should have known that.

    Thanks!

Similar Threads

  1. Replies: 6
    Last Post: 06-23-2011, 05:54 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
  •