Part 3. Refactoring
Now that we’ve made substantial progress in our application, we’ve added enough code that the design issues are starting to become apparent. First, we notice that we have lots of data and behavior, but we aren’t following a centralized approach—everything feels a little scattered. We’ll address this by refactoring the code to use the Cairngorm framework, which is an application framework for Flex.
Next, we’ll address the issue that there is no object model on the client, just a bunch of XML. We’ll address this by doing a refactoring in which we add an object model.
This part includes two iterations:
- Iteration 8— “Refactoring to Cairngorm”
- Iteration 9— “Holding state on the client properly”
At the end of it, we’ll have a much better understanding of design in Flex and of the options available to us for data exchange between Flex and Rails. Doing the refactoring to decouple the object model from its method of transport (currently XML) will enable us to consider using an alternate method of transport. Two more efficient choices we could use are JSON and RubyAMF.
In the next and final part, we’ll first finish the application and then refactor again (to RubyAMF) because it uses the binary AMF protocol and thus has the most promise of efficiency improvements. Then, as an encore, we’ll convert the application to being an AIR application.