Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable documentation for patterns #6

Open
augustohp opened this issue Mar 23, 2012 · 3 comments
Open

Enable documentation for patterns #6

augustohp opened this issue Mar 23, 2012 · 3 comments

Comments

@augustohp
Copy link
Member

Would be awesome to document Design Patterns as we talked earlier.
Using an annotation on the method or class that is the key point of a pattern could work well. And if somehow we could trace the dependencies of that pattern and put them into the method/class section would be beautiful.

@alganet
Copy link
Member

alganet commented Mar 23, 2012

Anyone willing to research a little bit on popular PHP projects like PHPUnit and Symfony and put up a list of commonly used patterns that would benefit us?

@iannsp
Copy link
Contributor

iannsp commented Sep 4, 2012

I'm confuse with this issue, please can someone clarify it?

@nickl-
Copy link
Member

nickl- commented Sep 12, 2012

@iannsp it is really awesome idea.

We have a @pattern annotation for example

@pattern observer

That means the test case is testing an implemented observer pattern

We have a database of known pattern with descriptions in this case we might say something like:

Observer Pattern

Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

We know this pattern has a Subject class and a bunch of Observer classes and we could link to them somehow maybe also through annotation described or by analyzing the test case.

The Subject has a subscribe/listen/register function (we can have a list of defaults as we do with folder names, and the observers have corresponding notify/trigger/update methods which we can list in the documentation.

Because the patterns are frequently similar we could in this example see that there exists a method that populates a parameter (usually single parameter but if more this is an indicator too) to a class referenced collection. This is the register function, then we follow that collection to see where it is used in a loop to get objects out and a function is called on each of these objects (or in the case where the register function had a 2nd argument these may be conditional). This is the notify method. Search all classes we can find with this method, do they reference our observer perhaps? There are many things we can try and we should try as many as we can to be more flexible. These will also grow over time as we try and solve more and more edge cases so just the basics is good enough for now to get the ball on the roll.

Does that make sense much? =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants