Giter Site home page Giter Site logo

Comments (27)

mac2000 avatar mac2000 commented on May 12, 2024

+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.

tonicospinelli avatar tonicospinelli commented on May 12, 2024

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.

tonicospinelli avatar tonicospinelli commented on May 12, 2024

@domnikl ping

from designpatternsphp.

honzabrecka avatar honzabrecka commented on May 12, 2024

I'm against the categories, but move tests closer is really good idea.

from designpatternsphp.

domnikl avatar domnikl commented on May 12, 2024

πŸ‘ 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.

mac2000 avatar mac2000 commented on May 12, 2024

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.

tonicospinelli avatar tonicospinelli commented on May 12, 2024

@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.

mac2000 avatar mac2000 commented on May 12, 2024

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.

tonicospinelli avatar tonicospinelli commented on May 12, 2024

+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.

tonicospinelli avatar tonicospinelli commented on May 12, 2024

@mac2000 @domnikl @johnikx what are you think about the last proposal?

from designpatternsphp.

domnikl avatar domnikl commented on May 12, 2024

@tonicospinelli I love it, but I would want to wait until the three new patterns are merged.

from designpatternsphp.

honzabrecka avatar honzabrecka commented on May 12, 2024

@tonicospinelli Let's do it!

from designpatternsphp.

mac2000 avatar mac2000 commented on May 12, 2024

+1

from designpatternsphp.

tonicospinelli avatar tonicospinelli commented on May 12, 2024

no problem, I wait and implements the new patterns

from designpatternsphp.

manchuck avatar manchuck commented on May 12, 2024

@tonicospinelli πŸ‘

from designpatternsphp.

njasm avatar njasm commented on May 12, 2024

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.

axelitus avatar axelitus commented on May 12, 2024

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.

malukenho avatar malukenho commented on May 12, 2024

+1

from designpatternsphp.

tonicospinelli avatar tonicospinelli commented on May 12, 2024

@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.

mac2000 avatar mac2000 commented on May 12, 2024

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.

domnikl avatar domnikl commented on May 12, 2024

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.

tonicospinelli avatar tonicospinelli commented on May 12, 2024

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.

honzabrecka avatar honzabrecka commented on May 12, 2024

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.

domnikl avatar domnikl commented on May 12, 2024

πŸ‘ for @johnikx proposal.

@tonicospinelli then why not add DoctrineBridge to the Readme.md of the bridge pattern as in the other patterns?

from designpatternsphp.

tonicospinelli avatar tonicospinelli commented on May 12, 2024

@domnikl nice!! I'll do it.
@johnikx πŸ‘

from designpatternsphp.

domnikl avatar domnikl commented on May 12, 2024

#86 has been merged, so I think I can close this?

from designpatternsphp.

tonicospinelli avatar tonicospinelli commented on May 12, 2024

sure!!

great job guys!! πŸ‘
closing πŸ˜„

from designpatternsphp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.