When terrorism hits home

Last night Mumbai suffered what some news reporters called the worst act of terrorism India has ever seen. Mumbai unfortunately, is no stranger to acts of terrorism but these attacks were of a completely different kind, the attackers definitely suicidal who just wanted to kill as many people as they could before they themselves were killed. Even after 24 hours, the drama still is not over with the security forces still trying to rescue people who have either been taken hostage or have been stranded locked up in their rooms.

I was glued to the NDTV live steam for most of the night and since I have woken up this morning, and on tracking the story on search.twitter.com as well as occasionally jumping to BBC news or CNN. My first emotion was anger. Mumbai was my home for a while and its still my favorite city in the world. And to see it virtually being held hostage by these loathsome assholes enraged me. My sentiments towards the government and the security forces were those of sympathy almost, they are trying their best arent they?

But I talked to my brother over chat then and another friend who also often visits Mumbai, and they were less so. The attacks in Mumbai weren’t unexpected, after the recent attacks in other big cities where Mumbai was conspicuously out of the list. Its the job of the government to keep its citizens safe, and it failed miserably this time. While the on site journalists kept insisting that the city will bounce back and take it in its stride, I really hope this wakes us up as a country and makes us ask some serious questions of ourselves and of the people we put into power to make sure things like this don’t happen. Its time we stopped being reactive and “politically correct” and just root the sources of such terror out. Lets stop taking the safe and conventional responses. Give the security agencies more rope and let them go after the core of the threats irrespective of political sensitivities. We need more supercops like KPS Gill

The drama still goes on in Mumbai but I hope this is a wake up call to us all.

Notes from Max 08

I got back from San Francisco this morning taking a couple of extra days at San Francisco to do some tourism. So I figured I’d put down what I had learned this year before the workweek clouded all that to a distant blur.
As usual, MAX was f-ing awesome. I have tried to make it to MAX every year since I graduated and joined the corporate workforce and Comcast has been pretty awesome about making sure I could do that on their dime. This year was no exception and most of the Flash team from CIM was there at MAX as Adobe showed of the cool stuff they have been working on.
My strategy for MAX this year was a little different than earlier. Traditionally I have tried to get deeper into technologies that I work with everyday. This year, with so many new ideas being shown at MAX, I decided to take sessions on the things that I did not work with between 9-5 and would be really easy for me to miss. I have to say it worked out pretty well.
Let me start off by saying: HOLY S**T, the Flash Platform is AWESOME and the pace at which its evolving is just incredible. Below are some of the best sessions I attended this year:

Using C++ Libraries in Flash Player and Adobe AIR
This was definitely one of the best sessions I attended at MAX this year. The session introduced Adobe’s Alchemy project that compiles C++ code to Actionscript bytecode that can be run on the Flash Player just as any bytecode compiled from AS3 code would. The project isn’t mature yet but some of the examples that were shown like ports of C++ OggVorbis codec, motion detection libraries, cryptographic libraries, etc were definitely impressive. I guess its time for me to brush up my C++ ;).

Hands On: Creating Effects with Pixel Bender
I think I got most excited during this lab. Pixel Bender, as a lot of you may know, is a technology that allows developers to write Shaders in a language called Hydra. Hydra is has a C-esque syntax but is really easy since you dont do really complicated logic in it, but rather simple pixel manipulation. These Shaders can then be applied at runtime to Flash DisplayObjects and also be used within Photoshop / AfterEffects as custom Shaders. I had read a bit about this before but the syntax and the prospect of having to learn another language was keeping me away from writing a custom Shader. However, it was really surprising how ridiculously easy this was. Hopefully I’ll write a couple of filters soon and release them on this blog.

Extending Flex Builder
Another awesome session, almost perfect for me. This session introduced the object model that the Flex/Actionscript plugin uses for all the language intelligence within the IDE. The session was really useful since I had a couple of ideas to extend Flex Builder but while I was able to learn about Eclipse itself, I had no knowledge of the details of Flex Builder plugin itself.

Hands On: Getting Started with AfterEffects CS4
Programmatic Animations in AfterEffects with Expressions and Scripting
On day 1, I attended part of the AfterEffects workshop in the morning. I have never worked with AE but have seen some designers I work with come up with some incredible stuff with it. The session was perfect since it taught me enough to now let me go play on my own. Unfortunately I had to get out of that session half way since I had to get to a meeting (yeah I was also working there) but the pace of the session was perfect.
On day 2, I attended another session on programmatic animation in AE. Since most of the animation I do in Flash in programmatic, this really made me map that knowledge to the AE domain. Between these two sessions, I think I really got a lot clearer understanding of AE than before.

Adobe XD: Designing Design
Adobe XD: Building a Next Generation News Reader
I loved the XD sessions. Seeing how they go around developing apps and how they make decisions around user interfaces is always interesting. The session where Jeremy Clark explained the process of developing the New York Times news reader application was particularly informative, where they even showed the process of prototyping interaction design, something I really feel all companies should do more of.

But more than the sessions, it was meeting other attendees that was just plain amazing. I had some amazing conversations around the future of LogBook and OpenPyro with quite a few people I have talked to on twitter and email but seeing them in person was very exciting. These were almost as educational as some of the sessions.

Max 08 was just amazing, and am definitely looking forward to Max 09 in LA.

BarCampPhilly 2008: What a blast !

BarCamp Philly

This weekend Philadelphia was host to its first BarCamp event. For the uninitiated, BarCamp is an international network of user generated conferences รขโ‚ฌโ€ open, participatory workshop-events, whose content is provided by participants (wikipedia link here). Barcamp is described as an “unconference”, with the sessions being a lot more casual and more like conversations than presentations. Having been to a bunch of conferences before, I definitely found the organic nature of BarCamp rather refreshing. When I walked in at 8:15-ish in the morning, I had no plans of presenting anything but swept by the energy in the group, I ended up giving not one but two sessions (more on that later).

Working for Comcast, and pretty familiar with how it is most often a subject of blame than praise, the biggest surprise for me was how positively the attendees spoke of Comcast. For example, a session on ROI on social media was dominated by a discussion on the @comcastcares twitter account run by Frank Eliason from Comcast support. Always available a tweet away, Frank has been answering twitter users when they have Comcast related troubles. The conversation around how Comcast “gets it” was definitely new (kudos @comcastcares ๐Ÿ™‚ ). Comcast definitely had a strong showing at Barcamp this year, with a bunch of us attending as well as volunteering for the event. Aaron Held, the director of engineering at Comcast Interactive Media (the division I work for) gave a talk on building Comcast.net, a site that boasts being one of the top 10 portals on the web, to a packed room. Aaron and I also had a round table discussion about innovating within a corportation, and I personally got a lot out of that (I’ll post a blog post on that sometime later this week).

CIM @ BarCampPhilly2008: Innovation within

Also, continuing my agenda for a Flash-y world, I gave another talk on using Flash in an AJAX world, where I talked about where Flash had certain advantages over AJAX (besides the richer interfaces it enables). Kevin Fitzpatrick, another fellow Flash dev for CIM gave a talk on sharing your ideas early and leveraging the community to take an idea from concept to a product. Livia, another fellow Cimian (yes thats what we call ourselves now ๐Ÿ˜‰ ) from our IA group also gave a talk titled “Jedi Mind Tricks – mediating user, brand, technology & business goals through conversation” which unfortunately I missed as I forgot to check for new sessions on the schedule. Wonder if anyone took notes on that one.

After an intense day of a lot of fun sessions, the day ended at the always fantastic National Mechanics bar, which was made even more geek friendly with a hooked up Rock Band and (gasp!) an open bar! It was amazing.

Hats off to the BarCamp organizers Roz Duffy and JP Toto and the entire volunteer army. You guys did an amazing job. Here’s to a lot geekier Philadelphia :).

Oh and btw, one of the things I had to do was animate a wordle that the BarCamp peeps created. This ran on a couple of big screen displays at the conference. I am attaching it here for posterity and the source can be found here.


Aha, so I am not crazy! Choose Flash for portable apps. Yahoo says so.

For as long as I have been a Flash developer, I have been completely addicted to it. And its only getting better with age. But off late, a lot of people have been eager to prophesize the death of Flash (usually siting poor Flash implementations as reasons). However there are certain features (not counting the wow effect) in Flash that make it a good choice for certain implementations. For one thing Flash Player (esp greater than 9 which 98% of the users now have) is much faster in processing data than javascript, especially on older browsers. Another reason is that a self contained swf file is a lot more portable when moving from one environment to another. In today’s world of Facebook widgets, OpenSocial containers, etc etc, deploying a swf is a lot easier than packaging a suite of javascript files. Actually a lot of those containers won’t even let you deploy JS on their servers and force you either to use an html extension like FBML or use an IFrame (and again there are limitations set on where those can appear on the sites). So it was really heartening to see that officially be posted on the Yahoo Developer Networks blog by Jonathan LeBlanc, Senior Software Engineer / Technology Evangelist from Yahoo. So do give it a read and use that as ammo if you are in another one of the “Why Flash” conversations.

The post can be found here.

Also take a look at the Yahoo Open Strategy (Y!OS)’s Flash SDK here (Yahoo has only released a Flash and a PHP SDK).

Go Flash !

Mixing up OpenPyro and Facebook: FacebookTV

For the last couple of weeks, I have been working quite a bit more on OpenPyro. Writing a new UI framwork in a vaccum almost never works, so I needed an app to build using OpenPyro. I had some Facebook API code handy so I figured I’d try something with that. So here is a screencast of the app as it is right now. The application uses Facebook’s desktop api to get all the friends of a user and their favorite TV and Movies. Then I group the shows/movies together to see what the most popular of them are and sort them with the most popular ones at top. The data is rendered in an OpenPyro chart component. The TV and Movies are in two different Horizontal Chart components and sit inside an OpenPyro container called SlidePane. SlidePane extends the OpenPyro ViewStack (which is very similar to the Flex ViewStack) and automatically handles sliding between different views (each being an OpenPyro UIContainer). Clicking on an entity does a show/movie lookup from Fancast.com, and also lists who among your friends have added the show/movie as their favorite. The BarChart below is segments those friends by gender or by relationship status ( I have to say, the Facebook API is pretty rocking, and I can segment the data on a variety of axes. )

Here is the awesome-est image of it all:

FacebookTV filesize

Yup. The whole sucker is about 60K. And that includes Labels, Buttons, Lists, ComboBoxes, Layouts, Painters, Containers, etc etc.

So here is the show:


OpenPyro is still not ready for a general release yet, but its coming along pretty sweetly.

Comments welcome.

The great AS3/AS2 debate: Is it slower to work with AS3 than AS2? My take: A bit

Mike Chambers, Principal Product Manager for developer relations from Adobe, has been pinging the Flash community about whether AS2 based development is faster than AS3 for Flash projects. Having spent a long time in both languages, I thought I would post my 2 cents on this blog. So my answer is: Yes. Of course I’ll qualify my statement by saying that 1) There are a lot of capabilities in Flash 9+ that are amazing but I want to disconnect the language (pure syntax) from what it enables and 2) This post assumes you are as comfortable with AS3 as AS2. I am not factoring in the learning curve for a new language, which happens anytime there is a drastic change.

AS3 can use some help. Let me list out some reasons why I say that:

  1. Loading XML is a complete pain
  2. Calling an external URL is AS2 was simple (although having to use delegate because of the lack of proper closures was retarded). The code was something like this:
    var xml:XML = new XML()
    xml.ignoreWhite = true;
    xml.onLoad = function(success){

    Very readable, plus all errors were available in one check. Lets compare that to AS3:

    XML.ignoreWhite = true;
    var urlLoader:URLLoader = new URLLoader()
    var urlRequest = new URLRequest(‘doc.xml’)
    var urlVariables = new URLVariables()
    urlVariables.foo = bar
    urlRequest.data = urlVariables
    loader.addEventListener(IOErrorEvent.IOError, onError)
    loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onError);
    loader.addEventListener(Event.COMPLETE, onComplete)


    How verbose is that? I am still trying to figure out why every request needs a URLRequest object, seems unnecessary. just calling urlLoader.load(“data.xml”) could automatically create a URLRequest object, if you ever want to examine a request post it being called. Another huge problem is most developers I know dont actually add the error event listeners, just cause adding it is so tiresome. So when an error occurs later, they are usually clueless to what happened (was it a code bug or did some http call out just did not work?).

    The URLRequest param for navigateToURL seems another one of those requirements that seem unnecessary.

  3. Whoops, forgot my addChild
  4. I think this is where I have lost countless hours, I would create a sprite, and set its properties, but forget to add it to the stage…and then spend too much time to figure out what did I do wrong. The only way to create a new UI element in AS2 was by referencing an already added MovieClip (remember my_mc.createEmptyMovieClip() ?). I would love to have a createAndAdd function in DisplayObjects that becomes the default way of creating new Sprites.

  5. Dynamic drawing: The graphics object
  6. Drawing in AS2 was simpler: MovieClip.lineTo(….). In AS3 it has to be on the graphics context of the DisplayObject (mySprite.graphics.lineTo() ), but why? There isnt any other context to draw on, and the graphics context isnt swappable, so why do I have to type that in?

  7. No numeric depths
  8. In AS2, you could set explicit depth numbers to elements and reorder elements under those depths. So for example, if you were writing a button control, you could set the label field up on depth 1000 and keep swapping out the children under it. In AS2, you have to track where in the display tree your element is.

  9. useHandCursor vs ButtonMode + useHandCursor
  10. I dont know what buttonMode does besides actually allow me to useHandCursor property, which I have to set anyway

  11. No onReleaseOutside
  12. This one also is weird. The way we now have to do an onReleaseOutside is via listening to a stage click event. But wait, you may not be on stage yet, so you need to check : if(stage), and also write an event listener to the addedToStage event. Verbose.

  13. addEventListener vs. onRelease
  14. onRelease (and similar “on…” functions) is not a bad default hook to have. Considering how often we write these functions, having a quick shortcut to the action was nice. Not that I am saying the event model is bad, but I end up writing a lot of addEventListeners and removeEventListener throughout the code.

I think overall, when I look at an AS3 file, it just seems longer than AS2 code used to. I think everything needs to be very explicitly set in AS3 with no smart defaults. Maybe that’ll change in AS4 now that we no longer care for the ECMA spec ;). There are a lot of improvements in AS3 as well though, like actually having private and protected namespaces, but I am only listing out my pet peeves here hoping Mike takes note :). Flash is an amazing platform, and I love what it enables me to do.

Isn’t quality code a feature ?

I have had a few conversations with some fellow developers here and there (most often with Mat) around code quality, and sometimes I get really frustrated to see what passes for “Good enough for now” code. In user interface development, its very easy to confuse all work with all visually displayable features. But when you are going to live with the code for a while or this code is going to be the foundation of later features, how can you not track code quality?

And of course there are extremes to that argument. I have worked with enough wannabe-architects who want the code to be pristine and who would much rather write their perfect piece of software no matter what the cost (in terms of time, features dropped or developer-pay) is. They should be tarred and feathered cause they weaken the valid calls for code quality.

But there has to be a middle ground here. The problem is well-written code is hard to quantify. Features are blessed with visibility but architecture isn’t. I had a conversation with a friend yesterday on how I prefer being a developer to a designer since design is so subjective, and what I might think is wonderful design may be pooh-poohed by someone else (worse, my theoretical manager), but code either works or it doesn’t and thats instant feedback.

Software architecture or “well-written code” seems to suffer from the same problem of subjectivity as design to some extent. And if you are fortunate enough to actually have a conversation around code quality (and I dont mean in the theoretical sense but you actually sit down and review what you have written), its lack of visible benefits to the product makes it one of the first things to be dropped when trying to make deadlines.

How do you quantify code quality then? As a developer I can tell you it has real returns. In my (Flash) world it sometimes translates to faster load times, less taxing of the CPU, smaller number of classes to be maintained, but its really hard to measure. How do you say the swf weighing 300k is worth the extra couple of weeks than a swf weighing 600k that was never written but would have if checks on code quality weren’t there. How do you measure against something that never existed ! Worse, how do you track that when there is no feature that maps to lighter swfs ?

And then there are the the really invisibles: dead code paths within code, extra classes that you dont use or are so badly written that they are such pain to work with that other developer on the project just writes new classes with the same functionality? How do you check such things? How do you justify investment in tools that enable high quality code ?

Heck, if you had to justify version control, how would you? Thank God some things like that dont have to be justified anymore but when will that stature be given to tools like Review-Board. Is code quality just a developer itch ?

Do you track code quality ? How ? Do you use any particular tools ? Do you have coding standards ? Please share your thoughts here, cause I am really curious.

Does good code-base just accidentally happen to get written or is there a process to get to it ?

Re: Bit-101 on putting the Flash back in Flash

I have this love/hate thing going with Flex off late (if you know me personally, this would be no surprise to you). While I do love the Flex IDE with code completion and language intelligence, the Flex apps that I see on the web are a far cry from the kind of experiences that got me into Flash. So when I heard Keith Peters, aka Bit-101, gave a talk on “Bringing the Flash back into Flash” at Flash Forward ’08, I pinged him over Twitter asking him if he could share what he presented (as I am sure others did as well). So he did and it was a good read, I strongly recommend reading it here.

Having worked a lot with both technologies, I kind of feel let down by both of them just about as much. Unlike Keith, the experience I would like to see isn’t the ostentatious experiences that made 2advanced and such studios famous. While they definitely caught the eye, the crazy zap zoom effects wear thin on the second or third visit. The experience I would like to see Flash/Flex enable is closer to the experiences that Apple seems to enable (disclaimer: I am no Apple fanboy, and find a lot of things they do completely wrong). They are simpler effects but dont make you stop doing what you are doing and wait till the animation ends. I love my IPhone and just compare the experience there to any other Flash experience on a RIA. Both Flash and Flex fail pretty bad on that front. Here is why:

Flex 2/3:

  • Poor user experience by default
  • I dont get it how the core Flex 3 experience is acceptable by Flex developers. Non scrolling lists ? C’mon ! No control over itemRenderers in List controls (can you grow one’s width and height without having it clipped off by its neighbour ? ). Hacks to get any kind of custom Tooltips ? These are few in a long list of gripes I have with the framework

  • Really hard to extend core components
  • Its really amazing how hard it is to extend any Flex component, so much so that entire frameworks have been built just to do that (read about OpenFlux here). Flex 4 promises to ease this but thats still a year away.

  • Tightly coupled framework
  • It really kills me how tightly coupled the Flex framework is. There is no way to use, for example, just the collections framework without pulling in the UI framework. Why cant dataBinding be used in pure AS3 projects ?

  • Transitions/Effects an afterthought
  • Out of the box, Flex has no effects or transitions built in. So you have to explicitly create transitions but I wish out of the box some effects were enabled.

  • File Size
  • The huge swf size of a Flex app makes it unusable for any kind of widgets or smaller dimension swfs, and Flex 4 will not change this (their roadmap states that Flex 4 files will be around the same file size as Flex 3). The size of the swf goes beyond the load time. Heavy core objects mean they are more taxing on your CPU, which explains why complex animations with more than a few UIComponent objects stutter.


  • Really poor code editor
  • The quality of the code editor is really poor in Flash, enough for me to never use it.

  • Version control nightmare
  • Any code within the timeline is a nightmare for version control so you have no idea when your project is a few months old what the changes were. Same thing with any changes to a graphical element.

  • Write everything from scratch
  • I am not a fan of the Flash components architecture, which offers less capabilities than the Flex component set. So I end up writing components from scratch.

So what I am really looking for is a framework I can use in Flex Builder that is lighter than Flex and is more expressive by default. I have been working on a project that may enable those features that I am hoping to release soon, so do stay tuned.

Starting a new blog

One is such a lonely number ;). This weekend I launched a new blog:The ‘Pit Stop at http://arpitmathur.com. Unlike Code Zen (this blog), where I have tried really hard to keep personal commentary to a minimum and make it as developer focused as I could with a lot of source code and tips for web development, the new one is going to be more on my opinions on (among other things) the social web and the evolution of the online experience from a geek’s point of view. More on the why here. In the meanwhile, this blog will remain the outlet for all my developer focussed stuff (I am still a coder at work).

Do let me know what you think and please add The ‘Pit Stop to your feed readers.


Code Zen added to RIA.alltop.com

Yup. This blog is now aggregated by Guy Kawasaki‘s latest project: alltop.com. Specifically, http://ria.alltop.com, the channel dedicated to Rich Internet Applications. I share the space with some pretty big guns in the RIA domain, so thats pretty exciting :). For those not in the know, alltop is a site aggregating top shelf content from across the web across different subjects, and present them in an easy to scan layout (very popurls, which I love ๐Ÿ˜‰ ). So do check out the different channels on alltop.com and see if you like it.

Dayum, have to up the quality of my posts now. No pressure, no pressure …