Like the good developers we are we will kick of things by defining some requirements to help us in the design process.
But first some definitions.
Controller: PHP Script that directs receives and responds to requests
Worker: PHP Script that carries out resource/time intensive task
Model: PHP Script that provides the data framework. This can be anything from file system to the DB connection.
With that out of the way here are our requirements:
- System must respond within 5 seconds
- Controllers must not under any circumstances run for more than 30 seconds CPU time.
- Controllers should be able to report progress
- Controllers must be able to run on shared hosting service
- Workers must be able to operate independently.
- Workers should never have to interact with the file system.
- Workers should be easily exportable
- Workers should be RESTful
- Workers should have one verb to accept work. Common convention is to call this verb fire or index.
- Model must never return system resource handles
- Model must provide expected value types even on failure
A fair lot of the requirements are self explanatory. If you would like me to expound some more on any of this please comment as much below. Otherwise it will become obvious why we have the requirements in a bit.
Next article we will look at a sample work flow and the request life cycle. We will also get to see the relationship between the objects in our system.
by Jacob Chencha