Andrew's (Tumbling) Interwebdiary
A Hideous Triumph of Form and Function
My Own Damn Fault: Sinatra::Base.run! != Rack::Builder#run
Ever had one of those problems that makes you feel like a complete idiot? You tinker and tinker and it’s still there. You recreate an entire configuration file from scratch trying to figure out the…
Cocoa, CoreData, and XCode are sucking my will to live
Recently I tweeted this and got a reply from @pilky asking what in particular was bothering me. Since I had more than 140 characters of gripes, here we go.
Before I get into full rant-mode:
- I’ve liked my iPhone development experience and Cocoa is a compelling platform.
- I’m willing to admit that I might be spoiled. And before you jump to conclusions, yes I am a Ruby developer and most of my experience is in web apps. It’s true, I’m one of them.
- I know things aren’t this way just because people at Apple want me to suffer. They’ve done some impressive things and on the whole, I have a positive opinion of the development environment.
- More than likely, there are perfectly acceptable solutions to some if not most of these. However, I have been following the demo applications fairly closely, so if there’s something better, it’s not exactly obvious.
But, I do have to vent:
Cocoa (Objective-C too, I guess):
- If I want to add a simple accessor, I have to make changes in at least four places! Twice in the header: the instance variable and the
@propertydeclaration. Then twice in the implementation file: once for the@synthesizedeclaration and then release it in thedeallocmethod (granted garbage collection would help, but this is the iPhone). There’s no way to be DRY when the language makes you repeat yourself. When are these lines going to be different? Why can’t there be a terse standard behavior and an expanded 4+ line version for when efficiency or special use cases demand it? - Ridiculously long method names. Sure code completion helps writing them, but what about reading them? How many times do I have to read
tableView:(UITableView *)someTableView cell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath canHasCheeseburger:(Cheeseburger *)cheeseburger? - Namespacing. Ain’t got it. UI, NS, CL, CF, etc. Just don’t like it.
- Numeric constants with tremendously long names. Same complaints as the last two, however given numbers it’s even harder to debug, especially in callback functions when you’re not sure what the API is actually doing.
CoreData:
[NSEntityDescription insertNewObjectForEntityForName:(NSString *)entityName inManagedObjectContext:(NSManagedObjectContext *)context]is a convenience method for creating a new NSManagedObject. That’s convenient?! It’s even less convenient when it silently produces a nil instead of an object because something is wrong with the NSEntityDescription.- No general purpose data viewer. For all of the really excellent development tools, why can’t I specify an xcdatamodel file and a data file and be able to browse it? Best I could get was cd to ~/Library/Application Support/iPhone Simulator/User/Applications/{long application id}/Documents/ and open the sqlite3 command to open it. Given that CoreData does some funky things with it’s DB schema, I’d rather not resort to this. And god help me I were using more of CoreData’s immense and impressive capabilities.
- How many lines does it take to do the equivalent of
SELECT * FROM my_table ORDER BY created_at DESC? I’m counting 12 not including whitespace. And that’s without a predicate. Now, this isn’t just annoying. And before someone says, “Oh look at this guy he doesn’t like typing stuff—what a dumbass” realize how hard this is to query your datastore from a debugger. Wouldn’t it be nice if there was some kind of general purpose data viewer?
Xcode
- Lack of language specific indentation rules. Objective-C uses hard tabs/4. Ruby uses soft tabs/2. And now I have an iPhone app that is soft/2 because I forgot to switch after playing around with MacRuby. :-(
- Autocomplete is sketchy sometimes. The normal argument for why wordy APIs are fine is that “good” IDEs will make it all better. But when I have an instance variable with the same name as a class, autosuggest gives me the class name.
Well, that felt good. Did anyone actually read all of this?
Seventeen Years Ago in Hampton Roads
Excerpt from today’s Ledger-Star
Let’s take a moment to remember an event that occurred on this day 17 years ago: the day Mt Trashmore exploded. Thanks to Tommy Griffiths and Henry “The Bull” del Toro of WNOR, the only members of the local media with the courage to report the seismic anomalies and chemical irregularities, thousands of lives were saved. Though they were warned of the panic that would ensue, their commitment to truth and public safety set an example for local news to come.
“I told them, ‘The people that live around [Trashmore] are just a bunch of ignorant rednecks who’ll eventually die in meth lab explosions or tractor demolition derbies’,” said WAVY-TV 10’s Alveta Ewell. “‘Saving them will only forestall the inevitable’. But Griffiths and del Toro showed me the true measure of a newsman that day and I have striven to atone for my words ever since”.
Others were not so flattering. “For their defiance of the Council of The Trapezoid [the cabal of local news organizations in Hampton Roads], they should have been thrown into the Pit of Argonzac!” said Jim Kincaid, formerly of WVEC from his basalt tower in Elam, Virginia. “But that dastardly FCC stepped in and inflicted their own mediocre punishment before we could act. Oh, the agonies we had in store for them! When a man spends seven months with a broken back in a Vietnamese hospital, he learns a lot about the peripheral nervous system.”
In closing, we have only to say thank you, Tommy and “The Bull”, for you service to our region.
Keys to the cities of Norfolk and Virginia Beach were presented by Mayors Fraim and Sessoms to Griffiths and the del Toro’s widow, Glenda “The Cow” del Toro.
Happy April Fool’s Day to everyone back home.
Mysterious DM-Salesforce Issue Solved!
I did my good turn for the day and wrote up a Salesforce issue on the dm-salesforce project wiki that held me up for an hour or so.
If you’re trying to use the ruby datamapper adapter dm-salesforce to connect to a sandbox and you get “INVALID_LOGIN: Invalid username or password or locked out. (SOAP::FaultError)”, you should take a look. The thing that really held me up was having to clean out my old version from ~/.salesforce.
If your not familiar (warning: irritating singing ahead) with Microsoft Songsmith, it’s an application that adds background music to any song (or any spoken word for that matter).
Overall, the instrumentation is mediocre for a human, yet impressive enough for a completely automated process. I don’t think it’s going to put any musicians out of business, but it’ll enable scores of teenagers and emo-kids to record their “music” without running it through the filter of public scorn first. I fear for us all.
Soooo, how does it compare to the real thing? Some intrepid youtubers are trying to find out. Crazy Train sounds ridiculous. White Wedding actually makes a very interesting blue-grass murder ballot. Eye of the Tiger sounds like Against the Wind. Johnny Cash’s Hurt is ruined forever. And there are more…
Original report and more information from the Christian Science Monitor.
XRVG: Vector graphics library for Ruby
I’m looking forward to trying this out. From its philosophy section:
Nearly every programming toolkit that you may find, in any programming language, instanciates shapes with absolute geometrical coordinates. What that means is that if you want to do graphics programming with them, you rapidly get lost in a list of basic drawing primitives with lots of numbers, without being able to recover the abstract compositional content of the graphic.
Actually, a graphic is foremost a composition of basic shapes and color. It is not their absolute values (that is absolute spatial and color coordinates) but their relations that matters. This is even more true because our visual perceptive chain processes its inputs in a relative way, as paradoxical visual games highlight it.
As a consequence, XRVG strives to get rid of these absolutes, by using shapes and functions as numerical patterns to compute shapes and composition. Thus, if you want to draw five circles in a regular way, you must be able to do it without using trigonometric formulae to figure out where these circles have to be drawn. Instead, you just need to use a first circle and “sample” it five times to have subcircle centers.
Shoes 2 is out!
This looks pretty awesome. The more Shoes grows up, the more it seems like Ruby has finally found its GUI toolkit.


