Most of these tables now only have an ID, Name, and Primary Key. We need to give them functional elements by adding Design Patterns.
The UML schemas for these Patterns can be found in Chapter 2, Architectural Patterns and Chapter 3, Design Patterns.
In this example application, we need the Setup table to store the Number Series for the Stay table. Other than these, we don't have fields to add anything to this table.
Here's how I usually put table definitions in design documents:
Field No |
Field Name |
DataType |
Comments |
---|---|---|---|
1 |
Primary Key |
Code10 |
This is the Primary Key for this table |
20 |
Stay Nos. |
Code10 |
This provides the Table Relationship to the "No. Series" table |
If you need any elaborate descriptions of validation rules, you can add them as bullet items underneath the table.
Using the Supplemental Architectural Pattern, we already have a Code and Description field. This is all we need for the Season table.
We will add three entity state fields to the room table—Blocked & Clean Status.
Blocked will prevent us from making a reservation for the room or create a new stay. This entity state field is editable.
Clean Status will be an option field with the values—Clean
, Cleaning
, To be Cleaned
. These status values will be managed by methods on the table. The field is non-editable.
We will also add some flow fields to the table to see whether there is an upcoming reservation, and whether the room is vacant at the moment.
The price calculation will be a method on the table.
We will just add some fields to the table to indicate the cleaning date and the cleaning type. The entry table does not contain business logic, and is managed by the Room tables' methods.
The Entry No. field is updated using the AutoIncrement property.
This table will also implement the Number Series, and we will reference the Customer and Room table.
The Stay has a Check-In
method. When checking in, we can apply the Stay to a reservation. For a Stay at a B & B, a reservation is mandatory. We will implement a method to create a reservation from the Stay.
We will also implement a Price
field that is calculated using a method on the table that uses the method on the Room.
We can end the stay with the Check-Out method, which will create the Sales Invoice and the Evaluation. Both will be encapsulated in their own methods.