I am rebuilding a website that I am running that provides tide tables. I am doing this with the Zend Framework and trying to make it as objective as possible. I was thinking about the thread / process that will occur when a visitor requests a tide table by location and how it returns.
I came up with two different types for using objects that will help in this process. The first is basically a helper object that uses the Zend Framework. The second is a data object (due to the lack of a better word) for encapsulating data that is transferred between helpers. Here's a rough idea of โโthe stream I'm thinking of:
- RequestHandler
- Gets the array for the request from the site controller or from the api controller.
- Creates a "data object" called QueryData strong> and populates it with all the information about the query.
- Skips the QueryData strong> object to the LocationHandler .
- Returns the ResponseData strong> object that was returned to it from the LocationHandler .
- Locationhandler
- Gets a QueryData strong> object from RequestHandler
- Searches for a location and creates a LocationData strong> object to store it.
- Skips QueryData strong> and LocationData strong> objects for various helpers, such as TideHandler or WeatherHandler , that return specific data for the initial query.
- Returns an array of ResponseData strong> objects that contains the responses returned to it from each specific helper (TideHandler, WeatherHandler, etc.).
- Tidehandler
- Retrieves QueryData strong> and LocationData strong> Objects from LocationHandler .
- Does tidal data search work using data objects. Creates a ResponseData strong> object to save it.
- Returns ResponseData strong> in LocationHandler .
By doing everything this way, I get the โplug and playโ OOP approach, which allows me to add to this a lot easier (I think?). Sorry for the long explanation leading to my question ...
Question:
Is it common practice to encapsulate data sets in an object (rather than an array), which should be passed to other objects that perform functions on it and send new / changed objects? What are some other solutions or templates that provide the same level of functionality and flexibility?
source share