Joan Llenas

thoughts on software developement

Refactoring closures to strategies

Sometimes you need to expose a feature of your API as a function reference in order to allow the execution of that feature in a custom way.
This kind of functions are known as closures.
A closure is basically a function reference that is executed within a particular scope, being able to access any scope member through argument passing.
This feature is very powerful as it enables the injection of external logic into an encapsulated scope, but has the drawback that there’s no way of knowing whether a given function will satisfy its target closure’s signature.
Languages like C# have a feature called delegates that enable closures to be type safe. ActionScript does not, so we have to make use of other OOP features in order to overcome the limitations that the use of closures impose us.
Read the rest of this entry »

Three new books on my shelf

Not yet but they are on a plane flying way home…

  • Clean Code: I have had the pleasure of reading the first hundred pages or so and I must admit that the book, for which I was kind of sceptical initially, has surprised me a lot in a positive way.
    As far as I understand it, the book is about writing code in a way that is easy maintainable, easy to read and ultimately a fun and a pleasure to work with. Everything a piece of software aims to become, in a grammatical / semantical way, it’s somehow explained in this book.
    If you liked “The Pragmatic Programmer” it’s very likely that you’ll enjoy this one as well.
  • Patterns of Enterprise Application Architecture: This sourcebook is a must have in any Enterprise focused software company bookshelf. If you have it at the office you’ll probably end up buying it yourself as I did… The title speaks by itself, so do the book author name.
  • UML distilled: This was the book that introduced me to UML modeling. Coining a piece of one of the book’s review: “It is still arguably the best resource for quick, no-nonsense explanations of using UML”.
    The book covers not only the notation but also a detailed description of actual purpose of each diagram type.

Read the rest of this entry »

Engine start

This blog will focus on different software development related topics that I could be interested in such coding best practices, architecture, (software) design or development methodologies. The accent will be put on Flex and ActionScript as these are the technologies that I use the most but I will cover PHP, Java and eventually any other language that I could be learning at that moment.
It’s worth mentioning that English is not my mother language so be ready to read some syntactical atrocities and grammatical nonsenses from time to time.
Stay tunned!