« Anxiety Sets in Now | Main | A New New Apartment »

June 29, 2004

Apartment Hunt, Part 1

Yesterday, Alex, Nathan and I went up to Española to hunt for an apartment. The results were pretty bad; we saw two houses and one apartment complex. The first house was an utter dump: uneven non-level floors, ratty furniture, and overall bad repair. The second one was much nicer, a small 2-bedroom with little strange heating and no A/C. I liked the landlady at the second one, a kind blind old woman who was very honest with us about things. She did manage to say that it was a nice neighborhood even though her shovels and rakes disappear, which made Alex nervous. It wasn't the property she wanted, though I think I could have lived there.

The apartment we saw was a gorgeous, modern place only 3 years old. It had three bedroom palaces with tons of space and a floorplan that made it feel like a house on the inside. It also only accepts section 8 housing, meaning we make too much money to live there. Ironic, that the only place in Española that both Alex and I wanted to live in, we couldn't because it is reserved for lower-income families. This must be what turns people Republican.

We stopped by Michael's office and showed him the code. He was surprised by the presence of 2 classes, apparently most of their code is not particulary object-y. I get the feeling they have a limited grasp of OO design, which is kind of my specialty. Michael immediately found an off-by-one error in my code such that when you open a story, you get the one after the one you click on. Apparently I got my array numbering mixed up. I'm not sure if it was because I am used to BASICs where arrays start at 1, or if it was because I am used to C-like languages where arrays start at 0; I'll track that down a little later on.

All of this Mac action has re-sparked my interest in developing Cocoa applications. I spent a few hours last night reading documentation online to see what it's going to take to make a proper Slashdot viewer app in Cocoa. The Cocoa framework is heavily dependent on delegation, I guess, as an alternative to inheritance. Where in Python we would do something like inherit from ContentHandler and hand that to the parser, in Cocoa, we instead make a class that implements some of the methods in the so-called “informal interface” for delegates of the NSXMLParser, then we instantiate one and stick it in the NSXMLParser's delegate attribute. Or, to make a nice dock menu for your program, you make a class that implements “applicationDockMenu” and set that to be your delegate.

This design seems to minimize the amount of inheritance going on, which is something you want to do in a single-inheritance language like Objective-C. It will also imply the creation of a plethora of little classes with names like “myApplicationDelegate” which is where all the customization would take place, unless there is a way to stack delegates, which would be cool and seems like the kind of thing they would make (applying the “composite” or “chain of responsibility” patterns).

The framework really is beautiful, and designed for maximum reusability and minimum of changing your code to get at improvements. The cost seems to be in terms of complexity: getting a URL in REALbasic is simply creating a new HTTPServer and calling Get() with the URL as a parameter. In Cocoa, we have NSURL, NSURLHandle, NSURLConnection, NSURLDownload, NSURLCache, NSURLRequest, NSURLResponse, and NSCachedURLResponse. To fetch something and have it cached as I intend to will involve probably only about five lines of code when all is said and done, but you see the complexity here can be described as fairly vast.

By the way, if anyone wants a cookie, they could read URL Loading System Overview and see if it makes sense to them.

So, that's about all for today. Tonight we're eating with Hillary and then going and saying goodbye to Salem and picking the remainder of Alex's stuff and my MD player. Tomorrow we're heading back up to Espanola to find somewhere to live, which hopefully will bear fruit unlike Monday.

Posted by FusionGyro at June 29, 2004 10:27 AM