E-Commerce Framework Part 2
Since my previous post about the lack of an e-commerce framework generated quite a difference about frameworks, I decided to clarify and also explain some of my thoughts and ideas that an e-commerce framework should hold. These thoughts and ideas may be a little rough around the edges but I wanted to give a definition to the meaning of what I feel a framework is in this case as well as items that would potentially be a part of this framework.
The following definition adequately defines what I feel a framework should entail:
A software framework is a reusable design for a software system (or subsystem). This is expressed as a set of abstract classes and the way their instances collaborate for a specific type of software.
I feel it should be a “library” so to speak of reusable elements. These elements would then have the ability to be abstracted, extended and implemented depending on the various functionality which is a large problem within present design of many e-commerce [platforms|carts|etc].
Components should entail basis needs and then be allowed to be extended for edge cases. We are attempting to solve the basic problem, not the problem with edge cases. The problem with edge cases are handled on an individual basis and helpers could be created in order to do so (even while maintaining OOP practices).
Payment processing and courier handling are the two major components. Since they are utilized in many different services from a service oriented company to a physical oriented company or a little of both.
This would be in the form of a factory class to load the specific module, you could then create 2 sets of classes, one for the response and one for the request. Many times the request will initiate the response in the form of an API but in terms of paypal these two object may not be coupled. Both the request and response objects would either build off of an interface or an abstract class.
This is almost exactly the same as the payment handling except you would have one more class for the handling of packages. Packages can be defined by the physical boxed shipment. In the case of a shopping cart these would most likely be coupled to the items that would be for purchase depending on how the items might be packaged. Therefore we end up with a request, response which uses packages and you might have something that calculates what can fit into each package. Remember, each package might not ship at the same time and might be used over multiple couriers. So packages would most likely need an interface or abstract class to handle how each package might work.
With these objects you may want to also want to take the time to create an address object that handles users addresses so each payment gateway and courier can correctly map each address to the proper locations.
Now, if you are wanting to get into the course to fill out this framework more we can start to add items that may require the usage of different types of storage such as a db, flat file, xml, etc.
Catalog (or categories, which may display multiple times in a hierarchy)
Item (which may have multiple attributes so you would have attributes that would go out – remember items may not be physical items)
Item Package (different ways that items might be grouped together to create a single item)
Pricing (this can become extremely complex when you get to discounts and tiered rates)
User (typically containing critical user details, so this is usually up to each platform but a single baseline object may help them get speedy results)
Address (this would tie to each user if a user object was created)
There are several other items, feel free to add to this list if you feel so compelled. This is what I was meaning by a framework. No UI’s just libraries of code that allow a developer to fully customize their process without changing procedural code. I as a developer do not want to use your crappy procedural code, crappy template engine or anything else. I will handle the system the way I want to with the library as I see fit. A library/framework should help me get to the end result faster without limiting what I can do in terms of the process I would like to do a project.