Comments (27)
+1
Especially about moving tests closer to examples
It is hard to look at same code in one place, then navigate somewhere to find tests to see how it can be used
It is good practice to put tests in separate folder and get separate autoload-dev for them for real projects but for this one it will be probably more usable to get it all as coloser as possible to each other...
As about pattern categories there can and probably will be some kind of troubles when some pattern can be in both places
from designpatternsphp.
Oh yeah, easy to read and navigate!
About pattern in two or more categories, can you give a sample?
I don't remember any one π
from designpatternsphp.
@domnikl ping
from designpatternsphp.
I'm against the categories, but move tests closer is really good idea.
from designpatternsphp.
π for moving the patterns into the categories folders and moving tests closer. What do you think of having a tests
and src
in each pattern dir, like this:
|-- Creational
| |-- Factory
| | |-- src
| | |-- tests
from designpatternsphp.
I think that there is no need in src
and tests
subfolders because there is only one test file usually, so it will obviously be better to have something like this:
|-- Adapter
| |-- AdapterTest.php <-- test file moved to source
| |-- Book.php
| |-- EBookAdapter.php
| |-- EBookInterface.php
| |-- Kindle.php
| |-- PaperBookInterface.php
| |-- README.md
from designpatternsphp.
@domnikl I agree with @mac2000, no need it, because this repo is only for learning about patterns and give implementation samples.
So, all involved agree to move tests closer of implementation.
For now, create or not create Category Namespace? is the question. π
from designpatternsphp.
As I think if there is no cases when one pattern can be in two categories (I do not know such patterns) then moving them to category folders with its own Readme.md will be ok, since it can contain more specific description about this group without bloating main readme.md of repo
from designpatternsphp.
+1
It sounds good for me, @mac2000
Category folder with its own README.md
So, the final proposal is:
|-- Creational
| |-- README.md
| |-- Factory
| | |-- README.md
| | |-- SampleClass.php
| | |-- SampleTest.php
from designpatternsphp.
@mac2000 @domnikl @johnikx what are you think about the last proposal?
from designpatternsphp.
@tonicospinelli I love it, but I would want to wait until the three new patterns are merged.
from designpatternsphp.
@tonicospinelli Let's do it!
from designpatternsphp.
+1
from designpatternsphp.
no problem, I wait and implements the new patterns
from designpatternsphp.
@tonicospinelli π
from designpatternsphp.
offtopic: but Since you guys are restructuring folder structure, how about...
A Client class inside each patterns folder, with some sample code on how to show the patterns usage from a clients perspective?.. would be a plus.
from designpatternsphp.
Although having a "real-world" implementation is always a good idea to relate the code to a use-case I think that the pattern source code along with the README.md (which I think will have a description of the use of the pattern) would suffice [what I mean: the efforts should be first on the pattern source code and the README.md file, then perhaps do a(several) real world example(s)...].
+1 on the structure and kudos for the repo!
from designpatternsphp.
+1
from designpatternsphp.
@axelitus is the exactly idea about the restructure.
I liked your suggestion to create different samples of each design pattern. So I think is nice create a README.md
to explain the sample implementation.
|-- Creational
| |-- README.md
| |-- Factory
| | |-- README.md
| | |-- Sample1
| | | |-- Class.php
| | | |-- Test.php
| | | |-- README.md
Anyone disagree?
from designpatternsphp.
Isn't test show usage example (look at adapter pattern)
I am afraid that there will be real mess if there will be 100500 examples repeating each other, can you please provide some real world examples of that Sampl1...N
from designpatternsphp.
I think the same as @mac2000, there will be too much examples. Why would someone go through more than one implementation to learn about the pattern? Why isn't one sample enough? What are the advantages of adding more than one?
from designpatternsphp.
For me no problem to have one example for a pattern. It's a new proposal only.
So, thinking about it, I believe we take care to accept PRs with not real situation/implementation like Bridge.
That implementation is really superficial and not show where or why I should implement it. Symfony implements a Brigde very well to provide integration with Doctrine.
DoctrineBrigde
What are you think about it?
So, thinking on it, I believe that is a rule to accept PR than to discuss in this issue π
from designpatternsphp.
I'd say that one, carefully selected, most understandable and "self-describing" example per pattern is ample. Other, not so common and/or less understandable examples can be listed in read me.
I'm for this:
|-- Creational
| |-- README.md
| |-- Factory
| | |-- README.md
| | |-- Factory.php
| | |-- tests
| | | |-- FactoryTest.php
from designpatternsphp.
π for @johnikx proposal.
@tonicospinelli then why not add DoctrineBridge to the Readme.md
of the bridge pattern as in the other patterns?
from designpatternsphp.
@domnikl nice!! I'll do it.
@johnikx π
from designpatternsphp.
#86 has been merged, so I think I can close this?
from designpatternsphp.
sure!!
great job guys!! π
closing π
from designpatternsphp.
Related Issues (20)
- Broken documentation url in readme HOT 3
- CircuitBreaker pattern HOT 1
- Bulgarian Translation HOT 4
- Hello γWhen I run phpunit, this error occurs. How can I solve it? Thank you HOT 2
- AbstractFactory - how does it know which WriterFactory to return HOT 1
- Design Patters PHP HOT 1
- composer install - FAIL HOT 2
- Translation error in readthedocs HOT 3
- use standard coding style from PHP Code Sniffer HOT 3
- Translate the Structural pages into Spanish
- Incomplete translation to Brazilian Portuguese HOT 1
- Observer pattern is unclear as implementation of update is not clear
- strategy pattern php HOT 1
- undefined class TestCase. HOT 1
- Help with Docker HOT 2
- Class diagram doesn't match the code. Pattern "State" HOT 1
- Project marked as spam HOT 2
- How to translate languages from other countries
- language issue
- *
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from designpatternsphp.