[workshop-lite] lesson 01: the spec

Michal Wallace michal@sabren.com
Thu, 9 May 2002 03:23:26 -0400 (Eastern Daylight Time)


# lesson 01: The Spec

* Jumping In

I changed my mind. Instead of talking theory for the first ten
lessons, let's start with a real app.

My current project is a control panel for cornerhost. The idea is to
give customers more power over their accounts, and cut back on the
number of routine support tasks I have to handle personally.

I'll try to focus on the technology and the development process, and
gloss over the control-panel-specific details. Still, it's important
to know where you're going, so let's talk a bit about how the app will
be laid out.

* N Little Tiers

When I build a web app, it usually has several tiers:

   - a SQL ("sequel") database
   - a reusable object-relational mapper
   - an object model
   - the program logic
   - HTML (or XML) templates 
   - CSS, Javascript, and other client-side stuff

Sometimes, you have more or fewer tiers, so it's called
n-tier for short. Here are two things to remember about n-tier
applications:

   - A tier should talk only to the tiers directly 
     above or below it. (For example, 

   - Don't blur the edges. (For example, keep SQL out
     of your python, and keep python out of your HTML)

It's often extra work to follow these principles, but 
if I ignore them (eg, writing a quick script with everything 
in one file) I  almost always have to go back and clean up.

The control panel, we'll be dealing with each of these
tiers. We'll look at each in detail later. For now, let's
consider the requirements.

* Expect to be Wrong

I like to design my apps up front, so I know where I'm going,
but I also know that as I work, I'll keep coming up with better
and better ideas. So I'm happy with a rough design.

Basically, I want to know:

  - What should the app do?
  - What's the simplest way to make it work?

Whatever answers we come up with, we'll probably be wrong
about some things. That's okay. If we're good, we'll make
sure our software is easy to change as we go along. That
means we can get started with a very rough idea.

So.. On to our two questions.

* What should the app do?

I'll probably add to this list eventually, but here are the most
important features of the control panel. (They're most important
because they're the most common requests I get):

   - Add/Edit/Delete websites (domains)
   - Add/Edit/Delete email aliases
   - Show billing information (balance, history, etc)
   - Logfile Analysis (this part's mostly done)

Finally, I want it centralized. In other words, there's one
control panel and it manages accounts all the hosting machines.
So we'll also need a secure way to communicate with those machines.

* What's the simplest way to make it work?

The front end of the control panel will be your basic web app.
There will be a login page, and several forms that ultimately 
control records in a database.

That's the easy part, and using python and a good web framework,
it's less work than you might think.

Then there's some scripts that generate configuration files
for the web, DNS, and email servers. I've already done a lot
of the work here: I've been tweaking my command-line python 
tools for the past few months.

Since these scripts require restarting various long-running
programs (like web and email servers), it's important to 
make sure that changes are queued up and done in batches.
This will require some sort of periodic scheduler. 

Finally, to communicate between the control panel and the
actual servers, I plan to use a custom XML-RPC server on
each machine. (Again, python makes it easy.)

* Let's go!

As far as software specs go, this was pretty painless.
Still, it's enough to get started. In the next lesson,
start writing code.

----------

(c)2002 sabren enterprises inc
feel free to forward this to a friend!

archives at: http://webAppWorkshop.com/
discussion list: http://www.cornerhost.com/mailman/listinfo/workshop
lessons only: http://www.cornerhost.com/mailman/listinfo/workshop-lite