File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes program design and coding style Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "program design and coding style" Watch "program design and coding style" New topic

program design and coding style

david russell

Joined: Feb 28, 2002
Posts: 14
hey folks,
i was wondering if anyone has any tips on the best method of designing a program. i have a set of requirements and i know fuctionally what the program will do,im just not sure where to put the code, and what should be classes and methods and so on.
does anyone have any tips or preferences for designing/laying out of code?
all feedback is greatly appreciated
Mark Herschberg

Joined: Dec 04, 2000
Posts: 6037
This is a general programming question, I'm moving it to Java In General (Beginners).
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Whole books and entire courses are devoted to this topic, and you want it summarized into one post?
The standared answer is
- Look for the "nouns" and make classes out of those
- Look for the verbs and make methods out of those
But of course that is greatly simplified, and if you stick to that TOO closely you miss the big picture.
Jennifer Bhamoo
Ranch Hand

Joined: Mar 09, 2002
Posts: 47
I highly recommend that Just Java book (which JavaRanch also recommends).
I just happened to have that book before I started coming here and it explains everything very nicely. Do you have a programming background? I think this book may be a little confusing if you don't have any programming background, but not sure. Good Luck!
david russell

Joined: Feb 28, 2002
Posts: 14
i do have a little experience writing java programs, especially for the j2me spec. ive found a good example of how to lay the code out now, i just have to get on with it!! any tips would still be appreciated though!
David Duran
Ranch Hand

Joined: Feb 11, 2002
Posts: 122
If you're in no rush, writing out your program in pseudo-code, on paper always seems to help. Again, if you're in no rush, planning out the structure of your program, the type of data structures you might want to use, the logic, etc. is always helpful before you actually sit down and write code.
Of course, people depending on you for that program frown when you show them oodles of paper but not one line of code in a program, hahaha.
John Spindler

Joined: Feb 12, 2002
Posts: 28
I am reading Jacquie Bakers Beginnin Java Objects and currently reading on how to layout static diagrams, sequences diagrams. All of this is being done in UML and I can't stress enough how much it brings your code together and the best part is while your modeling your code you can change it a billion times over without ever having to worry about reconstructing your code. If you model it writing the code will only take you time because everything else is already figured out!
I agree. Here's the link:
subject: program design and coding style
It's not a secret anymore!