Archive

- Posts Tagged ‘patterns’

What is Spaghetti Code?

Spaghetti Code refers to code written by programmers which is complex and tangled by unnecessary control structure. Source code may be using many GOTO, and other branching constructs. In large system with bunch of Spaghetti code, you change something and something happen at the other end. It is considered derogatory… (Continue)

Observer Design Pattern – Usage and Example in PHP

This is another post regarding design patterns. This time it is observer design pattern which is helpful in developing system having plugin facility and subscription based services. I will present example in PHP for Observer design pattern which is taken from Aaron Saray's Professional PHP Design Patterns book on design… (Continue)

Strategy Design Pattern – Usage and Example in PHP

Strategy design patterns is a behavioral design pattern that allow you select a algorithm from the available algorithms at the runtime. Client object can take any algorithm based on its need. It lets you choose strategy independently from client that use it. Each strategy encapsulated in itself, so client object… (Continue)

Singleton Design Pattern – Usage and Example in PHP

Singleton design pattern is useful when we need a one-of-its-kind object. Only single instance of a single pattern class is possible. This kind of class is generally useful in resource handling or in other use case where we need single instance of Object. Database connection handling is one such example.… (Continue)

Design Patterns for PHP

Design patters are needed for architect-ing large and good maintainable projects. It helps in developing software correctly and speedily. When I read these design patterns I thought that these design pattern are not very useful. Still after reading some of the design patterns in short many of them was good… (Continue)