Applying Design Patterns

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.

The Bed and Breakfast setup

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.

The Bed and Breakfast setup

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.

Bed and Breakfast season

Using the Supplemental Architectural Pattern, we already have a Code and Description field. This is all we need for the Season table.

Bed and Breakfast season

Bed and Breakfast room

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.

Bed and Breakfast room

Bed and Breakfast price

Implementing the Rules Pattern provides us with all the required fields for the price calculation.

Bed and Breakfast price

Bed and Breakfast clean entry

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.

Bed and Breakfast clean entry

Bed and Breakfast stay

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.

Bed and Breakfast stay

Bed and Breakfast journal and entry

We use the standard Journal Pattern for the Bed and Breakfast reservation process. This means we have three tables for the journal: an entry table and a register table. We won't use the recurring feature or the detailed entries.

Bed and Breakfast journal and entry

The Bed and Breakfast evaluation header and evaluation line

The Evaluation table will reference the Stay table, and inherit the Customer and Room information. We will add an Entity State field, indicating that the evaluation is completed.

The Line table will contain a description and an option field.

The Bed and Breakfast evaluation header and evaluation line
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset