Break ergo into discrete components, glue components together with composer
Why?
Currently ergo is a somewhat monolithic library that provides a large portion of function for building a web application. To this end it does a pretty good job, and we use it to great effect.
Unfortunately, due to its design, it is impossible to re-use or depend on components of the library, without including the entire library. This is undesirable, and does not promote code re-use.
For example, when writing a client library for an API, it would be useful to depend on ergo/http
How?
Restructure ergo into a series of sub-libraries that are then composed into the greater meta-library ergo, something like:
- Most files directly in
classes/Ergowould move becomeergo/common - Add individual
composer.jsonfiles to subfolders inclasses/Ergo - Update ergo's
composer.jsonto require each sub-library
Outcome
It would be possible to build libraries that only require the specific parts of ergo needed This could:
- decrease barrier to entry for ergo uptake
- make it easier to open source small chunks of code such as 3rd party client libraries without the need to depend on a monolithic library
- Improve the overall architecture of ergo and dependents by decoupling interdependent concerns
+1
+1 + ++1 + ++1
On Tue, Aug 21, 2012 at 9:46 AM, Stuart Campbell [email protected]:
+1
— Reply to this email directly or view it on GitHubhttps://github.com/99designs/ergo/issues/8#issuecomment-7887417.
:shipit:
Yep, completely agree.
The Ergo core should be fairly limited in scope in my opinion. This suits my taste of making little libraries that do one thing well. :-)
What are the components of Ergo?
It was designed to be the bare minimum for the MV part of an MVC app. There should be Routing, Controllers, Views and enough wiring for a simple application abstraction.
IMO, we should be trying to integrate the Symfony2 kernel in Ergo's place, they are rapidly becoming the defacto standards:
http://silex.sensiolabs.org/doc/usage.html
If I were to gut Ergo, I'd just rip out everything but it's containers and basic wiring. It would be truer to the name.
Fully agree @lox
The dependency injection model of Silex/Symfony is an incredibly clean and flexible way of building a framework, and has many similarities to Python's Pyramid.