Review: ActionScript Developer’s Guide to Robotlegs

I recently purchased ActionScript Developer’s Guide to Robotlegs as I’m currently working on a project at work that uses Robotlegs and I thought it might come in handy. The attractive price point plus the 50% offer from O’Reilly definitely helped as well, of course. Since then, I’ve gone through the book and decided to give my point of view from a developer who’s already familiar with Robotlegs.

Basically, if you have

you will basically skim through 60% to 70% of the book. That doesn’t mean that the book isn’t worth your time. In fact, I found the remaining 30% of the book to be remarkably informative and enlightening.

The 2 projects that were used as examples in the book give a nice overview of how real applications should be structured, which is something I didn’t really get a feel of by just looking at the demo bundle.

Chapter 10, which goes into detail on how to test your models, commands, services and mediators, will prove to be a boon if you write tests. (you should!)

Apart from this, there were design tips sprinkled throughout the book about best coding principles for your mediators, services, etc that I found helpful. The authors also highlight some possible signs of code smells in your Robotlegs classes that made me realize I was doing certain things the wrong way. (eg: monolithic mediators, adding/removing children from the view in the mediator, etc).

All things considered, it was a good read for the price point and I would say that it’s a possible purchase for a developer who has worked with Robotlegs before. If you are new to AS3/Flex frameworks, I would definitely recommend getting this as it collects all the relevant information together in one location and drastically reduces the requisite fumbling around that always occurs when one starts off with a new framework.


Game of Thrones Word Cloud Fun

Given the recent interest in Song of Fire and Ice recently due to the HBO premiere of Game of Thrones, I did up the word cloud below for GoT using Wordle
Wordle: Game of Thrones

This is pretty interesting since a SoFaI newbie can draw the following conclusions from looking at the word cloud:

  • Lords and Sers abound in the book
  • Jon, Catelyn, Tyrion, Ned, Dany and Arya all play a pretty major role in the book
  • Pycelle? Not so much
  • etc…

For those who are interested in doing this to their favorite pdfs, here’s the groovy code that I cobbled together to extract the text from pdf:

package extract

import com.itextpdf.text.pdf.PdfReader
import com.itextpdf.text.pdf.parser.PdfTextExtractor

class Book
	def path
	def start
	def end
	def outputFileName

    // start - page in the .pdf you want to start extracting from. No point extracting from preface and content pages
    // end - last page to stop extracting. Not interested in the family descriptions, etc
	Book(path, start, end, outputFileName)
		this.path = path
		this.start = start
		this.end = end
		this.outputFileName = outputFileName

books = []
books.add(new Book("C:\\book1.pdf", 3, 553, "book1.txt"))
books.add(new Book("C:\\book2.pdf", 3, 596, "book2.txt"))

for (eachBook in books)
	reader = new PdfReader(eachBook.path)
	wordList = [];

	for (i in eachBook.start..eachBook.end)
		page = PdfTextExtractor.getTextFromPage(reader, i)
		lines = page.split()
		for (eachWord in lines)
            // Because I only want to capture entities and not ALL the text,
            // the regex below is a naive method to capture only words that start with
            // an uppercase letter, e.g ,Ned\" and have at least 2 characters as there's
            // a good chance that it's an entity. This can be made more sophisticated with time.
			capitalisedWordRegex= /.*?([A-Z][a-zA-Z]+).*/
			matcher = (eachWord =~ capitalisedWordRegex)
			if (matcher.matches())

	outputFile = new File(eachBook.outputFileName)
	for (eachWord in wordList)
		outputFile.withWriterAppend{ file -> file << eachWord + "\n"}
	println "Finished $eachBook.path"

Once you have the output file, you can create your word cloud using by going to Wordle, or you can download Wordle and generate a picture which you can save and use. Here’s some of the clouds I generated.