Different interpretations of MVC in different AS3 books

Lately, I’ve been trying to read everything I can find / have time for on MVC in Actionscript and I noticed how different folks allocate different responsibilities to the Controller.

For example, compare the Controller class from Advanced Actionscript 3 with Design Patterns (MVC Clock in Ch. 3) with the Controller class from a book called Flash Video for Professionals (MVC Video Player in Ch. 5).

The former puts the display objects (input text fields) that grab user input into the Controller class called Clock, via this method: private function createField():TextField. The latter places display objects (next, prev, stop buttons) in a View class called MediaPlayerView. MediaPlayerController has a bunch of methods, like play(e:MouseEvent), that call similarly named methods in the Model, which act on the data it encapsulates.

The approach in the video example, where the Controller has only 1 responsibility, feels more solid. This is similar to the MVC chapter in Head First Design Patterns, where the example Swing application contains display elements that capture user input (buttons and menu) in a View class called DJView.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s