|
|
|
|
|
|
|
Third, const methods are already identified; this is part of the interface, not the implementation. Finally, a new data type is implied: pID. Defining pID as a type rather than using, for example, unsigned long puts greater flexibility into your design. |
|
|
|
|
|
|
|
|
If it turns out that you don't need an unsigned long, or that an unsigned long is not sufficiently large, you can modify pID. That modification will affect every place pID is used, and you won't have to track down and edit every file with a pID in it. |
|
|
|
|
|
|
|
|
For now, you will use typedef to declare pID to be ULONG which, in turn, you will declare to be unsigned long. This raises the question: Where do these declarations go? |
|
|
|
|
|
|
|
|
When programming a large project, an overall design of the files is needed. A standard approach, one that you will follow for this project, is that each class appears in its own header file, and the implementation for the class methods appears in an associated .CPP file. Thus, you will have a file called OBJECT.HPP and another called OBJECT.CPP. You anticipate having other files such as MSG.HPP and MSG.CPP with the declaration of pMessage and the implementation of its methods, respectively. |
|
|
|
|
|
|
|
|
THE BUY/BUILD DECISION Buy it or write it? One question you will confront throughout the design phase of your program is which routines you might buy and which you must write yourself. It is entirely possible that you can take advantage of existing commercial libraries to solve some or all of your communications issues. Licensing fees and other non-technical concerns must also be resolved. |
|
|
|
| | It is often advantageous to purchase such a library, and to focus your energies on your specific program rather than to reinvent the wheel about secondary technical issues. You might even want to consider purchasing libraries that were not necessarily intended for use with C++, if they can provide fundamental functionality you'd otherwise have to engineer yourself. This can be instrumental in helping you hit your deadlines. |
|
|
|
|
|
For a project as large as PostMaster, it is unlikely that your initial design will be complete and perfect. It would be easy to become overwhelmed by the sheer scale of the problem, and trying to create all the classes and to complete their interface before writing a line of working code is a recipe for disaster. |
|
|
|
|
|
|
|
|
There are a number of good reasons to try out your design on a prototypea quick-and-dirty working example of your core ideas. There are a number of different types of prototypes, however, each meeting different needs. |
|
|
|
|
|