Is it worthwhile to implement observer pattern in PHP?

Posted by Extrakun on Stack Overflow See other posts from Stack Overflow or by Extrakun
Published on 2010-03-26T07:24:47Z Indexed on 2010/03/26 7:33 UTC
Read the original article Hit count: 413

I have been meaning to make use of design pattern in PHP, such as the observer pattern, but that I have to recreate the observers' relationship each time the page is loaded pains me. As references are saved as a new concrete objects in session, there is no way to preserve relationships between subscribers and their observers unless you use a GUID or some other properties to form a lookup, and store that property instead.

With the cost of recreating the relationships each time a page is loaded, is it worthwhile to use design patterns such as observers in PHP, compared to having a clean design? Any real-world experience to share?

© Stack Overflow or respective owner

Related posts about php

Related posts about software-engineering