Michael J. Fuhrman
1. Overall Scope:
This blog series demonstrates how to use Ladder to create an Appointment Calendar. Its goal is to provide readers with a clear understanding of how to build a simple application using reusable components based on Ladder’s data management capabilities. Future articles will rely on these concepts to build larger applications.
The Appointment Calendar demo will extend two classes of Ladder: the Item and the Folder data class. The Item class is used to manage the Appointment Information and is akin to a row in a SQL table. The Folder class will manage where all the appointments are stored in the Ladder tree, and is akin to a SQL table .
At the completion of this article, the reader should have a functional appointment calendar and an understanding of how to use Ladder .
Covered in this series:
1. Overall Scope
2. Reader Requirements
3. How Ladder Works
4. Appointment Calendar Requirements
5. Appointment Calendar Design Guides
6. Appointment Data Class Design
7. Create the class install script
8. Create an Appointments Folder in Ladder.
9. Create the Appointment data classes
10. Designing the Appointments Presentation
11. Implementing the Appointment Presentation
12. List Appointments by Date
13. Directory Layout
14. Review & Follow up.
2. Reader Requirements
This demonstration requires:
- PHP 4.5 or higher
- Ladder for PHP
- Apache or IIS web server
- mySQL 5.0 or higher
Ladder for PHP was specifically designed for mySQL. Ladder for PHP will work with other SQL servers ; however it will require changes to the install scripts. Each SQL's server's method of creating tables and indexes is unique.
Note: This post is written for PHP 4.5, abstraction was not introduced until version 5.0.
Note: It is recommended that Ladder be installed into a separate database partition so that tables it creates do not conflict with existing or future tables.
3. How Ladder Works
Ladder resides at the bottom of the Business Logic Layer and above the Data Layers. This area is known as known as the Data Management Interface. This interface marries the Data Classes in the Business Logic Layer with the SQL server tables. This interface controls the storage, retrieval and relationships of objects. Most applications usually build a custom set of classes for every application, and when the application changes, so does this layer.
Ladder abstracts the Data Management Interface, providing a consistent set of classes to manage the storage, retrieval and relationships of data. It does this by classifying data based on three basic data types: [ Folder | Item | Reference ]. This provides programmers two powerful tools: 1) Business Logic object models can be represented directly into the store. 2) Data stored in Ladder acts exactly like the directory folder structure of a hard drive.
Folders can contain any data type. Item data types only contain properties - field values. Reference data types point to Folders. These three data types create a hierarchy which gives Ladder its name and work like a file structure. The hierarchy is used to organize complex data relationships while separat ing the data from the relationship.
What this means to programmers is that less time is required to build and debug data relationships when Ladder is used. And what this means to designers is that less time is required to design and test an application where the Data Layer uses the same model as the Business Logic Layer.
4. Appointment Calendar Requirements:
The first part of application development is to identify the requirements for the application. The Appointment Calendar has a few general requirements:
- Appointments are listed by day
- The List can be refreshed by the user
- The List is refreshed every time an appointment is Added, Deleted, or Moved
- Appointments are added in a separate page
- Appointments are edited in a separate page
- Appointments can be viewed in a separate page
- Appointments do not need to repeat
The requirements for the Appointment Calendar application set the stage for the Design and Implementation of the appointment calendar.
5. Appointment Calendar Design Guides:
In Application Programming, there are three layers: Presentation, Business Logic, and the Data Layer. By outlining how these layers could look, the designer can guild the implementation of the application , and determine whether the implementation will meet the requirements and fit in the overall scope of larger projects.
- The Business Logic layer focuses on managing the data in memory. (PHP, ASP, Java, C#, .Net, VB, ...)
- The Data Layer focuses on all the data placed in secondary storage – ie a SQL server. (SQL)
The design of the Appointment Calendar will be done based on general requirements for an appointment. Also known as design patterns.
- Display a simple calendar for the week, and allow options to navigate between Previous / Next week, month and year, as well as return to the current date.
- Provide a consistent set of navigation links for the calendar
- Provide a consistent view for displaying the calendar entries in the list, new, edit and view pages.
- Moving an appointment to a different date should seem obvious
- Components of the presentation should be reusable and follow a consistent design format.
- The object model for an appointment will consist of the following fields: Date Target, Appointment Start Time, Appointment Length and Memo field.
- This will be managed by Ladder. Therefore no work here is needed at this time.
The designing the Appointment Calendar application is very simple. It requires a calendar, a list of appointments by day, and the ability to create, delete, view, update and move appointments . At this time, it appears that most of the work will be performed in the presentation layer to manage the user experience.
The next step will be to design the Data Class for the Appointment Calendar.
6. Appointment Data Classes Design:
While there are several types of appointments and fields that can be used to capture their data, the most common type of appointment only repeats once. And the requirements for this project request that appointments do not repeat .
Based on the design documentation, the appointment needs to capture the date of the appointment, the time that the appointment begins and ends, and a message about what the appointment is about.
The Appointment Item Data Class will need the following fields:
01.. dTarget DATETIME
02.. nTime INTEGER
03.. nLength INTEGER
04.. szMemo STRING
Line 1 .. captures the date the appointment is to occur.
Line 2 .. captures the time that the appointment is to occur on that date.
Line 3 .. captures the length of the appointment. The increments of the appointment length can vary, usually most people don't have less than 30 minute appointments. However if needed, 15 minute increments have been seen.
Line 4 .. captures the content of the appointment, ie .. what is happening at this time.
This design information will be used later when we construct the class description for Ladder, and design the PHP Classes for these data classes.
This blog post covered some basic concepts on how and where Ladder works within an application. It developed simple requirements and design guides for an Appointment Calendar project. And it designed the data model that would be used to contain the Appointment data.
The next post will describe how to extend the ldrFolder and ldrItem classes so that PHP classes for Common_Appointment and Common_Appointments can be created.
Copyright 1998 - 2010 - E Net Arch
This program is distributed under the terms of the GNU
General Public License (or the Lesser GPL).
No comments were submitted yet.