Comments (6)
@bonndan great idea 👍 . I can try to make this task.
from designpatternsphp.
@bonndan 💯 i ll make a try too very soon
from designpatternsphp.
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:
from designpatternsphp.
@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.
@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:
- Use new phpdocumentor - wich can generate uml from code (it uses graphviz also)
- Write own uml generator (or plugin for phpdocumentor) that will generate uml diagrams that will be suitable for this task
from designpatternsphp.
This looks really interesting for diagrams in markdown
http://gravizo.com
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.