jump to navigation

team mvc June 1, 2008

Posted by headwinds in Actionscript.
add a comment

Over the last two weeks, I’ve been working closely with Shant Adam on a project involving multiple design patterns including Strategy, Composite, Observer, MVC and Cairngorm; yes everything but the kitchen sync in favor of our own BR tweening engine.

Its an honor to work with this design pattern veteran with a 10+ years experience as a programmer, and its slightly depressing to hear him speak of his days in Santa Barbara working for Intro Networks. I was first introduced to their social networking software at a Flash Forward conference in New York. It has a circular graph that places you at the center; surrounded by people who share your interests; the further out you go; the less they are related. You can try it out within this Adobe Developers Centre. After seeing that incredible visualization in action, I can perhaps embarrass Shant a little by sharing his ancient portfolio site, and while the development is definitely not representative of his current mastery of Flash, the art work is impressive and I do this more to illustrate the fact that gifted programmers can also excel in fine arts.

Along with Shant, we’re being lead by Jon Morley, our Technical Experience Director from our New York office, and this project would be nearly impossibly without a very senior team considering the timeframe, scope, and complexity. In the past, I’ve often found myself as the sole programmer on a project that could have gone much better with a few more competent heads. I’ve been in situations where I know I have about 95% of the solution and then get stuck on that last 5%. This is where its so important to discuss problems, and approaches with another developer who can help one get unglued. Usually a developer just has to sit and listen, and let me talk out the problem, even if they have no idea what I’m saying :-D . Of course, its much better when they have full knowledge of the project and can offer more constructive criticism. Even in times when resources are low and developers are forced to fly solo for awhile, it might actually be better to keep us together and line up work into project a queue so that we can knock them down as paired teams, but management would rather have us divide and suffer…err..conquer.

On this particular project, we’ve been doing quite a bit of a pair programming taking turns typing and/or talking. I entered the projected a few days after Shant, and I was able to quickly ramp up this way. Before diving into the code, we also spend time drawing and wiring up boxes on paper and then use these sketches to coordinate our efforts if we decide to split up to focus on different aspects of the application.

We have some of the best talent I’ve ever worked with and the development is marching along fairly smoothly but sometimes Flash can bring even gurus to their knees. For instance, we were working on a custom drag and drop navigation system, and we ran across an issue dealing with a column of masked icons where the “MOUSE_OUT” and “ROLL_OUT” events would fail to fire, but we could still get events from “MOUSE_MOUSE”. We had to jump through several hoops to get it working using a combination of mouse move and hitTestPoint to determine if the mouse had left the icon so that we could then fire that roll out event. Not nice. In the ends, it turns out we simply forgot to enable button mode and, in the case, there was no error messaging to help us decipher this solution.

Within our architecture, pretty much every visual elements has its own model, view, and controller. We decided that even the smallest elements like these icons should also follow the MVC pattern, which is pretty hardcore [I know I've been rather softcore over the years using MVC more loosely -- usually combining the view and controller], but it actually paid off and allowed us to focus on developing a custom drag manager that we could reuse throughout the application. Although it may take more setup time, the benefits become clear as we started to tackle problems involving massive change within the application that required multiple areas to update and reflect these changes.

MVC is definitely aimed at team development, and if you want to learn more about how it can work with AS3, I highly recommend investing time in learning PURE MVC so that its complexity becomes more second nature.