• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

OO concepts

 
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I recieved the following comment in my most recent assignment:


Do you really need to instantiate an object? You're introducing OO where I don't see a need for OO.


I've always assumed that since Java attempts to be a purely OO language that OO programming is always approriate. If your always attempting to write OO code then it'll be second nature to you right?
Pro's and Con's of always attempting to write OO code? When and when not to? Comments?
Joe
 
Trailboss
Posts: 23778
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are going to write a tiny program that will be clear with a linear approach, then OO stuff just makes things less readable.
OO is definitely a big help with large programs.
I suspect that you got that message because you were instantiating an object when such instantiation did not help matters. The program would probably be clearer as a linear or procedural approach.
Objects are also good when you will have more than one instance of an object. I suspect that in this case, you had only one instance? Sometimes one instance is good as an object, but usually not.
 
Joseph Russell
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can understand that for the Cattle Drive assignments but when your programming in general shouldn't you always assume that you might later on need to instantiate an object? Maybe this is where experience comes in.
 
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With these assignments, we are teaching with building blocks. First few assignemts teach you how to do the basics like loops, if and switch statements, style and formatting, calling basic methods. The stuff you need for all of your code.
Later assignments, OO classes, go over Object Oriented skills.
Bill
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nobody's crystal ball is all that good.� When you actually need an object, THEN you create it.

[This message has been edited by Marilyn deQueiroz (edited March 26, 2001).]
 
Everybody's invited. Even this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic