So Matt Chotin has an excellent post on his new blog, regarding the paging of large data sets. As well as working as a developer on the Flex product itself, and providing an invaluable support to the beta community during its development, Matt has filled his spare time technical editing our forthcoming book, Developing Rich Clients with Macromedia Flex.
We’ll post more about the book shortly, but it’s worth noting that the documentation that ships with Flex 1.0 is incredibly good – the Central team have been applauded for their documentation, and the Flex team should be also. On one hand, it’s made our job as authors more challenging, but on the other hand, it’s allowed us to dig a little deeper into Flex application development, focussing on best-practices and engineering of large-scale apps.
In the various discussions we’ve bounced back and forth with Matt, we discussed this idea of large data sets, and Matt has produced an excellent solution with his Implicit Paging implementation. The solution is an implementation of the Core J2EE Pattern called the Value List Handler, which we’ve used at iteration::two for a number of years now, when developing JSP applications.
The Value List Handler
When the number of items in a list is unknown, and typically large, the value list handler can be used to control the search, provide a means of traversing the result set, and in more complex implementations, can even be responsible for caching of the result set. In Reality J2EE, ActionScript 2.0 Design Patterns for Rich Internet Applications, and in the forthcoming Developing Rich Clients with Macromedia Flex, we advocate the use of the Value Object pattern (also known as the Data Transfer Object pattern) , to represent business objects using a consistent object model on the client and the server. The Value List Handler is a utility pattern that is able to page a set of value objects – with JSP, the pattern works in a request/response fashion, with the typical “list of pages” at the foot of the JSP notifying the list handler which slice of the dataset to render to the user.
What is so elegant about Matt’s implementation, is the mechanism by which he uses the Data Binding and Event Dispatching capabilities of the underlying Flex Class Library, to provide an interface for a data provider that is able to page a data set “behind the scenes”. By simply using the new data provider interface, a data grid can be populated with a partial dataset, and as the grid is scrolled, the implicit paging data provider will “fetch ahead” new data.
The result – all the benefits of paging large data sets, with an enhanced user-experience; the user is not crippled by the limitations of the browser technology, and forced into a “page based metaphor” where it does not make sense.
iteration::two have long been advocates of applying the design patterns that have emerged in traditional enterprise software development, to RIA development – Matt’s implementation of the Value List Handler pattern is an incredibly useful addition to this catalogue of patterns.