Re: Bamboo.js restructure (for Angular)

58 views
Skip to first unread message

Mark E Johnston

unread,
Jul 29, 2013, 11:51:47 AM7/29/13
to bambo...@googlegroups.com
Moving to bamboo-dev, we are all on the list and we should have this stuff on there.

I'm not sure how angular works, but this sounds fine to me.  Any existing code will still be working with the older version, since the bamboo API will not change.  We can choose whether or not to upgrade the code on any of those projects as we see fit.  I think we should have a completely asynchronous library for js stuff since that is the paradigm that is prevalent and appropriate.  Honestly, I might not worry as much about the object-oriented version of the code unless there is a distinct need or use case for it.  It can be confusing to have too many ways to interact with a library and OO is overrated (this is what happens when you start playing with Clojure).


On Mon, Jul 29, 2013 at 8:18 AM, Larry Weya <larr...@gmail.com> wrote:
Hey guys,

The way bamboo.js works at the moment is that if you'd like to query a dataset's info, you first create an instance of a Dataset, then call its query_info function. This results in the info being cached within the dataset.

I'd like to refactor bamboo.js by moving all the query functions into the main bamboo namespace and out of the Dataset object. The Dataset will then be a higher level object that if the developer chooses, can query through. So basically you will be able to do

bamboo.query_info(dataset_id)

as well as

var ds = new Dataset({id: dataset_id})
ds.query_info()

The reasoning behind this is that I'd like to create a bamboo-angular module that can easily be re-used and tested. I've been using bamboo.js with angular quite a bit lately, first with the Bamboo UI and now with the Drishti site. Since the ajax calls from within bamboo.js are external to angular, a manual update needs to be triggered to have it reflect on the web page. Initially, I did this on the angular controller but having the need to do this in different controllers led me to create a bamboo-angular service that can be re-used.

I had to have is such that for every bamboo call, a new dataset object would be created and used to run the query. With this approach, the caching becomes useless since the dataset is discarded after the call.

Angular's testing also relies on the ability to swap out an object with a mock object, especially for ajax calls. Its also difficult to swap out the Dataset object which makes the service hard to test.

This shouldn't affect existing code, however, while doing this, I'd also like to implement something I've been meaning to for a while, which is to make all the bamboo calls asynchronous by default with the option to make them synchronous (the opposite of what it is now). This will affect existing code.

Thoughts, go-aheads?

--
Larry Weya

Peter Lubell-Doughtie

unread,
Jul 29, 2013, 1:48:48 PM7/29/13
to bambo...@googlegroups.com

Hi Larry,

The changes you've described sound like improvements that will make bamboo.js more useful.  Sounds good to me.

--
You received this message because you are subscribed to the Google Groups "bamboo-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bamboo-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Myf

unread,
Jul 29, 2013, 2:30:55 PM7/29/13
to bamboo-dev
Follow up on Mark, I think it makes sense to have a nodejs library for bamboo which is purely async, ans we can use browserify or something to generate the front-end async js library.
--
Have you ever imagined that you are standing on the EARTH?

Alex Dorey

unread,
Jul 30, 2013, 2:03:22 PM7/30/13
to bambo...@googlegroups.com
I am cool with moving bamboo.js to angular.

I think this is the doc of the desired bamboo.js API that we were referencing when we were putting it together:
https://docs.google.com/document/d/1qtb0VeSmwJTAfbuldQ3-CcEYZP1luSw69P1M8_YG6SQ/edit

It probably needs some updating. If I remember correctly, it didn't account for async calls for data. (e.g. dataset.get_calculation().something was expected to work, when it should have been dataset.get_calculation(callback) )

Larry Weya

unread,
Aug 5, 2013, 3:12:32 AM8/5/13
to bambo...@googlegroups.com
Hey guys,

Thanks for your feedback. I've been on leave for the past week and just got back today. Ill start working on it.

Regards.
Larry Weya

Mark E Johnston

unread,
Aug 5, 2013, 11:37:46 AM8/5/13
to bambo...@googlegroups.com
to be clear, this involves restructuring the code so it is easier to use from angular, correct?  it is not moving bamboo.js to angular (i.e. as a dependency) like alex described?  i would probably still be fine with the latter, but just wanted to make sure we were all on the same page.

Larry Weya

unread,
Aug 5, 2013, 12:36:01 PM8/5/13
to bambo...@googlegroups.com

Hey,

Its NOT moving bamboo.js to angular but rather making the API calls into functions within the bamboo namespace which make it easier to integrate into angular (and generally, I think).

Mark E Johnston

unread,
Aug 5, 2013, 12:36:45 PM8/5/13
to bambo...@googlegroups.com
awesome, that's what i thought you meant.
Reply all
Reply to author
Forward
0 new messages