Tuesday, May 11, 2010

Fluent Sort builder example in ActionScript

After reading Growing Software i created a factory to create sort objects in ActionScript. It allows you to create sorts like this

var s : Sort = new SortBuilder().byField("status").asString().ascending().byField("date").asDate() .descending().build();


I think, it makes the creation of sorts much more readable. However, now i have to refactor the whole codebase and to educate my coworkers to use it. That's the worst part of it ;)


PS. Xavi published a nice introduction to fluent factories.