This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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 dave
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.
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!
Joined: Feb 28, 2002
hey, 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! dave
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.
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!