This article will walk readers through the process of outlining a flexible Object Oriented design that will facilitate adding Merchant Services and Payment Methods in the future without affecting the client code.
We have covered a lot of ground in this article. We have discussed and demonstrated the principles of loose coupling and designing for interfaces rather than implementations. We have introduced the concept of Factory methods as a way to defer instantiation of an object to an intermediary (the Factory) to allow the client to remain independent of the object creation process, which allows the client to simply request an object and get it back, without knowing what is required to create that object, or even the name of the class the object belongs to.
This could be extended into a substantial discussion about general practices of Object Oriented design, but that isn't necessary. If you found this article helpful, feel free to contact me and tell me what you liked and what you did not like. If you would like to read more about some of the design concepts we discussed, check out "Design Patterns" (Addison Wesley 1994).
David Fells is the IT Director for Turning Minds Media (www.turningminds.com). He is 23 years old and has been in the IT industry for five years. He is MCDBA and MCSE certified. He is proficient in Transact SQL, MySQL, PHP, C#, Perl, ASP, CSS, Javascript and Flash.