Changes
Creating the Initial Framework
(1) Set Up Initial Framework
This change sets up the configuration files
config and the recipe file
Howto.cook.
(2) Populate Initial Framework
Here, we add some of the code created in the
exercises before the project work started.
hints tests
The Foundation Classes
(3) Upgrade Base.h
We will replace Base.h and Base.C with a smarter version. The main
difference is that read(), write(), readContents() and writeContents()
now return an IOstatus value. Therefore, the implementations of these
functions in the other classes (Game, Account and Dice) need to be
modified. Simply have them return ok. Obviously, the
declarations need to be changed also.
hints tests
(4) Create the List class
Create a cyclic double linked list.
hints tests
References and Indices
(5) Extend the List class
Extend the List class to include a working copy constructor and an
assignment operator. The test will also extensivly check out your
destructors, to make sure there are no memory leaks.
hints tests
(6) Create the Key class
The Key class will be used to identify items in a list. A key
consists of a single word with no white spaces. You need to implement
the copy constructor, assignment and comparison operators and, of
course, a default constructor with an optional string argument as
initializer. A key with no value shall have the special string
<nil> assigned to it. The tests will again check for memory
leaks. Watch it!
hints tests
(7) Create the Index class
The Index class is a derivation of the List
class. An Indexable is a Listable that has a
Key. An Index is a List with search
functions. Note that we are now above the low-level memory management,
and we can rely on our previous efforts. In fact, the Index
class has no data elements at all!
hints tests
Pointers
(8) Create the Pointer class
The Pointer class is an abstraction of a C pointer. Since it
doesn't make much sense to save memory locations on a file, we will
use the Key class to identify the object which the pointer is
referencing. In order to retrieve the object, we will assume that the
object is in an Index, and store a pointer to that
Index. Since we know which index a pointer will refer to, we
do not need to write and read that information. It will be enough to
supply that information to the constructor.
hints tests
(9) Support the Static theGame Pointer in Base
Change the constructor of Game to properly initialize the
Base class.
hints tests
(10) Review and Tighten Code
Use this change to review and clean up your code. This change should
be done by the project team member with the least amount of
developed changes.
hints Regression tests only
(11) Add const and Remove Tests
Make member functions safer to use by adding the const
keyword wherever it is useful. Remove all tests. DO NOT modify any
code (except for the const keywords, of course).
hints No tests
Deeds
(12)Create DeedIndex and add it to Game
We have a little "chicken and egg" problem here. In order to define
Deed, we need to be able to point to other deeds, but our
Pointer class needs an index to point to. So, we need to
define DeedIndex, which, of course, requires
Deed. Fortunatly, we can break the cycle by creating a
stupid stub for Deed and its derivatives, which we
shall do right here.
hints tests
(13)Create Deed, DeedPtr and DeedPtrList
Note how we can now overload pointer operators (*, ->)
hints tests
(14)Create PropertyDeed
hints tests
(15)Create StationDeed
hints tests
(16)Create UtilityDeed
hints tests
Cards
(17)Create Card and CardTypes
No chicken and egg problem here, since we are postponing the
implementation of the execute() virtual function until all
game objects are defined. CardTypes actually contains the 8
different classes of event cards in one set of files.
hints tests
(18)Create CardIndex
This change is almost identical to change 12.
hints tests
(19)Create CardPtr and CardPtrDeque
CardPtr is practically identical to DeedPtr in
change 13. DeedPtrDeque has a little twist
added: the only public member functions here are: taking a card off
the deque and putting it back.
hints tests
(20)Create game.data and modify Game
Our monopoly program is starting to take shape... we now have a
substancial database of monopoly components...
hints tests
Spaces
(21)Create Space and SpaceTypes
Almost identical to Change 17.
hints tests
(22)Create SpaceLoop
Almost identical to Change 18. One little twist is
in the next() and prev() member functions that need
to be added to the Space object.
hints tests
(23)Create SpacePtr and modify Deed
Almost identical to Change 19, except that we now
have to modify a previously defined class to use our new object.
hints tests
Players
(24)Create Player
You are on your own here.
hints Regression tests only
(25)Create PlayerPtr and modify Deed
You are on your own here.
hints tests
(26)Create Bank and modify Game
Game should now only contain pointers to objects.
hints Regression tests only
How to finish...
Christian Goetze