Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2006

Tip: Looking for answers? Try searching our database.

OO programs

Thread view: 
artem - 17 Nov 2006 01:13 GMT
hi all,
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
on what each class should contain. Does any one know of a good java
open source program that is designed this way and would be a good
example to learn from. i would prefer if it would be around 10-20
classes?
tnx
Arne Vajhøj - 17 Nov 2006 02:21 GMT
> 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
> on what each class should contain. Does any one know of a good java
> open source program that is designed this way and would be a good
> example to learn from. i would prefer if it would be around 10-20
> classes?

One of your problems may be that:

problem => non OO code => OO design => OO code

does not work very well.

problem => OO design => OO code

will be much easier.

The classes and their functionality should be driven by
the reality your are trying to model.

Arne
artem - 17 Nov 2006 03:23 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.
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
Chris Uppal - 17 Nov 2006 13:30 GMT
> 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.