SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 101 | Next

Hasin Hayder

"Object-Oriented Programming with PHP5"

Now you want to develop a Facade using all of them
and provide an easier interface for developers. See how easy it makes combining
three of them:
class Facade
{
public function findApartments($place, $divid)
{
$AF = new ApartmentFinder();
$GL =new GeoLocator();
$GM = new GoogleMap();
$apartments = $AF->locateApartments($place);
foreach ($apartments as $apartment)
{
$locations[] = $GL->getLocations($apartment);
}
$GM->initialize();
$GM->drawLocations($locations);
$GM->dispatch($divid);
}
}
?>
Chapter 4
[ 95 ]
Anyone can now use the service of all three classes using only one single
interface Facade:
$F = new Facade();
$F->findApartments("London, Greater London","mapdiv");
?>
As I said before, in object oriented programming we have done this type of job
several times in our times in our project, however we might not have known that the
technique is defined as a design pattern named Facade.
Summary
Design patterns are an essential part of OOP. It makes your code more effective,
better performing, and easier to maintain. Sometimes we implement these design
patterns in our code without knowing that these solutions are defined as design
patterns.


Pages:
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6