Category Archives: WebObjects

Coding Horror: You’re Doing It Wrong

[From Coding Horror: You’re Doing It Wrong]

Jeff Atwood talks about templating engines (for generating html) being wrong… and I agree, with code like this:

<%foreach (var User in Users) { %>
<div class="action-time"><%= ActionSpan(User)%></div>
<% if (User.IsAnonymous) { %>
<div class="gravatar32"><%= RenderGravatar(User)%></div>
<div class="details"><%= RepSpan(User)%><br/><%= Flair(User)%></div>
<% } else { %>
<div class="anon">anonymous</div>
<% } %>
<% } %>

But, and I might be biased here, the WebObjects approach is much more pure, much more clean, from a markup vs. code point of view.

A quick crack at something similar in WebObjects would look like:

<webobject name="UserRepetition">
<div class="action-time"><webobject name="UserActionSpan"/></div>
<webobject name="IsAnonymousConditional">
<div class="gravatar32"><webobject name="UserGravatar" /></div>
<div class="details"><webobject name="UserRepSpan" /><br/><webobject name="UserFlair" /></div>
</webobject> <webobject name="IsNotAnonymousConditional"> <div class="anon">anonymous</div> </webobject> </webobject>

With a bindings file looking like this:

UserRepetition: WORepetition {
    list = users;
    item = currentUser;
}
UserActionSpan: SomeOtherCustomWOComponentToDisplayThisThingMaybe {
}
IsAnonymousConditional: WOConditional {
    condition = currentUser.isAnonymous;
}
IsNotAnonymousConditional: WOConditional {
    condition = currentUser.isAnonymous;
    negate = true;
}
...

Not too bad, eh? If you’re looking for separating your presentation from your code, well… I don’t think there’s anything better. But then, like I said, I’m biased.

It’s such a shame, with all the comments, that not a one has brought up the Old Lady…

Web – Use the Ruby on Rails Alternative …. ?

Web – Use the Ruby on Rails Alternative:

Ruby on Rails is simpler than J2EE for developing MVC Web applications.

Ugh. If good old Deepak Vohra had used WebObjects maybe he’d have written this article differently. Oh well.

Rails is nice and all, but having done a bit more in depth with it, and done my share of in depth work with WebObjects, I have to say D2W still has yet to be beat. Let alone EOF vs ActiveRecord.

Reading Books…

This is my second (or maybe third) time starting off on Agile Web Development with Rails—Second Edition. Yeah, it’s for work.

From reading through scads of Rails and Ruby code I feel I have an appreciation of the language and framework, for the most part. I still miss WebObjects, a lot, when I have to cobble solutions the Rails way, but that’s ten years of working with WebObjects, I suppose.

The one thing that really, really bugs me about Rails so far isn’t the language, or the framework, it’s the book above. I get to about page 28 (and I’ve only managed this far because I’ve skipped a lot of the overt crap at the beginning) and I feel the urge to… well, to write a boring blog post about how much I don’t like the book. The tone the authors take is nigh on condescending. It’s a Kool-Aid(tm) view on web frameworks. I know that it’s a book about Rails, and how great it is to start programming in Rails, but they tend to attack their fellow scripting languages a little too hard and heavy, and sometimes, it seems to me, blatantly ignore certain solutions that compete more closely with Rails.

WebobjectsI suppose this is the “feature” of opinionated software, which is what coding by convention is, in a sense — one man’s convention is another man’s shackles. And this, I suppose, is where I feel I won’t ever feel at home in Rails code as I would in, say, WebObjects code. Rails likes, really, really likes you to do things its way, which is fine, if a bit bossy. Like the kid down the street who you sometimes play with, but there always wound up being a fight when you wouldn’t follow his directions, trying to best your Q-Bert high score, ending with you storming out, back up home. WebObjects is more like the laid back friend with all the gear: toolbox, Colecovision, guitar, drum set, batting cage, swimming pool, and real working car to tinker on, if you’re so inclined. And he was always cool about it, do whatever you want, and he’d watch you flounder a bit, trying to figure out why the engine of the car wasn’t starting or something when you tried to run an electrical cables from the starter down to the (oh man, here’s where my car knowledge just kills the metaphor), umm, engine, when all the while he was just standing there, not being smug about it, but there was the key in his hand, just waiting to get plugged into that ignition and get you going the easy way.
(Of course, I’d be remiss if I didn’t also note that all of WebObjects’ books around the house happened to be three hundred or so pages thick; it was just that on all three hundred pages was printed “Documentation forthcoming.” :))

WO Chatter

I’ve got to say, it’s nice to see the level of traffic on the webobjects-dev list lately.

Hopefully the latest developments (soon to be released publically) will lead to some interesting efforts by the community.

Cafe Press is even getting some new WO blood.

And the pre-WWDC-inspired shirts from the mailing list: