udexter udexter - 1 year ago 111
PHP Question

In PHP what means: factory, instance and observer?

In PHP, what means: factory, instance and observer?

Thank you!

Answer Source

observer and factory

observer and factory are two design patterns within object oriented programming. gang of four (or gof) are usually attributed the creation of these patterns. they have a book, i believe it's with implementations in c++. i haven' read it, i heard it was kind of heavy to read. however, i did read "head first design patterns", and that's a really good book! still high level stuff though, maybe for someone who has been programming for a year or so.


an instance is something concrete. instance is to class what an employer is to its profession. the profession is a way of describing something that workers with that profession does. a job description so to speak. the worker then actually performs the work in question.

correlation between factory and instance

being a worker of a factory profession means that you have the responsibility of creating workers of some other, probably more complex, profession. or maybe the profession itself isn't very complex, but the process of creating a worker of that profession is complex.

important final note

all these terms are valid and interesting within all object oriented languages, like for example php, java, c# and c++, and many more.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download