Developing a project in Java




Developing a large scale program isn't easy. It's always going to take alot of work, but hopefully some of this advice might make it a little easier.

Learn the Language

Firstly, you should know the language you're developing in very well. Get yourself a good up to date book learn it. 'Java, How To Program' (3rd Edition), Deitel & Detitel should cover most of what anyone needs. Also recommended is Bruce Eckel's 'Thinking in Java' (2nd Edition) - download from www.BruceEckel.com. It's essential to know what that language can and can't do. Rather than hitting a brick wall when you run into a problem, knowing the inns and outs of a language will often provide a solution. If you're aware of all the capabilities of a language you'll save yourself a lot of development time. You'll also probably have a far better idea of what a compiler or run-time error is chatting about.

Good Design

Spending a fair amount of time designing your project is crucial to its success. Although it's tempting to just start coding so you feel like you're doing something, that's destined to end in tears if you haven't got a proper plan. Know exactly what your program is going to do and how it's going to do it. Have a list of every class and the methods the classes will provide before starting to code. Have a diagram showing how the classes relate to one another. Make good use of object-oriented design, but don't go over the top. Using polymorphism just for the sake of it when a simple switch statement would do doesn't make sense.

If you're not familiar with object-oriented design, 'UML Distilled' (2nd Edition) is a concise and informative overview of this methodology. It uses the Unified Modelling Language - an industry standard - to describe the object-oriented process. Being familiar with the UML should make a big difference to your project design.

For any sizeable project, learning about the Model-View-Controller paradigm is going to be a worthwhile investment of your time. The MVC model allows you to seperate your GUI from the classes that hold the data - the model. You'll find some helpful Java oriented articles on employing the MVC model at www.javaworld.com and http://ootips.org .

Inevitably, no matter how good your design is, certain aspects of your program will only become apparent when you start coding. When this happens, some re-design becomes necessary. Don't worry - 'Design a little, code a little, review and repeat' - using this should go a long way towards a successful project.

Everything is Wrong

No program is going to go from inception to completion without problems (possibly a lot of them). You can find the answers to the most common problems and questions in the Java FAQ. If that's not up to date, try looking at it here instead. Sun's Java Tutorial has sample code galore plus loads of ideas and tips on how to do stuff.

If you can't find the answers you need there, try posting your question to:
comp.lang.java.help

There are lots of specific newsgroups too:
comp.lang.java.gui
comp.lang.java.databases
comp.lang.java.misc
Plus a fair few more. You should be able to find all the help you need, or most of it anyway, from there.

A common cause of programming problems is logic errors. Logic errors are errors usually caused by an oversight on the programmers part. They can cause your program to exhibit unexpected behaviour or return incorrect data, or they might cause your program to crash. Some logic errors are very subtle and can be difficult to find. Debuging enables you to find and eradicate your logic errors, but unfortunatley debugging can be a complicated process itself. An effective debug strategy is presented by Patricia Shanahan at www.concentric.net/~Pats/debug.

Finally, if you're trying to do something and you reckon it's the kind of thing someone might have done before, well then, someone probably has done it before. Before writing your own class, have a look through the Java API to make sure you're not re-inventing the wheel. You could also take a look at the Giant Java Tree . You'll find lots of all sorts of classes here, although finding the one you're looking for mightn't be all that easy.

Troubleshooting

Menu
Last updated August 15th 2000