Giter Club home page Giter Club logo

Comments (6)

PaulAnnekov avatar PaulAnnekov commented on May 8, 2024

@bonndan great idea 👍 . I can try to make this task.

from designpatternsphp.

kbariotis avatar kbariotis commented on May 8, 2024

@bonndan 💯 i ll make a try too very soon

from designpatternsphp.

mac2000 avatar mac2000 commented on May 8, 2024

yuml.me diagrams will be not supportable, unfortunately

example with singleton is too simple, look at adapter:

http://yuml.me/diagram/scruffy/class/[«interface»;PaperBookInterface|+turnPage();+open()]^-.-[EBookAdapter|%23eBook: EBookInterface|+__construct( ebook: EBookInterface );+open();+turnPage()],[«interface»;PaperBookInterface|+turnPage();+open()]^-.-[Book||+turnPage();+open()],[«interface»;EBookInterface|+pressNext();+pressStart()]^-.-[Kindle||+pressNext();+pressStart()],[EBookAdapter|%23eBook: EBookInterface|+__construct( ebook: EBookInterface );+open();+turnPage()]<>-[«interface»;EBookInterface|+pressNext();+pressStart()]

and imagine what it will be look like for more complex patterns

and then try to change something in that diagram - it is not possible

but there is still a way to have diagrams, plantuml can be used

all you need is to have java and graphviz installed (both perfectly works on Windows and Linux)

just put text file in each pattern directory, here is example for Adapter:

@startuml
interface PaperBookInterface {
    +turnPage()
    +open()
}

interface EBookInterface {
    +pressNext()
    +pressStart()
}

class Book {
    +open()
    +turnPage()
}

class Kindle {
    +pressNext()
    +pressStart()
}

class EBookAdapter {
    #eBook : EBookInterface
    +__construct(ebook : EBookInterface)
    +open()
    +turnPage()
}

PaperBookInterface <|.. Book
PaperBookInterface <|.. EBookAdapter
EBookInterface <|.. Kindle
EBookAdapter o-- EBookInterface
@enduml

and run java -jar plantuml.jar -tsvg ./*

this will iterate through all sub directories and find all text files with @startuml ... @enduml and generate svg image for each file

benefits:

  • readable uml diagram definition
  • ability to render svg instead of png
  • host images locally

here is example of generated diagram:

uml

from designpatternsphp.

domnikl avatar domnikl commented on May 8, 2024

@mac2000 sorry for this late answer. I would love to see plantuml diagrams in the repository. I already used it in other projects and find it very easy to adapt. 👍 for adding plantuml diagrams for each pattern in the repository. Can you do them and send me a PR?

from designpatternsphp.

mac2000 avatar mac2000 commented on May 8, 2024

@domnikl it seems that having uml this way is bad idea after all for few reasons.

First of all there is huge duplication of code - there will be non ending changes to umls

Second one is complexity, now to contribute I must learn another language to describe uml

Third - there is no way to test uml diagrams

And last one - there will be to many questions about how much should uml describe, should it describe class properties and methods or not, should it describe packages or not, and even more - should there be not only class diagrams but also other kinds of uml diagrams.

@tonicospinelli has made huge work on #106 pull request, but it seems that there is errors, for example facade diagram is wrong, and not showing connections between class and it's interfaces.

The best thing I can think of is described in pragmatic programmer book: code it self should be last instance of trust.

In my opinion there is two ways to have uml diagrams:

  1. Use new phpdocumentor - wich can generate uml from code (it uses graphviz also)
  2. Write own uml generator (or plugin for phpdocumentor) that will generate uml diagrams that will be suitable for this task

from designpatternsphp.

eddiejaoude avatar eddiejaoude commented on May 8, 2024

This looks really interesting for diagrams in markdown http://gravizo.com

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.