iGetIt! Music

Online music education courseware for non-musicians who want to learn how to write their own rock songs.

My Photo
Name: Jim Plamondon
Location: Austin, Texas, United States

This blog documents the development of JIMS iGetIt! Music System (JIMS). JIMS' goal is to help you Understand Music in 24 Hours™, if you are (a) a non-musician (b) who wants to learn how to write your own rock songs. Requiring no instrument other than your own computer, and without using traditional notation, JIMS is being designed to deliver a deep understanding of tonal structure...in just 24 hours.

Friday, April 17, 2009

Constructors, source code, and best practices

In my earlier post What I Hate About Computer Programming, I described a series of failed attempts and work-arounds that I flailed through in an attempt to solve a given problem.

In it, I wrote:
The right time to add these event listeners is when the PitchSlider's instance is done being created. The Slider class' superclass, UIComponent, has a nice little "creationCompleteHandler()" method that's called at just the right time, too.

Well, apparently, the right time to add such event listeners is in the view's constructors, which I would have thought was WAY too early in the construction/initialization process. The constructor happens to be one of the few methods that isn't marked as "mx_internal" (because it can't be, being a constructor, and all).

How did I learn this? By studying the source code to Adobe's Flex framework, which is installed along with the Flex SDK.

I've spent much of the last few days doing nothing but studying Flex's source code. There's no better tool for learning a framework that walking through its source code, both linearly (reading straight through a file) and interactively (stepping through it with a debugger). That's how I learned to use MacApp (the first widely-used application framework for personal computers) back in the mid-1980's. I don't think there were any books on MacApp then; the source was the only info available. You can hardly walk through a bookstore today without tripping over books on Flex, which is great, but nothing beats access to the source code.

As I said about MacApp "back in the day,"
MacApp is not just a bunch of user interface code, it is a library of accumulated wisdom on Macintosh programming.

These days, "accumulated wisdom" is called "best practice," but it's the same idea.

The more things change...

Labels: , , , ,

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home