I’ve recently been working with Gareth over at flexoop.com. He has been creating a more feature rich Date utility class.
As he puts it, “FlexDateUtils expands the Flex date library to be more on par with the date libraries found in many other programming languages. Most of the methods were adopted from ColdFusion as those are very full featured.”
Gareth has done a great job putting this library together.
An interesting conversation has been happening for a while over on flexcoders. The conversation started with a simple question… Whether or not using the Flex framework is a good idea when developing widgets.
First a little background about me.
A little while back, I worked for a small startup named Snapvine. Snapvine currently has many widget offerings, one of which still gets loaded millions of times each week. These widgets are deployed across hundreds of social networks (who knew there were so many). As the lone flash developer in the company, it was my job was to create and maintain all of these widgets.
The great thing about Snapvine was that I was surrounded by brilliant people, we discussed the Flex framework in extraordinary detail, weighing the pros and cons of using such a framework in our widgets.
So that brings me to the whole point of this blog post… pros and cons for building widgets for the Adobe Flash Platform using Flex.
My experience in widget development was mostly focused on development for social networks, so I might say some things that may not apply to other types of widget development.
– Pros –
Flex does a lot of the work for you
Flex does so much of the heavy lifting for us. If you’re ever bored, skim through the Flex documentation. It’s not uncommon for me to find things within the framework I didn’t know existed.
Also, If you haven’t already done so, I highly recommend picking up the O’Reilly Flex 3 Cookbook, or thumbing through it at your local bookstore. I’ve found some really great things in there that I didn’t know about the Flex Framework.
Flex allows quicker development time because there is less code YOU have to write.
Once again, Thanks Adobe… for doing my work for me.
RSLs decrease frequent loading time
The use of Adobe’s Runtime Shared Library significantly reduces multiple loads of your widget. This is because parts of the Flex Framework become cached inside the Flash Player itself. One of the big benefits of the framework RSLs is that not only your widget benefit from them. The framework is cached the first time ANY Flex content, on any site, using framework RSLs is loaded.
One caveat to Runtime Shared Libraries is that you have to configure your widget to utilize them during compilation. They don’t just get used magically. This also means that when you deploy the widget on your web server, you need to also upload and distribute the RSLs.
So if a user visits Picnik, which uses the Flex framework RSLs. Then the user visits a myspace profile page with your widget on it, they wouldn’t download the framework RSLs again (if you and picnik.com are using the same version of the SDK).
Myspace wants users to use Flash Player 9 and above
A while back Adobe and MySpace scratched each other’s back a little bit. Adobe added support for MySpace to disallow navigation events from flash widgets (allowNetworking=”internal”), and MySpace in turn highly recommend users to upgrade to Flash Player 9 (I’m pretty sure they also did this for the video support in Flash Player 9). Myspace did this by prompting users to update their Flash Player if they detected version 8 and below.
That’s a BIG pro for us widget developers, because that means the majority of our widget market is using a player with loads of the features we know and love. At the time of this writing, I’m unsure if MySpace is pushing Flash Player 10, I haven’t noticed it yet.
I’m currently writing this post aboard an airplane at 33,000 feet. Would the person who keeps passing gas, please knock it off, this is an enclosed air system for heaven’s sake.
– Cons –
Flex is huge, comparatively
300 KB is still too big for dial-up. Many people argue that if people are using MySpace on dial-up, that they’re used to slow loading times. It’s not uncommon for a MySpace profile to be littered with hundreds of 100 KB photos, music, etc… However, that brings me to one of my main points.
By keeping your widget small, It’s more than likely going to load prior to other things on the profile. This is key for getting your brand out there. In Snapvine’s case, this meant that before pictures of friends, before the music players, before the slideshows… Snapvine’s logo was spinning on the page.
Bandwidth is expensive
If your goal if for your widget to go viral, bandwidth is something you should consider. It is bandwidth which drives how much money you are going to spend.
This calculator estimates how much it would cost if you were hosting your widget on Amazon S3 (US).
Why is this a con? Using the Flex framework bloats a swf’s file size, and ultimately costs you more money, even if you are using Runtime Shared Libraries.
A simple application which is JUST a combo box, is still 56 KB, even when using Runtime Shared Libraries.
Flex was built primarily for Enterprise Development
This means that lots of the components within the framework, are pretty much useless within widgets. For example, using a datagrid to show massive amounts of data… not really a good use for a widget.
Remember, we’re talking about widgets, not about widgapplications (my spellcheck doesn’t like that word). Most widgets are fairly simple apps. Examples – a music player, slideshow, awesome video slideshow, small game, etc…
Keep your widget fairly simple, if it begins to become too complex, you should probably ask yourself, “Should I be building a 3rd party application (OpenSocial or FBML) instead of a widget?”
It’s hard to selectively use pieces of Flex
I’m not going to say that it is impossible, but loads of classes in the Flex framework are dependent upon each other. Which means that if you’re going to use one Flex class within your widget, it will import ALL of it’s dependencies, whether you use them or not.
– Nate’s opinion –
If I’m building a widget whose soul purpose is to go viral and be loaded millions of times a day, I’m going to write it in straight ActionScript.
Sure, it will take a bit more time, but in the end I’ll save money, have more granular control over my widget, and feel good about myself.
So I’ve been developing Flex since the 1.5 days, and before that using <cfform format="flash">, aka flex-lite. Yet, until recently I haven’t really been too involved with the community… well unless I needed something. I guess I’ve pretty much been self-absorbed and in my own little world.
I’ve now realized that the only reason I’ve ever found what I needed was because someone was willing to share. I know, I know… you knew that already… sometimes I’m one taco short of a combination plate.
So here are the reasons why YOU should get involved with the Flex (and flash) open source world.
I had the opportunity to meet some of the Flex team. And let me tell you, these guys (and girls… ahmmm.. Deepa) really care about this project. I’ve never seen a group so devoted to what they do. If you’ve had the chance to read through the specs that the team is putting online. You will see how well thought out the SDK is.
It’s also not uncommon to see the Adobe team participating within the community. If you’re subscribed to FlexCoders, you’ll frequently see members of the Flex SDK team answering questions and making comments. They also answer questions on the Adobe forums. I’m pretty sure the team at Adobe already has a full plate. Yet, they still contribute to the community. They go above and beyond the call of duty. For example, as I’m writing this post at 10pm PST on a Sunday night, I’m watching Alex Harui answering questions on the FlexCoders mailing list. Thanks Alex.
They’re asking for help!
Most people don’t realize how easy it is to get involved with open source Adobe products. Everyone can (and should) sign up for the Bug and Issue Management System. It’s quick and easy to get setup.
If you’re a developer, become a contributor and submit patches. It’s actually much more painless than I thought it would be. I faxed over my Contributor Agreement and was approved within 20 minutes.
Take matters into your own hands
One thing that I have been guilty of in the past is complaining that the Flex framework, or Flash in general, is missing what I consider no brainers. I found myself saying, “Self, why on earth would the person writing the Date class not think that someone, somewhere would want to change the timezone offset”, or other types of complaints. I soon realized that, Nate you dummy, this is an open source project. Fix it yourself! (again… sometimes I’m slow). It hit me like a ton of bricks: If you build it, they will come… errr…. include it into the framework.
It’s more likely that a feature will be put into the framework if it’s already written for them. Heck, in my previous post I was amazed by how quickly my fix was committed to the code repository. Adobe wants us to help! Which is a great place to move on to my next point.
YOU have a say
YOU have a say! It’s our framework. Sure, maybe Adobe has the final say on most of these things. And sure, Adobe may mark your feature request as deferred. But you know what, since it is open source with a public issue system, you do have a say.
Every user within the Bug and Issue Management System has the option to vote on bugs and features. This isn’t a dictatorship. Adobe has given us to right to vote on issues, and if an issue is getting lots of attention from the community, they will look at it and likely fix it.
You don’t even have to be a programmer (or an expert programmer)
I know there are some of you out there who don’t write code, or people who simply think, “I’m not a good enough programmer to contribute to the SDK”. Well good news, you can be part of the revolution too! You have the ability to contribute quality to the Flex Framework and Flash Platform. Here are few ideas: Submit bugs, submit feature requests, correct spelling mistakes in documentation. Get involved!
In regards to bugs and feature requests, I cannot stress this enough. Before you submit a bug, please… PLEASE… verify that the bug (or feature) doesn’t already exist, do some research before you just willy nilly submit feature requests and bugs. It ends up being counter productive. Other people doing the research you’ve should have done now have to spend time cleaning up the issue system because of duplicates and other issues. Having said that, another thing that helps the community is to browse through the issue tracker looking for duplicates, or general cleanup of the issue tracker. If you find something that needs to be cleaned up you can report it to Adobe and they will take care of it.
Anything that reduces the time others have to spend wading through issues is a good thing. It means that the people who are writing fixes to the issues spend less time in the bug system, and more time fixing the issues themselves.
FlexCoders Mailing List
Now I should mention, that FlexCoders is not a mailing list that is controlled by Adobe. It was started by a group of developers within the community. I’ve been following the list for a very long time, and frankly it’s kind of annoying. I’ll be in the middle of typing out a response to a question, when gmail pops up to tell me the conversation has been updated. Maybe it’s just bad timing, but it always seems that someone else beats me to the punch.
Another great thing about FlexCoders is the people that post there regularly. I usually end up laughing over some debate or a nerdy joke that someone included in their response.
Flash isn’t going anywhere
Let’s be honest here, against Silverlight… and whatever Sun, Google, Apple and everyone else is cooking up, The Flash platform is here to stay. With a ~90% client install base, and a large development following. I don’t foresee Adobe taking their ball and going home.
So what does that mean for us developers? We have a stable, time tested platform to develop on. We don’t need to worry about the Adobe going under.
The last point that I want to make… I’m proud to be a Flash developer. Looking at code that I submitted now being part of the Flex SDK just makes a person feel good. I’m beginning to understand why the Adobe Team puts so much dedication into this platform. And I have to admit, that dedication and devotion is contagious.