Flex vs HTML part 2 .. how big ?

Following on from my post yesterday, I’m asking the question to the community, how big can Flex apps get. This is probably the great unknown which makes it hard (on this project) to commit to Flex. I’m not sure if I’m going to get halfway in and strike performance problems or such like (this is just conjecture!). HTML it’s easy, it doesn’t matter how big the app gets you’re always just firing down a single page to the browser - you just have to manage page load times, this (for myself, and I guess anyone getting into Flex) is a little unknown. The questions are

1) Am I crazy trying to develop 1 person ~15hrs a week, given the apps functional list below, over ~6 months
2) Whats a good example app close to this size.
3) What kind of performance impact (if any) is there in adding each new functional area

Flex vs HTML vs Time

The old simple triangle of time vs features vs quality has reared it’s ugly head again. After one particularly unproductive weekend I’ve made the decision to place a hold on the Flex interface for XChain, in favour of a raw HTML interface, sprinkled with AJAX.

I personally hate the decision, being enamored with Flex, I don’t want to make it, but I look at the forward progress I’ve made in the past couple of weeks and it’s been more or less stationary. I’m not trying to deliver the ‘richest’ interface possible, I’m going to deliver a working application.

What impacts my client most, is that they can get their job done.

Using Rails with Flex to manage long running tasks

As soon as you start doing anything with photos sooner or later someone says “It would be really nice to upload these in a zip file”, which then leads into a whole rabbit warren of issues, one of which you will inevitably come across is how to deal with a long running task on the server, in terms of a) getting it to actually complete and b) telling the user what’s going on. There are various hacks for doing these, like running a shell script and writing out tmp files all over the place. Just plain ugly.

Enter Backgroundrb, probably one of the greatest little inventions for Rails. It lets you kick off a background process, outside of the main rails app process, with the option to interact with the rails models or not. The beauty of this plugin is a little thing called MiddleMan, as the name implies it lets you interact with your background processes (Workers) from your Rails app.

XChain - it has a name, license, and home.

XchainThe open source Rails/Flex eCommerce application now has a name - XChain - pronounced cross-chain. I had some air travel time over the weekend and put it to good use coming up with a name, the basic premise being that the app should really be classified as a Supply Chain Management system as it deals with a lot more than simply taking peoples money for a product. (Order fulfillment, shipment tracking, eventually CRM and inventory management), and being a cross of two major technologies it seems to fit. Catchy enough and has meaning. Well I think so anyway, others might disagree - (that’s what the comments form at the bottom is for…), only downer is XChain.com is taken by some spammer, but I’ve snapped up .ca and other appropriate domains.

Essential Actionscript 3 - Essential !

The great chapters.ca boat sailed into port - last week Essential Actionscript 3.0 by Colin Moock arrived on my doorstop. First impressions this is by far the biggest tech book to grace my shelves. 900+ pages worth, it dwarfs O’Reillys recently released Programming Flex 2 book.

This book really does cover everything from general programming skills to the nitty gritty of E4X useage. The work that has gone into this book by Mr Moock shows. Approximately the first ~350 pages of the book is devoted to Core Actionscript & OOP principles in general, the second half Flash/Flex features such as XML, Drawing API, Security etc. Coupled with the Programming Flex 2 book I really think that’s all you need for your bookshelf.

My learning style is to learn by example (I skim read text - but thoroughly read code to understand) which is covered off really well, the vast majority of pages have a short code fragment or diagram to complement the text along with longer full code examples where applicable.

Open Source Rails & Flex eCommerce Application

[Announcement] Rowan Hick Consulting, Canada and Ron Hanley of Fastmount LTD, New Zealand are pleased to annouce that their new Rails/Flex/MySQL eCommerce application will be released to the community under an Open Source license. The application, is a successor to a PHP/MySQL based application developed by Rowan Hick and James McGlinn of Nerdsinc Ltd New Zealand.

After nearly 2 years in production, with the advent of Rails, Flex, and the rapidly growing business needs of Fastmount, the current application no longer meets the business needs of Fastmount. We made the decision early this year to re-write a new application and have been developing requirements for the application as well as evaluating technologies.

The application is a business to business eCommerce system. Allowing a marine manufacturing company in New Zealand to service it’s agents, distributors and customers world wide. The existing application facilitates order management from creation through to shipping tracking, along with customer management and some reporting elements.

Why are we open sourcing ?

Getting started with Flex - what you should know.

Okay, so like me you’ve done a lot of web development with scripting languages ala Ruby, PHP, Perl etc and you’ve decided to try out Flex for a front end. What do you need to know ?

This is just my own humble opinion - take it with a grain of salt, but for those looking to jump in you should find something valuable. This is all encompassed with the caveat that you are using the right tool for the right job, now what ? We know the advantages of using Flex - I’m not going to reiterate them. What I am going to tell you is the things to be aware of - not critiscims.

Flex component development mindset

Having just picked up Programming Flex 2 I was dismayed that components seem (almost) to be an afterthought. Yes they’re documented, with 2 chapters dedicated to them - but the importance of them is from an architecture perspective seems to be glossed over.

After keyboard sized imprints in my forehead for the past day coding. I’m going to say this, definitely develop your Flex applications with a component first approach (well I will anyway!) don’t bother with a cruddy component-less prototype. You will save far more time in the long run designing your app from the ground up with components in mind and skipping the ugly component-less prototype step. Why do you want to do this ?

First hours with Flex 3 / AIR

Small step for man, big step for RIA-kind !

I had to stay up past midnight to be one of the questionably committed few to read the words of joy spread by Ted Patrick. Not more than 2 seconds later I download Flex 3 builder. So far I’ve managed to spend a good solid 3-4 hrs in Builder 3 without any hiccups or crashes.

A little gem of a resource, missed out on the various announcements, are the videos on onflex.org. Check out in particular the refactoring one. Looks like some serious goodness to be toyed with there.

Something tells me Adobe is on a war path with this one, going for bigtime developer buy in and I’m pretty much sold.

Good stuff Adobe! Top marks.

DataGrid - handy hints

Okay the orders list. It’s a plain vanilla DataGrid component bound to the result from an HTTPService call to get an XML representation of an ActiveRecord orders collection. This all pretty easy to get up and running, but I ran into two immediate snags.

Requirement #1 - Multicurrency in the totals column. Our system deals with orders in currencies all over the world, so we have price types and associate each order with a price type. Fair enough. Now we don’t store price type symbol with the total (naturally) so how do we get it to appear in the same column in the the datagrid.

Option 1 (on the Rails side) would be to add some faux accessor and iterate over the orders populating it before we handed it to the to_xml function sending it to Rails (that’s not without it’s problems). OR

Option 2 (on the Flex side) we manipulate it over here. First off we create a little function that takes our current item (row) and the column we’re manipulating, then prepends the symbol and appends the code to the amount.

private function formatCurrency(item:Object, column:DataGridColumn):String
{
   var field:String = column.dataField;
   return item.price_type_dollar_sign+' '+item[field]+’ ‘+item.price_type_symbol;
}

Then in the mxml code for the datagrid

  <mx:DataGridColumn headerText="Total Amount" dataField="total_amount_payable" labelFunction="formatCurrency"/>

Requirement #2 Sorting a field in an order different to that displayed So we have an order status (Draft, Pending Review, Review, Payment Pending, In Manufacturing, Shipped etc). Great, now you put that straight into your datagrid, hit a column header to sort, and realise it’s doing an alpha sort on the status name. As you expect (but not as you wanted). Well again there’s two ways to accomplish this - one is to pass in custom sort function to figure out the order. OR

The other option, is to pipe down in your xml along with the order status name, a sort order numeric value , so Draft is 1 Shipped is 1000, everything in between gets a number etc. Then just as you do for the currency symbol, change the formatting of the column - so we bind our column to the order status sort_order value, but we display the order status name. When the datagrid sorts, it sorts on the bound value, not on the formatted value. Very nifty and simple. Just like this…

private function formatStatus(item:Object, column:DataGridColumn):String
{
    return item.order_status_name;
}
  <mx:DataGridColumn headerText="Status" dataField="order_status_id" labelFunction="formatStatus"/>

No nasty sort function, and does the trick.

That’s it for now… till next time.

Continue Next page

About

Rowan is a Product Development Manager, specialising in architecting, developing and putting web applications into production - in particular Ruby on Rails based apps. He lives in Toronto, Canada but speaks in a funny accent as he's originally from New Zealand. He's been working in the software and web business for over a decade. This blog covers Web Application development and deployment in the real world, dealing with topics from business fundamentals to Ruby on Rails, Merb, PHP, Flex, MySQL, Apache and more.

Read more ...

 

 

View Rowan Hick's profile on LinkedIn

 

Subscribe to my RSS feed