• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I Can't Design to Save My Life

 
Keith Jones
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Well it's like this.

I have some GUI classes that I want to keep separate from all other code (which is a good idea of course). For this reason I haven't instantiated my client class anywhere in the GUI classes.

So what I did then was in my main method (which is not part of the gui or the client or anything else), I created (amoung other things) the client, the gui and the actionlistener for the gui.

This seems to me to be worse than having an instance of the client inside the gui because now I do this:

Create a client, the gui and handler. Pass the client and gui to the handler so that when actionPerformed is called the handler can inform the client of the values typed into the gui (if any).

Just wanted some input as to whether this is good design or am I heading towards the road to failure.
 
Keith Jones
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In fact I'm so disgusted with the design that I'm thinking of throwing an Exception whenever the program is run:

Exception in main: CrapDesignException: The design is so lame that you should not write a line of Java again.

Oh why am I desparing so much?

 
Simon Cockayne
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Keith...dude...find your centre. Breathe. Relax.

I won't comment on your design specifics...but I would say this:

Do read all the reading materials and the FAQ on the forum.

Take a look at the tutorials for J2SE on www.javasoft.com

And get a good book.

There are loads listed on this site.

The one by Andrew Monkhouse is good.

The one by Kathy on SCJD doesn't show much code (in the SCJD bit)...rather it asks you to ask questions of yourself.


BTW - you should always catch CrapDesignException.

Cheers,

Si.
[ October 31, 2006: Message edited by: Simon Cockayne ]
 
Keith Jones
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Si,

thanks for that. I needed some words of encouragement.
 
Simon Cockayne
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Keith,

BTW - if you want to read a good book on OO design principles read "Head First Design Patterns"...it rocks.


Also, take comfort that there is no time limit for the assignment...so you have got plenty of time to learn what you need to learn.

Simon
 
Keith Jones
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Simon,

If there's one book I need to get which one would you recommend?

Thanks

Keith
 
Simon Cockayne
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Monkhouse
 
Keith Jones
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've ordered the head first design patterns one and will read that first then get any more that I need. Thanks for the advice.
 
Simon Cockayne
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Keith,

The Andrew Monkhouse book is pretty specific to SCJD...and does map closely to what you will need to do for this certification.


Whereas the Head First Patterns book covers OO design in general, through the medium of Patterns and it really, really, makes you think. It's well written with good examples (actually pretty funny in places too).

I reckon it is a surefire certainty that you would be a better designer for reading the patterns book.

Cheers,

Si.
 
Keith Jones
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cheers Si,

I hope to read it on the tube to work and on the loo probably. Just not enough hours in the day.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic