Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Best Approach to OOP

Best Approach to OOP
Thread Tools
Fresh-Faced Recruit
Join Date: Jan 2003
Location: In front of a 12 inch PowerBook
Status: Offline
Reply With Quote
Jul 8, 2003, 08:16 PM
 
I am basically a complete newbie programmer and have no formal training. I have taught myself Java (very basically) and I am thinking about the best way to design a medium sized project. I have written a couple of small programs successfully.

I have also read Thinking in Java and have a question about some priniciples of OOP.

For designing a project, Bruce Eckels suggests putting each class on a card and using the cards to discover the classes you need. This approach seems reasonable and appears to be a good way to avoid writing very complicated classes, which was my problem. My program has completely bogged down with complicated classes and I am completely lost. Of course, due to inexperience, I did not plan properly before starting to code.

The question is: should each card (Class) represent an interface and thus be abstract. To put it in other words, should I outline my program as a collection of interfaces first, then write concrete classes to implement the methods of these interfaces to actually get the thing to work.

I am not programming as a career, just as a hobby.
     
Junior Member
Join Date: Sep 2000
Status: Offline
Reply With Quote
Jul 9, 2003, 08:02 AM
 
Originally posted by jon_hh_68:
My program has completely bogged down with complicated classes and I am completely lost. Of course, due to inexperience, I did not plan properly before starting to code.
My advice is once you have your cards and interfaces worked out, choose a SMALL part of the project, and then use the existing cards to work out the BARE MINIMUM needed to get something useful working!

Anywhere you need to talk to objects later but not right now, either leave them out or put in a dummer interface/class (e.g. no working code).

Get this bit work super great, clean, commented, understandable before adding any more features.

Also if you have much going on behind the scenes in terms of modelling (for example a movie/actor/studio tracker, a car hire system, a simulation) write all the modelling code first using only System.out.println (or log4j) to give you feedback.

Once the model is working perfectly add on the GUI. There are few things worse that trying to debug the GUI and the model at the same time. This also encourages model-view-controller seperation.
Nobody made a greater mistake than
he who did nothing because he could only
do a little. Edmund Burke
     
Mac Elite
Join Date: Oct 2001
Location: Umbrella Research Center
Status: Offline
Reply With Quote
Jul 9, 2003, 09:17 AM
 
if you design you interfaces well and make sure that you stick to them then your program should be well designed... remember to make all aspects of your program self contained... here is a good (and free) look at design and basic java... most people think they know java but they dont... i thought i did, but this simple book still helped a lot

Bleeding at the Keyboard
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:47 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2