This page covers:
Plan Before Starting the Project
Guestbook Considerations
Our Guestbook Plan
Plan Before Starting a Project
Proper development on any kind of project requires you to stop
and evaluate the project before development begins (hopefully long before, but that's not
always the case). And while this is tried and true and recommended universally, it still is a
difficult thing to do. I like to code and solve problems. Planning before I code is something that
I had to learn and I force myself to do. On all projects, big and small, paid for or not, personal
or other, I now write out a plan for virtually everything I code. It's habit now, and it's a good habit,
and helps me to manage my time more effectively.
Guestbook Considerations
Having said that, let's figure out what we want the guestbook to do. What's the guestbook for? In this
case, it's simply to let users view other visitor's comments and to add their own. The guestbook
is not a stand alone application - well it is, but it exists in the context of the web site, so we need
to take into consideration:
- Where will the guestbook be placed on the site?
- How will users be referred to it?
- Why do we even want it on the site?
- What expectations/predictions do we have of the data we expect to receive
and what are its potential advantages and uses?
- What will the page look like?
- Other business & user interface considerations include:
- What information do we want to ask of users?
- Does the site have registered users? If so, does a user need to be logged in to sign the guestbook
or are anonymous guestbook entries acceptable?
- How many pages will we have for the guestbook? Will the form to add entries also be on the same
page that displays users' guestbook entries or will they be two separate pages on the web site?
Then once we have the business questions answered, we need to ask the technical questions:
- Where will we store the user entries? In the database or a flat file?
- If database, what is the database structure (how many tables, fields, datatypes, etc)?
- If flat file, what kind (txt, XML)?
- What technology (PHP, ASP, Perl, Python) will you write this application in?
Often, most of the technologies decisions have already been made - for example in this case, we'll use
PHP with the MySQL database because this happens to be an exercise in using those two technologies.
And once the business decisions are made, the technical issues are often easy to figure out. A
use case or a simple flow diagram is very useful as well.
Our Guestbook Plan
I have answered all the questions above here so you can see how these decisions affect decisions
made later on:
- Guestbook will be located here in the site directory structure (/scripting/php/guestbook)
- There will be a link in scripting section of the web site to the guestbook (this entails inserting a
new row into the database)
- We're putting it on the site to obtain user feedback and to write an example for others to learn from
- I expect most of the data to be test data from users trying out the application. I do not anticipate
I will use any of that data for any other purposes
- The page will use the site template all the other pages do.
- We will ask the user for name, email (optional), and his guestbook entry, we will also save the
date and time of the comment but will not be asking the user for that information.
- This site does not have registered users. Anonymous posts are fine.
- The form to add new entries, and existing content will be placed on one page.
Now let's create the database and write the code...