Reusability Of Symfony Component - Mindworks
By Oliver
Mindworks
Jarrestraße 42A
Take a look to knpbundles.
Hurdles
- problem is solved in other language
- problem is solved in other licence
- can be solved by design patterns (abstract solution)
- write a good bundle/component that is general enough takes much more time
Anti-Pattern
Reuseage by copy and paste.
- decreases maintainability
- decreases testability
- violates dry principle
Scenario
- community web application
- users seek other users by interests
- how to input data to easy up matching?
What Do We Need?
- form widget (js and css based)
- data transformer (converts format from storage to human readable presentation and back)
- form type (provides name for form widget, called in FormTypes, gets TagManager injected and defines DataTransformer)
- Entity Trait (avoid copy and paste)
- Taggable Subscriber
- Make it reusable (dedicated bundle, created composer project)
- Use JavaScript and CSS via "composer component" (see web/bundles, RobLoach/component-installer)
Live Demo
Available on github
Comments
Display comments as Linear | Threaded