ergo icon indicating copy to clipboard operation
ergo copied to clipboard

Break ergo into discrete components, glue components together with composer

Open lwc opened this issue 13 years ago • 6 comments

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/Ergo would move become ergo/common
  • Add individual composer.json files to subfolders in classes/Ergo
  • Update ergo's composer.json to 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

lwc avatar Aug 20 '12 23:08 lwc

+1

harto avatar Aug 20 '12 23:08 harto

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

joshbenham avatar Aug 20 '12 23:08 joshbenham

:shipit:

richo avatar Aug 21 '12 00:08 richo

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. :-)

dhotson avatar Aug 21 '12 00:08 dhotson

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.

lox avatar Aug 22 '12 01:08 lox

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.

mtibben avatar Aug 22 '12 02:08 mtibben