News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPMaster.com:
Subtype Polymorphism - Swapping Implementation at Runtime
September 17, 2012 @ 12:48:52

On PHPMaster.com there's a new tutorial from Alejandro Gervasio about subtype polymorphism. It sounds a little scary, but really it's just a look at sub-objects that inherit from parents and how to swap them around at runtime to do different things.

In this article I'll show you how to exploit the virtues that Polymorphism offers through the development of a pluggable cache component. The core functionality can be expanded later to suit your needs through the development of additional cache drivers.

He starts off with the definition of an interface to provide structure to the sample application (the CacheInterface) and implements it in two different subtypes - a FileCache and an AppCache (using the file system and APC, respectively). He builds on these and creates a "View" that uses these caching systems to generate and save the output to a cache for use later in the execution.

0 comments voice your opinion now!
subtype polymorphism tutorial interface abstract caching


blog comments powered by Disqus

Similar Posts

Zend Developer Zone: ZendCon Sessions Episode 040: Memcached: the better Memcache interface

9Lessons: User Signup using Facebook Data

The Bakery: Six New Articles/Tutorials Posted

Community News: PHP Tutorial Site - GoodPHPTutorials.com

Brandon Savage's Blog: Bug-Free: Your Bug-Fixing Toolkit (Part 1 of N)


Community Events





Don't see your event here?
Let us know!


series interview list api release code introduction laravel symfony2 opinion testing developer install unittest framework language podcast refactor community threedevsandamaybe

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework