You are viewing a read-only archive of the Blogs.Harvard network. Learn more.

Jira vs Github :: Agile vs Open Source

A few years ago, my team got into Open Source. Specifically, we started writing all of our apps on github (as opposed to our SVN). We wanted to do this because we wanted to invite scrutiny. We never expected people to look at our stuff, we just felt that by putting it out in the open, we’d want to do better internally.

We went whole-hog. Organized stories with issues, organized sprints with milestones. It was pretty hot stuff. And it was all in the open. Potentially, someone could come by, see what we’re doing and offer to take a story from the backlog of issues. That’s open source. ish. We have a lot more we can do. A lot of growth to do.

Then we started using Jira. The board system within Jira Agile was excellent. Allowed for better organization, reporting!, and visual representations of work. It’s great. It’s Agile. But it also replaced what we were doing with Github issues.

We essentially replaced Open Source in favor of Agile. Our organization is great, we’re keeping track of things fantastically, but we’re no longer open. We don’t have transparency on what we’re working on anymore. People can’t potentially help. Our code is out there, but we’re not inviting. Our process is no longer out there.

So what’s our solution? We don’t have one yet. But what /can/ we do?

We need to put our vision statement out there. We need to put our plans out there. We need to expose what it is we’re doing. We also need to stay agile, keep our tools intact, keep our reporting.

This means we probably need to be duplicating efforts. Open Source and Agile are both hard work and organization. That they can’t line up and be the same effort is not a blocker, just an “oh well”.

Posted in Agile, ATG, Git, Open Source, SVN. Tags: , , , . Comments Off on Jira vs Github :: Agile vs Open Source »

Integrating Jasmine with Travis CI

One of the things I’ve been wanting to automate with our Harmony Lab project is the javascript test suite so that it runs via Travis CI. I tried once before, but hit a wall and abandoned the effort. I recently had the opportunity to work on this as part of a professional development day in ATG, which is an excellent practice that I think all departments should embrace, but that’s a topic for another day. If you’re not familiar with Travis, it’s a free continuous integration service that provides hooks for github so that whenever you push to a branch, it can run some tests and return pass/fail (among other things). Getting this to work with a suite of python unit tests is easy enough according to the docs, but incorporating javascript tests is less straightforward.

Harmony Lab JS tests use the Jasmine testing framework and all of the unit tests are created as RequireJS modules. This is nice because each unit test, which I’ll call a spec file, independently defines the dependencies it needs and then loads them asynchronously (if you’re not using RequireJS, I highly recommend it!). Running the Harmony Lab tests locally is a simple matter of pointing your browser to http://localhost:8000/jasmine. This makes a request to Django which traverses the spec directory on the file system and finds all spec files, and then returns a response that executes all of the specs and reports the results via jasmine’s HTMl reporter. But for headless testing, we don’t want to be running a django server unless it’s absolutely necessary. It would be nice if we could just execute some javascript in a static html page.

It turns out, we can! The result of integrating jasmine with phantomjs and travis CI is Harmony Lab Pull Request #39. You can check out the PR for all the nitty-gritty details. The main stumbling block was getting requirejs to play nicely with phantomjs and getting the specs to load properly. The phantomjs javascript code, that is, the javascript that controls the browser, was the simplest part since it only needed to listen for the final pass/fail message from jasmine via console.log and then propagate that to travis.

Posted in Continuous Integration, Harmony Lab, Javascript. Comments Off on Integrating Jasmine with Travis CI »

Shame on Me: the missing code review (or is it unit testing?)

So a bug was reported not long ago. Let’s say “sensitive data” was available where it shouldn’t have been. I had an API view, a view that was returning json only, or should have been. Apparently early on in the project, I had added a comment to that view, to make sure it was returning the appropriate data. So I had added an html comment to a view that was supposed to be returning json. And I had it outputting everything under the sun it could output.

<!--
"secure data" => "stuff I don't want the user to see",
... 30-40 lines of this ...
-->
{"success": true}

So there’s 2 problems with that. The most important of which is that with DOM inspection tools, like chrome developer tools or firebug, you can inspect the return value of that request and see the data I don’t really want you to see. The other problem is that I’ve created invalid json, and whatever is checking that success is clearly not using that value.

Why did I do this?

This was early on in development and I was debugging the easiest way I could.

What could have prevented this?

A code review of any kind. One look at that file would have been a red flag to anyone. But a view file that was only outputting true or false never seemed like something I ever needed to look at once I got it working.

Custom Slides and Github Hosting

So I was putting together a presentation on Accessibility for my department. I knew very little about accessibility, so I read as much as I could and watched every youtube presentation I could find on the subject. A lot of them were total crap, but a few from some of the google io conferences were really great. They had working examples and code rendered inline to the slides.

I thought this was great so I went looking for what they did for this and found that (for at least the 2011 and 2012 io conferences) they have provided a slide template that is geared just for that.

The 2012 one is reasonably nice: https://code.google.com/p/io-2012-slides/

So I altered this, “forked it” and dumped it into my github: https://github.com/jazahn/axs-slides

That in itself is pretty cool, but then I thought, hey, I want to put these somewhere people can get at them. So originally I had them on my public web space for work, but it was sort of annoying to git commit, git push, log in to the server, git pull. Logging in can be an annoying step for my work if I’m not at work and need to VPN.

Artie had a cool idea of using github pages (http://pages.github.com/). Because these slides are all static, I don’t even have to worry about what server these are running on. All you have to do for this is create a gh-pages branch and anything in that branch will automatically be hosted. So what I did was create that branch, set it as the default branch, and removed the master branch (to avoid confusion and simplify). After altering my remotes, now I just have to git push from my dev environment and it’s automatically put on the server:
http://jazahn.github.io/axs-slides

Very cool.

Posted in ATG, HTML, Javascript. Tags: , , , . Comments Off on Custom Slides and Github Hosting »

Modern JS: Tools of the Trade

Whether you like or dislike javascript, the good parts are quite good and javascript patterns can make it easier to write sophisticated apps that are also readable and maintainable. One of the more recent trends in JS is a movement toward micro libraries. A good resource for that is microjs.com. Alas, there’s no such thing as CPAN for browser-based javascript, but I think this is a good start at organizing the useful libraries that exist on github and elsewhere.

On one of my recent projects, I wanted to implement the pub/sub pattern on some objects, but instead of writing the code myself or reaching for a heavyweight library just for event functionality, I instead found microevent.js via microjs, a mixin that adds the ability to make any object an event emitter. In total, the library is just 20 lines of plain-old-javascript that anyone can understand.

These are some other tools and services that I’ve found very useful:

  • JSHint (successor to JSlint): lints code and also useful for enforcing a common style on a project with multiple developers.
  • RequireJS: a library that aims to make dependency management more sane in javascript. This is based on AMD.
  • Jasmine: a library for doing unit testing (BDD).
  • JSDoc: for documenting javascript, kind of like Javadoc. Docco is also gaining in popularity, although I haven’t used it myself.
  • Lodash/Underscore: Lodash is a fork of underscore.js that I’ve been using, although they both serve the same role: they facilitate a more functional-style and provide common utilities that every JS dev needs, whether they know it or not, although as Brain Lonsdorf points out, there’s more to functional programming.
  • JSPerf: this is a popular benchmarking service for JS and helps answer performance-related questions. Very useful.
  • JSfiddle: great service for testing out javascript and sharing it with others.

I’m sure there are some others that I’ve missed, and I’d like to hear about them!

Posted in ATG, Javascript. 1 Comment »

Django Formsets, the worst thing ever?

This kind of thing really attracted me to django, but then the usability of it goes entirely out the window when you take a closer look.

Formsets are basically a container for an arbitrary collection of forms. A form is a abstraction layer for UI, but I’ve seen they (or rather ModelForms) can be somewhat helpful as a funnel for POST vars and validation of the model. Maybe my issue is that the use I’ve found for them is not the primary concern people have.

from https://docs.djangoproject.com/en/dev/topics/forms/formsets/

>>> ArticleFormSet = formset_factory(ArticleForm, formset=BaseArticleFormSet)
>>> data = {
...     'form-TOTAL_FORMS': u'2',
...     'form-INITIAL_FORMS': u'0',
...     'form-MAX_NUM_FORMS': u'',
...     'form-0-title': u'Test',
...     'form-0-pub_date': u'1904-06-16',
...     'form-1-title': u'Test',
...     'form-1-pub_date': u'1912-06-23',
... }
>>> formset = ArticleFormSet(data)
>>> formset.is_valid()

See, how you would expect something like this to work is it would take in a list, or at least a dict with a list. But no, they have you cat “form-n-” to the field name. This is just so sloppy I have to point it out.

They spent so much time figuring out how to take away customizability from the front end, they weren’t paying attention to the backend.

Django nonrel (noSQL) (app engine)

I’ve been working with this for the last couple weeks. I have been doing this for a couple reasons.
1) I wanted to play with noSQL
2) I’m developing and deploying with the google app engine — the app engine does have a mySQL option (Cloud SQL), but they have no free version of this — so to do a GAE app (entirely (including data) in GAE), you have to use the google data store or pay for SQL.

Now doing the design in a key-value noSQL wasn’t too bad. I just had a design that had each object containing the ids of the other objects that were associated with it both ways. This was somewhat redundant she thinking about it in a relational way, but it made queries simple and fast. The overhead is making sure the software keeps the ids updated in all related objects I.e. if something is deleted.

That wasn’t so bad. It was a fun to design things differently than I’m used to. Then I fleshed out the models in django.

The issue I ran into was django-nonrel. This is the project that converts django to be able to deal with non relational DBs. This changes core django abstraction models and consists of apps that can be installed locally or globally. So I installed them locally because I don’t like the idea of altering the framework globally.

It did not work with the latest version of django.

So I read through the docs a little more carefully to discover the core team quit this project over a year ago. Because noSQL wasn’t right for their projects and Cloud SQL was now available for app engine. The guy who took it over isn’t keeping it up to date with django. He’s about a year behind. It’s working with django 1.3. Current version right now is 1.5.1. That is enough to throw errors.

If django is making changes in point releases that cause the django-nonrel to become out of date, either django isn’t doing a good job at maintaining backwards compatability or (much more likely) django-nonrel project isn’t doing a good job keeping away from hacky implementations that rely on very specific django references.

I don’t have the time to debug django-nonrel. It’s like 4 apps that go in your django project.

Additionally I worked out what the cost of Cloud SQL would be for development and I can deal with less than $2 a month. When it goes production I can worry about dealing with my teams extremely poor mysql management or get my group to pay for a more substantial Cloud SQL instance.

Posted in ATG, Flashcards. Tags: , , , , , , , . Comments Off on Django nonrel (noSQL) (app engine) »

Drag Dropping a Helper (or something else) with jQuery UI

I was having issues using jquery UI’s draggable and dropping something other than what I was dragging into a sortable. So this example, but dropping something else.

Originally I was trying to do it with Helpers. Helpers are nice, but limited in functionality and you cannot get the draggable helper element from the sortable. The right way seems to be to append / create the element within the dom once it’s been dropped. So create an element template and drop it in on the sortable’s update event.

Here is a jsfiddle with my solution.

Highlight:

var textItem = 'Text that is droppped';
var imgItem = 'Image that is dropped';

$(document).ready(function(){
	$('#sortable').sortable({
		revert: true,
		update: function(event, ui){
			if($(ui.item).hasClass('mysortable')){
			    // we don't add one if we're sorting a pre-existing item	
			} else {
				$(ui.item).removeClass('ui-state-highlight');
				$(ui.item).addClass('mysortable');
				
				if($(ui.item).hasClass('textDrag')){
					$(ui.item).html(textItem);					
				}
				if($(ui.item).hasClass('imgDrag')){
					$(ui.item).html(imgItem);					
				}
			}
		}
	});
	$('.draggable').draggable({
        connectToSortable: "#sortable",
        helper: "clone",
        revert: "invalid"
	});
	
});
Posted in ATG, Flashcards, Javascript, jQuery. Tags: , , , , . Comments Off on Drag Dropping a Helper (or something else) with jQuery UI »

Feature Branches with Code Reviews

We have been trying to find a process for doing code reviews for a little while. Because most of our current projects are in github, it made sense to try and use some of the github features to help in this process.

I have been using issues for stories and milestones for sprints for a while. And it works out nicely because I get a pretty neat gamificationy results.

So I started using a feature branch in order to have the ability to make pull requests on my own project and get a discussion thread before code is merged into the trunk (production).

https://github.com/Harvard-ATG/Quizmo/pull/119

This discussion is a great way to get a reasonable code review before merging code. Right now we’ve decided to only do this for non-trivial changes, but with a very high bar on “trivial”.

Posted in ATG, Development. Tags: , , , , . Comments Off on Feature Branches with Code Reviews »

Forcing Client Involvement Through Production Releases

What I take away from agile is the idea of putting something in front of a client as quickly and as often as possible. Of course things are going to have flaws, and things may be unfinished, but having the client see what you’re doing gets a sort of course correction done that doesn’t happen in a vaccuum. People tend to understand this, but they don’t often abide by it.

The problems I’ve seen lately have been in the instance when there is no client directly involved in the process. In that case, a product manager is assigned to take on the role of client, someone who mostly understands what the client wants and basically be their advocate. But the product manager, being an employee and not a client, doesn’t want to risk releasing an incomplete project for fear of how that will look or how the client will react to that. Therefore purposely not involving the client in the only part of the process where the client could give direct feedback — in production.

As long as it’s explained to the client that they are dealing with an alpha, and we welcome feedback on things they feel are necessary, it seems they could be used at that part of the cycle to offer feedback and keep features that will never be used from being added to the project and keep the project from straying too far from something they don’t want.

Posted in Agile, ATG, Development, Quizmo. Tags: , , , , , . Comments Off on Forcing Client Involvement Through Production Releases »