ow yes i am trying to right in OO code right away
problem => OO design => OO code
in the begining of the program i do it just like that, but as the
program gets biger and you have to pass arguments from here to there i
get lost where things go, and i am not sure if i should create a new
class and put it in there or use an already existing class.
Artem
Arne Vajh?j wrote:
> > i am trying to learn object oriented programing, and i am having a hard
> > time on desiding how to to break up my java program in to classes and
[quoted text clipped - 17 lines]
>
> Arne
Lionel - 17 Nov 2006 03:37 GMT
> ow yes i am trying to right in OO code right away
> problem => OO design => OO code
[quoted text clipped - 3 lines]
> class and put it in there or use an already existing class.
> Artem
Please don't top post!
Perhaps you should give us some examples of what you are trying to do
and we might be able to make suggestions.
It should be obvious when to make classes. A class represents some
thing, an Object. For example, an Apple, Orange or a Book. A class can
also represent something less physical such as a database. You don't
make a class to put a method in it.
Lionel.
Arne Vajhøj - 17 Nov 2006 03:37 GMT
> ow yes i am trying to right in OO code right away
> problem => OO design => OO code
> in the begining of the program i do it just like that, but as the
> program gets biger and you have to pass arguments from here to there i
> get lost where things go, and i am not sure if i should create a new
> class and put it in there or use an already existing class.
You create classes based on the types of objects in the real world.
And you add methods to those based on something that makes sense
in the real world.
If two different ways both make sense in the real world, then
you should not worry about it in the code.
Maybe you should try and post a specific example that
is puzzling you, then we can try and explain what the above
means in that case.
Arne
Manish Pandit - 17 Nov 2006 03:39 GMT
Before beginning to code, try to get a feel of what the paradigm of
object oriented programming is. Once you are familiar with the
methodolody of encapsulation, data abstraction, inheritance and
polymorphism, you will be able to look at problems a lot differently
than the traditional procedural way. If you skip this step, even though
you'd be programming in an object oriented language, the code will
still end up being procedural.
-cheers,
Manish
> The classes and their functionality should be driven by
> the reality your are trying to model.
I don't think that's particularly true. That may be a reasonable /starting/
point for someone completely new to OO, so wouldn't I necessarily call it /bad/
advice, although it is certainly incomplete, and misleading if taken too
literally.
-- chris