Pet Theory header image 5

Entries Tagged as 'code'

You already know what unit testing is.

August 6th, 2008 No Comments

Today I learned how to use rspec, the Rails plugin. It was my first experience with unit testing, and it seemed eerily familiar.
You know when you write a class and then instantiate it and throw a couple of curveballs at it just to make sure it works? And then you write a related class, and […]

Tags: code

OOP Old Hand, Table-Design Newbie

July 23rd, 2008 No Comments

There are tons of posts out there from back-end wizards who have seen the light when it comes to object orientation. This post has a few quick pointers for those going in the opposite direction, front-enders like myself who are OOP-fluent but just starting to lift the lid on the back-end and peer into the […]

Tags: code

Faster development with AS3?

October 16th, 2007 15 Comments

I was talking with my boss tonite about a big project coming up. He was explaining that a client was thinking of building a new site in AS2. I was dismayed. After developing with AS3 for a while, I was doing some AS2 work and hating it. After AS1, AS2 was a godsend, but […]

Tags: workflow · code · office

The Joy of Programming

October 3rd, 2007 4 Comments

I was 35 when I started to program. And immediately I loved it. It was as if a part of my brain that had been locked away could suddenly cavort in the broad daylight of ongoing life.
Having developed other skills and burnt though other passions, I was self-conscious about the joys of programming; I […]

Tags: culture · code · random

Building Pet 8: Structure for an HTML-Like All-Flash Site

May 19th, 2007 5 Comments

In the first post of this series, I explained why I wanted features like long-term flexibility, deep linking, history, and background loading for my new, all-Flash playground site, pet-theory.com. I also explained why I used design patterns to meet these requirements.
In subsequent posts, I explained how it was done, focusing on one design pattern per […]

Tags: patterns · code

Building Pet 7: The Command Pattern for History

May 10th, 2007 1 Comment

When they implement history at all, all-Flash sites tend to offer history-like gestures like a Back/Home/Before arrow in lieu of the actual, click-by-click back- and forward-tracking of a browser.
This degradation of a useful and universally expected feature usually makes navigating these sites awkward, often painful.
So I decided (after preliminary reflections recorded in this post) […]

Tags: patterns · code

Building Pet 6: The Composite Pattern for a Background Loading Queue

May 10th, 2007 1 Comment

The basic operation of the composite pattern is easily grasped. Composite is another wrapper pattern that involves one object rerouting method calls to another object with the same interface.
Graphed, it looks nearly identical to the state pattern. Remember that with state, a wrapping object relays method calls to any one of a number of […]

Tags: patterns · code

Building Pet 4: Interfaces for Loading

May 8th, 2007 1 Comment

I was acquainted with interfaces before I read Head First Design Patterns, but their full glory was hidden from me.

Tags: patterns · code

Building Pet 3: The Mediator Pattern for App Files

May 8th, 2007 No Comments

I remember vividly the first time I opened up the Actionscript panel in the Flash IDE and wrote one line in the heretofore untouched panel:
PLAIN TEXT
Actionscript:

myApp=new Application(_root);

It was a special moment because this lightning-stab of a line both compressed and expressed a week of work. Ctrl-Enter...and...SWISH!
Between that moment and moment I cracked open [...]

Tags: patterns · code

Building Pet 2: The Strategy Pattern for Navigation

May 7th, 2007 No Comments

I wanted things for my playground--not only history, but deep linking and persistence (the site wouldn't automatically reboot when backtracked)--that made a systematic approach to navigation necessary.
At the same time, I hadn't decided on the what of the navigation (the sections), or the how of the navigation (the transitions between the sections), and I didn't [...]

Tags: patterns · code

Building Pet 1: The Need for Patterns

May 7th, 2007 3 Comments

I'm doing a week of posts on how I built my new playground site, pet-theory.com. My three-fold aim is 1) to introduce designs patterns to those unfamiliar to them, 2) to give a soup-to-nuts example of architecting a site, and 3) to suggest solutions to some problems common to all-Flash sites.
I'm no expert on patterns [...]

Tags: patterns · code

flexbuilder update gotcha: package/var name collision

January 8th, 2007 1 Comment

After updating my trial of FlexBuilder to 2.0.1 (OS X), a slew of errors appeared in my AS3 projects.
I had gotten in the habit of using the same name for 1) a package, 2) the most important class in that package, and 3) a reference to that class in another class.
So for instance:
import alertBox.AlertBox;
...
protected var [...]

Tags: code

Packages and AS3 v. AS2 access modifiers introduced

October 27th, 2006 9 Comments

AS2 access modifiers were simple to understand. Each class was like a cohesive object with an outside and an inside. If a property could be accessed from the outside, it was public. If it was used for the inner workings of the class, it was private.

AS3 presents a considerably more jagged picture. Senocular has laid [...]

Tags: code

back-button design-pattern options for Flash

October 17th, 2006 2 Comments

I always figured it was laziness when Flash designers omitted the back button...until I considered implementing one myself. Then I realized that this is another case where the wide-open freedom of Flash leads you directly to ground-up difficulties.
The back-button works so naturally in a browser because HTML presupposes one kind of transition: one page replaces [...]

Tags: interface · patterns · code

why I’m pysched about AS3 packages

July 19th, 2006 3 Comments

Like the vast majority of Flash programmers, I don't come from a science/CS/technology background.
I'll bet my evolution has been mirrored by others:
Phase 1: The Christmas Tree. Code actually HANGS all over the graphics.
Phase 2: The Root. The Christmas Tree is impossible, period. I centralize my code on one frame so all functions can talk to [...]

Tags: code