Thứ Ba, 11 tháng 8, 2015

Design Patterns: The Facade Pattern

When it comes to design patterns, you may have questions:

Why should we use design patterns in programming? Our code can work just fine without it.
To that, my counter question would be: "Would you rather live in a luxurious home, or in a simple establishment with four walls?" After all, both serve our purpose.

Generally, we look for a luxurious home because it offers better facilities and requires less maintenance, and maintenance can done with less hassle because the basic groundwork is already there.

The same thing applies to programming: Code that employs design patterns is easy to understand, easy to maintain, and easy to extend.

In this series of tutorials, we will cover some different design patterns that are available to us in programming. You'll learn about their pros and cons, and factors that indicate where we should use them.

Throughout these tutorials, I will take PHP as a base language to demonstrate design patterns; however, they are actually a concept that can be applied to any programming language—it's just a matter of changing the syntax as per your preferred language.

Design rules are separated into four categories:

creational patterns
structural patterns
behavioral patterns
concurrency patterns
In this tutorial, we are going to cover the facade design pattern. It falls under the category of structural patterns because it deals with how your code should be structured to make it easily intelligible and keep it well maintained in the long term.

Facade Design Pattern
The UML


Share

& Comment

0 nhận xét:

Đăng nhận xét

 

Copyright © 2015 PHP Scripts - PHP Sources Libraries

Designed by Templateism | Thiết kế website