Agility-Inject (was: Should one consider choosing Agility for real project ?)

81 views
Skip to first unread message

Tristan Slominski

unread,
Apr 17, 2012, 11:56:02 AM4/17/12
to agil...@googlegroups.com
The injection worked for our architecture. 

In your code, I have to have an instance of objTypeOne available. Instead, imagine every agility object in its own file, and use `browserify` or `requirejs` to "build" final product. Where what it means to be "objTypeOne" is determined at build time. I don't have "var objTypeOne" available in that particular module, but I'm assuming that when the code runs, it will be available. The other constraint, was that I wanted only $$ to be an assumed global, and everything else encapsulated.

On Tue, Apr 17, 2012 at 10:35, Gav <gav_j...@yahoo.com> wrote:
I am using Agility in a production web app and am trying to push my
current company to use agility for html5 dev, over backbone.js and
knockout.js.  tbh i didn't have enough time to really use test other
frameworks, but found agility the easiest to pick up and so far it
hasn't disappointed or restricted me in what i have tried to do with
it.

@Tristan I've looked at the dependency injection stuff but I don't
understand why you would want dependency injection in javascript.
Forgive (and correct me) please if I am mis-understanding something
fundamental but aren't all agility objects (or any js class)
effectively public static classes, which means we don't really need to
inject instances of classes as we have the statics available all the
time?

So I could modify the example code on https://github.com/tristanls/agility-inject/blob/master/README.md
to:

 controller : {
   'click &': function () {
     // don't need to inject as we have access to objTypeOne anyway
     var objOne = $$( objTypeOne );
     self.append( objOne );
   }


Conceptually i think of each agility object as a public static class
with no instances ever, so if you create a new agility object by
extending an existing object, you are effectively creating a new
public static class that extends the old one.

On Apr 17, 4:04 pm, Tristan Slominski <tristan.slomin...@gmail.com>
wrote:
> Agility is used in production at OpDots. However, I'm no longer there, so I
> haven't had daily interaction with it.
>
> Most of my contributions were related to addressing issues we needed solved
> and they made their way into the framework (we also used injection:https://github.com/tristanls/agility-inject). Since then, I've fixed a bug
> or two, but my code has been mostly on the server side in Node.js, so I
> haven't had a need to add anything to Agility, and honestly, Agility hasn't
> misbehaved in my use cases. If I have to build a user interface in the
> browser (or even a browser module), I'll use Agility again.
>
>
>
>
>
>
>
> On Tuesday, April 17, 2012 9:32:41 AM UTC-5, gsb wrote:
>
> > I did not mean that to be painful: it is what it is.  And my desire for
> > "mobile first" tools is simply not in line with the current goals of
> > Agility.  That said, Agility's size and approach seem likely to fit well
> > with small to medium mobile developments - webapps as well as hybrid apps
> > using the likes of phoneGap.  I did not follow-up by 'developing' an
> > Agility-Zepto product myself for I see that as an integral part of
> > Agility's main-line development to enable future release compatibility as
> > Agility matures.  In fact, I am not a Zepto fan;  it is just less weight'ie
> > than jQuery.  I tend towards the smaller xui and, yes, 'roll-your-own.'
> >  Again, it is the light-weight structure and somewhat novel approach of
> > Agility that intrigued me in the first place.
>
> > Greg
>
> > On Apr 16, 2012, at 6:17 PM, Artur Adib wrote:
>
> > > Ouch. I hope I said something like "contributions are welcome!" with a
> > > smiley face or something.
>
> > > Agility has a lot done already and has been used in production
> > > (@tristanls?). There's a ton of men-hours put into both coding and
> > > design decisions (which you get for free, btw). I'd love to contribute
> > > more but I am swamped with other duties.
>
> > > Nonetheless, as an open source project manager I am always willing to
> > > review patches and guide contributors.
>
> > > Sent from my iPhone
>
> > > On Apr 16, 2012, at 5:37 PM, GregBaker <g...@gypsytrader.com> wrote:
>
> > >> As I recall, a short time ago I asked how the Zepto (targeting mobile
> > developments) was coming along as mentioned in the docs, he basically said:
> > "Do it yourself."  Not much help and not what I was looking for.
>
> > >> Greg
>
> > >> On Apr 16, 2012, at 5:14 PM, jk wrote:
>
> > >>> Hello
>
> > >>> We're currently evaluating JS MVC framework and Agility seems most
> > >>> suitable since having less learning curve, smaller size and
> > >>> potentially requires less code to write. But looking at GitHub one can
> > >>> see that there were no commit for few months already. Does this
> > >>> framework evolving and still being under development ?
> > >>> What is authors' attitude to continue its maintaining ?

Gav

unread,
Apr 17, 2012, 12:33:02 PM4/17/12
to Agility.js
interesting approach, so were you putting each agility object in its
own 'module' and defining its dependencies using AMD? dont suppose you
could post some sample code of modules and agility together.

I came at this same problem with a very different approach, i'd be
interested in hearing your thoughts:

I also put each agility object into it's own js file which i put into
packages/namespaces. I run a development build
(index.development.html) which basically has as many <script> tags as
needed (72 or so) to load each individual js file in the correct
order.

I created an ANT script which i run from my dev ide (IntelliJ)
whenever I want to run a release build. My build script looks at my
index.development.html file and parses the XML (downside is my html
file has to be valid wellformed xml for this bit) to get an array of
all the <script> tags in my body (i put 3rd party libs like jquery and
agility in the head to keep them out of my build) and i use ANT to
combine all the js files into one monster js script file, i then
invoke a minimiser (I use yahoos one) to compress my js. I';ve got 72
js classes at last count in my application and the minimiser gets my
main script file down from 95kb to a respectable 42kb. I do other
stuff with my ant script, like auto increment build numbers, compiling
my LESS into CSS as well, and creating a release html page that uses
my single js file, but the main thing it does is combine and minify my
js files.

p.s. I've put together a youtube video of the above
http://www.youtube.com/watch?v=KnSf0PlSdT8&feature=channel&list=UL


On Apr 17, 4:56 pm, Tristan Slominski <tristan.slomin...@gmail.com>
wrote:

Tristan Slominski

unread,
Apr 19, 2012, 8:34:33 AM4/19/12
to agil...@googlegroups.com
Hey Gavin,

Here's an example of what the code would look like separated out into files:  https://gist.github.com/2420703  The way the build would happen, it would only select either `typeOneA` or `typeOneB` to be included in the build.

What you are doing with ANT, I just outsourced to `browserify` because I'm a heavy Node.js user, so it allowed me to write client side code that looks like Node.js code. That was a convenience. However, we are doing the same thing as far as I can understand from your overview. The rest is aesthetics :D

Cheers,

Tristan
Reply all
Reply to author
Forward
0 new messages