Monthly Archive for October, 2009

Truckin’ Through ActionScript 3.0 MVC: Part III—An Analog Compass

Truckin' thru MVC

Truckin' thru MVC

It’s been a busy month, and finishing up a simple MVC example took me longer than I expected. Chandima’s chapter (Chapter 12) lighted the way, and I also found valuable ActionScript 3.0 examples by Bill Trikojus and Anthony Kolber . So if you experience a sense of déjà vu, it’s from the MVC’s by Chandima, Bill and Anthony.

Taking Control

In Part II of this series on the MVC, we saw how we could separate the Model (data provider) from the View (a representation of the Model’s data—a graphic compass.) The process was simple enough, especially since all we needed from the Model was a value between 0 and 360. We made it even simpler by using constants with cardinal directions. In this final piece of the MVC puzzle, we’re adding a Controller class. The Gang of Four state that the

…Controller defines the way the user interface reacts to the user input

The UI for the controller is a Slider component set up with values ranging from 0 to 360. The View class instantiates the Sldier with Slider change events sent to the Controller class. In turn the Controller sends the Slider values to the Model, which updates its current value. The update is sent to the View class which rotates the compass needle.
Continue reading ‘Truckin’ Through ActionScript 3.0 MVC: Part III—An Analog Compass’

  • Share/Bookmark

More OOP Principle Analogies

At this last OOPSLA conference I was talking with one of the European participants about remembering the different principles, and he showed me this series of images based of SOLID principles. The SOLID principles are from the acronym:

S: Single responsibility principle
O: Open closed principle
L: Liskov substitution principle
I: Interface segregation principle
D: Dependency inversion principle

My favorite is the giant Swiss Army Knife in the Single responsibility principle:

single

Now, whenever I start loading up a class with more functions than the giant Swiss Army Knife, I’m reminded to throttle back! You’ll have a lot of fun at LosTechies.com with other articles on design patterns and OOP. They’re not ActionScript, but they’re informative.

  • Share/Bookmark

OOPSLA 2009: Hope to See Some ActionScripters!

Tomorrow morning bright and early I’m off to Orlando, Florida for the 2009 Object Oriented Programming and System Languages Association (OOPSLA) annual meetings. I’ll be making an ActionScript 3.0 presentation in a workshop on Sunday. Our workshop is named “Good Examples for Exposing Bad Practice” and meets in Pastoral 3 from 8:30-5:00 (Oct 25) Mine is based on the ‘Wrong Way Warrior”; so it should be familiar. On Monday, I’ll be at the Educators Symposium all day, and I would really like to meet other ActionScripters who might be at the conference

Here are some other speakers you might want to hear/meet:
1. Miško Hevery
Automatic Dependency Injection In The Land Of Dynamic Languages

2. Barbara Liskov (Liskov Principle)
Keynote Speaker

3. Ralph Johnson (GoF)
Regrowing a Language: Refactoring Tools Allow Programming Languages to Evolve

Anyway, just in case any of you will be there, drop by one of the sessions. Everyone’s been very accepting of ActionScript 3.0, and it’d be fun to chat with some fellow ActionScripters!

  • Share/Bookmark

Mansions in the Slum: The Case of Beautiful Algorithms and Disappointing Designs

Some years back when I was flying with Flying Samaritans, I was invited to a party for a fellow pilot in Beverly Hills, California. Since the party involved a good deal of celebration, I had to stay over—no way I was going to fly back to San Diego that evening. The house we stayed in was a classic early California-Spanish design; a beauty in every way. The next morning, bright and early, I went for a walk along well-tended streets where no pothole or crack in the pavement dared to show itself. The streets were immaculate, as were the sidewalks and everything between the houses along and off Beverly Drive.
Continue reading ‘Mansions in the Slum: The Case of Beautiful Algorithms and Disappointing Designs’

  • Share/Bookmark

Truckin’ Through ActionScript 3.0 MVC: Part II—Reality Sui Generis or Collection of Spare Parts?

Truckin' thru MVC

Truckin' thru MVC

I was going over Chapter 12 in our book that Chandima wrote on the MVC. It’s one of those chapters that has everything you need to get started on the MVC; so, I’ll use it as an anchor for my comments and make references to different parts of it to so as not to be redundant—in other words I won’t repeat what Chandima has so well and clearly stated. Instead, I want to focus on moving toward problem-solving using larger structures.

Straws and Stacks: MVC as a Reality sui generis

Years ago in an introductory sociology course, I became acquainted with the concept of a reality sui generis. Some of you may have come across the term elsewhere with different meanings in different contexts. Biology, law and political science have their contextual uses of the term, but the one we’re using here is the one from sociology. Emile Durkheim employed the term in his work, Suicide, to describe a social fact. For Durkheim, a social fact is a phenomenon of social behavior not reducible to its component parts. A bureaucracy is an organizational arrangement that we think of independent of those who actually make up the bureaucracy. It is a reality sui generis—a reality in and of itself. So, we can study phenomenon like families, groups, and organizations as being separate from the people who make them up. Each has characteristics that cannot be seen in the individuals.

To help us understand the concept, we were given the example of a stack and the individual straws that make up the stack. Straws and stacks have wholly different features even though one exists because of the other. By the same token, the MVC, while made up of objects, has characteristics independent of those objects. So, we might envision the MVC as a reality sui generis.
Continue reading ‘Truckin’ Through ActionScript 3.0 MVC: Part II—Reality Sui Generis or Collection of Spare Parts?’

  • Share/Bookmark