| «« CD Run | When Does It End? »» |
|
About
I'm Ryan Lowe, a Software Engineering graduate living in Ottawa, Canada. I like agile software development and Ruby on Rails.
I write this blog in Canadian English and don't use a spell checker. Typos happen.
Projects
» Full-time Ruby on Rails freelancer
» Full-time with Rails since May 2005 » Former committer for RadRails (now Aptana) » I also have a few Rails side-projects in development: 1. wheretogoinTO.com Toronto nightlife 2. Hey Heads Up! TODO list and sharing 3. Layered Genealogy family history research 4. foos for foosball scoring 5. fanconcert for music fans (on hold) Hiring Rails developers? I can telecommute by the hour from Ottawa, Canada »» Email: rails AT ryanlowe DOT ca
BulletBlog
Now hosted on Hey! Heads Up -- check it out!
Syndication
Pings
Recent
Derek Lowe's (Ryan's older brother) words at Ryan's funeral
blog@ryanlowe.ca no more Forging Email Headers: Good, Bad or Ugly? Sarcastic Dictionary (Part 1 of Many) Tags Hierarchies Twisting Rails is Risky Business Risky Business? My Take on Early Alphas Whoa, it's August 2007 Closing Comments A Postscript to "Growth at the grassroots" »» All Blog Posts
Linkage
del.icio.us/ryanlowe
technorati/ryanlowe.ca/blog Aurora Roy Jim Andrew Trasker Travis Kibbee Karen Dr. Unk Ayana Van Bloggers Joel Spolsky Robert Scoble Tim Bray Dave Winer Raymond Chen James Robertson Ruby/Rails Bloggers rubyonrails.org weblog David Heinemeier Hansson Dave Thomas James Duncan Davidson Mike Clark Jamis Buck Signal vs. Noise Tobias Luetke Amy Hoy: (24)slash7 Jeremy Voorhis Eclipse Bloggers Planet Eclipse EclipseZone Luis de la Rosa Eclipse Foundation Kim Horne Billy Biggs Ian Skerrett Mike Milinkovich Bjorn Freeman-Benson Denis Roy
Archives
|
AudioMan's Controller
Things are progressing well with AudioMan but I'm going slowly making sure I don't miss any tests. I've also cleaned up a lot of the APIs for the repository and file packages that had gathered cruft. I'm starting on the controller part of the program now. If you remember the diagram from a few days ago, the controller is told by the GUI what to put in the models, which are in turn displayed by the GUI. So the controller controls what goes in the models and that's what the GUI displays (the view). Remember when I was talking about updating the models from the mutators? Well this didn't make much sense. The controller updates the model, so the mutator should tell the controller something happened and then the controller will respond to that. So far in the controller I've invented an object called TrackFilter based on the FilenameFilter interface in the Java libraries. As an aside, it's useful to read about these libraries because they can give you good ideas for your own programs. Anyway, the TrackFilter constructor takes three parameters: playlist, artist and album. It also has a method named boolean accept(AudioData), which takes a track as input and decides whether or not it matches the criteria given in the constructor. So for example, if the GUI wants to display all of the Ricky Martin *cough* songs I have in my entire collection, I'll make this object: TrackFilter tfRicky = new TrackFilter(IRepository.COLLECTION, "Ricky Martin", null); and pass it to the controller. The first parameter is the playlist, in this case the whole collection (as a constant). The second parameter is the artist and the third is the album (where null is "all"). The first thing the controller will do is clear the artist, album and track models. Then it will ask the repository for all of the Ricky Martin tracks in the collection and add them one by one to the models. So let's say I want to add another Ricky Martin track while the view is already displaying Ricky Martin tracks. The view needs to be updated by the models which are updated by the controller to show this new track. The mutator, which does additions and removals from the collection, will tell the controller that a new track has been added. The controller then uses the boolean accept(AudioData) method that was passed to it to determine whether or not the models should be notified about that new track being added. If so, it adds the track to the models. So while a view it being displayed it doesn't have to be completely reloaded if an addition or removal occurs. If the track passes the controller's filter it will be added to the models and appear in the user interface. Posted at February 04, 2004 at 06:44 PM ESTLast updated February 04, 2004 at 06:44 PM EST Comments
|