inessential by Brent Simmons

October 2003

NSController

At the OS X conference Scott Anguish did a 90-minute presentation on the new NSController layer in Cocoa.

Here’s a quick summary of what this is about:

Many applications have three different areas of code. One handles the data—that’s called the Model layer. Another handles display—that’s the View layer. A third goes between the first two—the Controller layer.

Cocoa gives you a ton of stuff that for the first two, the Model and View layers. The hard and often tedious part has traditionally between the Controller layer.

A simple example

Imagine a checkbox in a Preferences window. When you check it or un-check it, the preferences for your application updates.

What happens is this: the user checks the box (View layer), then a message is sent to the Controller layer that a checkbox has been checked. The message tells what checkbox was checked and the method can find out whether it was turned on or off. Then that method tells the Model layer to update the on/off flag for a given preference, and it gets saved to disk in the prefs file for that app.

In Cocoa, before NSController, you had to write that method I talked about above. It’s easy but tedious. And if you think about all the different user interface pieces of even a simple app, you see that there’s a bunch of this go-between code to write.

So the idea of NSController is to do a bunch of it for you.

In this simple example, what you do is say that the checkbox is bound to a given key in the prefs. When the checkbox is checked, the new NSController layer updates the prefs. In many cases no code at all is needed.

Complex stuff is handled too

Of course, there’s more to it than just that. NSController can do a ton more than just connecting checkboxes with your preferences and eliminating a little code. It can eliminate a lot of code and handle more complex things like table views and knowing when to enable and disable things and so on.

Drawbacks

For all that coolness, there are still drawbacks—for one thing it requires Panther. That’s not a criticism, because new features come with new operating systems: that’s just the way it goes.

But if you need to support 10.2 (or earlier) in your app then you’ll have to do without NSController.

There have been criticisms of NSController: most notably, Aaron Hillegass criticized NSController in an email to the Cocoa-Dev mailing list. I’m not going to summarize Aaron’s email; instead I’ll say that any developer should think about the points Aaron makes.

Bonus tip

The documentation that comes with the developer tools CD is not as up-to-date as what’s on Apple’s website. So use the on-line docs.

PyObjc

I caught Bill Bumgarner’s presentation on PyObjc at the OS X conference. I was surprised by how complete PyObjc is: according to Bill, it pretty much just works.

You can of course send messages back and forth across the PyObjc bridge: you can call Objective-C from Python and vice versa. You can even subclass Objective-C classes in Python. Things like Web Kit and the new NSController layer work with Python. And with Python you don’t have to deal with memory issues (retain/release/autorelease).

So, while all that’s very cool, I’m not about to switch away from Objective-C. But I can imagine using Python for a few things:

1. XML-RPC and other web services. Python is utterly remarkable as a web services language. I’ve used no other language as nice as Python for this stuff.

2. As a user scripting language. NetNewsWire for instance has a Scripts menu to which you can add AppleScript scripts. It would be cool if you could also put Python scripts in there that have at least the same level of access to NetNewsWire as the AppleScript scripts have. (Actually, it would be easy to give an even bigger level of access.)

3. Writing unit tests. Writing tests should be as frictionless as possible; Python would be a big help here.

I should point out that NetNewsWire already does use Python for one feature, though it’s not using PyObjc: the HTML differences code is a Python script by Aaron Swartz. (NetNewsWire just calls the script on disk via NSTask.)

Shareware

Last night at the Innovators presentation at the O’Reilly OS X conference, Rael Dornfest brought up the old days of Mac shareware. (I immediately thought of Anarchie and MacHTTP; there are other great examples.)

The question got me wondering about the meaning of the word shareware.

I’m not sure what it means these days. My company may be small (my wife, me, and a fierce gray tabby), and we don’t have a physical box for our product, but I don’t think of our business as being fundamentally different from larger software companies. I’ve never called NetNewsWire a shareware app (though other people have, and it doesn’t bother me.)

Three types of companies

You could break software companies down into three groups if you want. One group is the very small—companies like mine, like UserCreations and Flying Meat Software. The next group is the small companies: Bare Bones Software, the Omni Group, and so on. The last group is the large companies: Adobe, Macromedia, Apple, and so on.

What’s common to all three is that they develop and sell software. Some companies have boxes and large advertising budgets, sure, but I don’t think that’s the difference between shareware and commercial software.

You might say that there’s a difference of culture. Many small developers have weblogs, they’re open and accessible, outspoken but also good at listening. (Being good at listening is perhaps the key attribute of a successful small developer.) They are, in short, not corporate.

But the definition of shareware has traditionally had to do with how the software was distributed and not the attributes of the developer. What I think has happened is that the Internet has made even large companies shareware developers. Not long ago I downloaded Adobe Photoshop Elements, evaluated it during a demo period, then bought the software. I did the same thing with Transmit by Panic, which is a far smaller company. The experience was the same.

Is Transmit shareware? Is Photoshop Elements shareware?

Software

I prefer to think that Transmit and Photoshop Elements are, purely and simply, software. Software these days is often distributed online and has an evaluation period built in. Try before you buy. In that sense, I think the shareware model caught on all over the place, so much so that it’s now hard to talk about shareware as being different from the normal practices of software companies.

But... there clearly is something different about small developers. Something to do with weblogs and chat and talking and listening and sharing code and ideas. A community thing.

I just don’t know what to call it. Shareware community isn’t quite right (but I don’t really mind it, either). I’m not sure it needs a name, but maybe a name would be helpful? I don’t know.

Update: further reading

There are some good previous posts on this topic—here’s Buzz Andersen; here’s Slava of Unsanity: Shareware Is Dead.

bash!

I did clean installs of Panther, so I got the defaults of everything, and I discovered that the default shell in Panther is bash!

Given the popularity of bash on Linux that’s probably the right choice. But I’ve been using tcsh since the OS X public beta, and I don’t want to switch.

So, easily enough, I changed my shell to tcsh. In case you’re wondering how to do this, here’s what I did: in NetInfo Manager I navigated to /users/brent, then clicked the lock to make changes, then set the value of the shell property to /bin/tcsh, then I logged out then back in.

Here’s a page on Mac OS X Hints that goes into more detail.

Xcode

As a developer, the thing about Panther that most excites me is Xcode. It’s a major update to the developer tools.

Here’s James Duncan Davidson on this topic: Ten Things I Dig About Xcode.

I upgraded to Panther yesterday; today I’m working on getting my various apps and frameworks to build on Xcode.

Weblogs about books

I’ve recently subscribed to three weblogs about books.

Bookslut [RSS]
h20boro lib [RSS]
the Literary Saloon [RSS]

Anyone know of any other good ones?

P.S. NetNewsWire tip: you can actually drag the RSS links above into your Subscriptions pane to subscribe. This works with any link to an RSS feed, and it often works with links to the home page of a site.

Small features?

At the moment I’m adding a bunch of small features to NetNewsWire that will appear in the 1.1 release. There will be large features too, but at the moment I’m working on small things.

So—what small features would you like to see added to NetNewsWire? What little things would make it work better for you?

(Things like synching, Rendezvous, persistence and so on are large features. Small features are things like new keyboard shortcuts and little UI enhancements.)

Where NetNewsWire stores data

When you’re upgrading to a new version of OS X, and you want to make sure NetNewsWire doesn’t lose its subscriptions and preferences, you need to copy two things to your new installation:

1. The preferences file at ~/Library/Preferences/com.ranchero.NetNewsWire.plist

2. The folder at ~/Library/Application Support/NetNewsWire/

The prefs file contains your subscriptions and other preferences. The folder in the Application Support folder contains the database which remembers which items have been read, the disk cache, the Notepad file, Scripts menu scripts, and possibly some other things.

(I’m posting this because I’ve heard from a few people and seen one mention on the web about people not knowing what they need to copy over to their new operating system.)

Also, both Mac Night Owl and Mac Net Journal have posted some good general tips about upgrading. My personal opinion: make backups and go slowly. Your data is too important to lose.

OS X Outliner?

I’m trying to decide on an outliner to use on OS X. OmniOutliner came with my new computer, and there’s alot to like about it. But it doesn’t suit me perfectly, either.

If you use an outliner, which one? And why do you prefer it?

Me, I’m tempted to use MORE, because I still like it better than anything else I’ve tried, but I really don’t want to install Classic, so I probably won’t use MORE.

Sox

I’m so looking forward to today’s game 7 of the Red-Sox/Yankees series. Pedro vs. the Rocket. I’m hoping for a storybook pitcher’s duel. And I’m hoping the Sox win.

Stunned

The eighth inning of the Cubs game yesterday stunned me. Sheila said that she had never seen a curse in action before.

I was born in Chicago, so I have some small reason for rooting for the Cubs. Part of me wants to root for the Marlins, because I like Pudge so much and I think the Rangers treated him shabbily. But they’ve won the Series recently and the Cubs very much haven’t.

Which word processor?

If you use a word processor on OS X, which one do you use and why?

I’ve been trying a demo of Nisus Writer Express, and I like it so far after a couple days of light use. But there are other word processors I haven’t tried and I wonder what you think of them.

Some people use Word because they have to. I have to use Word sometimes too. I’m talking about when you don’t have to use Word—what do you use then?

Also, most of the time I use a text editor (BBEdit), but sometimes you want or need a word processor.

NetNewsWire Tip: open pages in tabs in Safari

I’ve posted this NetNewsWire tip before, but I repeat it now and again because new users don’t necessarily know it.

You can make it so that when you open links from NetNewsWire, the pages open in new tabs in Safari. The benefit to this is that you can go through your news, opening links as you go, and at the end switch over to Safari.

Here’s how:

1. Open Safari’s preferences window.

2. Click the General toolbar icon. At the bottom of the window, tell it to open links from applications in the current window.

3. Click the Tabs toolbar icon. Check the box for “Enable Tabbed Browsing.”

Now whenever you open a link from NetNewsWire (or any other app) it will open in a new tab in Safari.

NetNewsWire, NetNewsWire Lite 1.0.6fc1

We posted both NetNewsWire and NetNewsWire Lite 1.0.6fc1 to the betas page.

The point behind 1.0.6 is to fix a performance bug where sometimes HTML descriptions would be slow to appear while a refresh is going on. Otherwise it’s the same as 1.0.5. (Well, we updated the Sites Drawer too.)

Please report to me any deal-stoppers. Thanks!

Once 1.0.6 is out of the way, then the next thing is 1.1, which will have a bunch of new features.

Smarts doesn’t equal snobbery

Yesterday I wrote about how Democrats come across as too snobby to be the party of the average guy, and that Republicans have taken over this position.

Some of the reaction to this was people saying that they’re not ashamed of being intelligent and it’s sad that intelligence is a liability.

I agree with that, but I don’t think that’s really the issue.

I think of Bill Clinton. In terms of raw intelligence, he was probably in the top tier of American presidents. But we saw him struggle with weight: he liked McDonald’s french fries. You could imagine that, if he weren’t so busy, he might enjoy watching wrestling on TV now and again. People called him Bubba.

Smart—yes, hugely smart—but no snob. He didn’t set himself apart from the mainstream of American culture, even its trashier parts. He was democratic in the broadest sense of the word.

X11

I’m curious: if you’re running X11 on your Mac, what apps are you running?

Are you running X11 just because it’s fun, or are there apps that don’t have Aqua versions that you want or need to run?

Love the 15 inch PowerBook

So, my 15-inch PowerBook arrived a few days ago—and I love it. Fast processor, big sharp screen.

One of the nice things is that (through the magic of cvs) I can work on NetNewsWire on my laptop. My old laptop—one of the very old two-tone iBooks—was too slow and had too small a screen.

So I’m updating the Sites Drawer while watching the Red Sox and the Yankees. I’m rooting for the Sox. First because I wanted them to beat the A’s, because the A’s beat the Mariners to the division title, and in this series because I’m tired of seeing the Yankees win. (Like many Mac users I habitually root for the underdog.)

Go Red Sox!

Party of the average guy

I follow politics the way other people follow football. (And sure, I have my favorites, but I have no plans to get partisan on my weblog.)

One thing I’ve found interesting lately is how the Republican party has become the party of the average guy, a position formerly held by Democrats. I’m not sure that Democrats have noticed the switch.

The Democratic party has become—in the popular perception—the party of Rhodes scholars and policy wonks, of complex solutions and nuance. The NPR party.

This goes against the thing many Americans feel: that “all men are created equal” means that no one is smarter than anyone else. Or, if they are smarter, it’s not fair to make other people feel dumb, and it’s not fair to make people feel ashamed of the things they like.

Republicans have as much as promised that they will never make anyone feel dumb. They will never make anyone feel bad for liking NASCAR and domestic beer and Terminator movies and reality TV.

The policies of Democrats may (or may not) be better for the average guy. But getting the average guy’s support is cultural politics. People ask, does this party (or this candidate) “get it,” or do they look down on us?

Mail.app Mutt

Aaron Swartz posted a script for Mail.app (Panther version) that moves a message to a folder. The idea is you could set up keyboard shortcuts for moving messages.

I think you could do something similar in Mailsmith, and perhaps in other email apps.

This is a big deal for me—I love how easy it is to move messages in pine and mutt and hate how you have to use the mouse in GUI apps. I do a great deal of message transferring.

What I’d love to see is a GUI app that lifts the feature right out of pine. You type a command key, and then a text field (not in a separate dialog or sheet: too slow) prompts you for what mailbox to save to. There’s a default, but it also accepts typing and tab completion, much like the URL field in a web browser.

It has to be super-fast and completely keyboard driven.

(And you should be able to use the same widget for mailbox navigation. Going to a mailbox is much the same as transferring a message to a mailbox: they’re both choose-mailbox operations.)

Jean-Luc

Like Gus Mueller, I ended up as Jean-Luc Picard in the “Which Fantasy/SciFi Character are You?” test.

If I hadn’t ended up as Picard, I probably wouldn’t have admitted taking the test. If you ever want to or need to flatter a geek, call him Jean-Luc. Geeks are so easy.

Mac OS X Innovators Special Presentation

At the upcoming O’Reilly Mac OS X conference there will be a special presentation of the winners of the third Mac OS X Innovators contest.

I’ll be there along with some other past winners—Robb Beal, Gus Mueller, and folks from Rogue Amoeba Software—to talk about the current status of our apps and to answer questions about developing for OS X.

NetNewsWire 1.0.6b1

NetNewsWire 1.0.6b1 has been posted. We decided to a quick 1.0.6 before doing 1.1.

It has just one purpose: to fix a specific performance bug. It may be fixed in this beta—but more testing is needed.

The bug is that while refreshing sometimes the HTML descriptions appear very slowly. This can make it difficult to read news while a refresh is going on.

If you’ve noticed this, then please try the beta and let me know one way or the other. Is the problem fixed (or at least much improved)? Or not fixed? Or made worse?

Thanks!

What’s cool about mutt and pine

In the comments for my previous post about email on two computers, Jerry wrote: “Anything to avoid mutt and pine; they should be permanently retired along with POP accounts.”

I disagree about mutt and pine. In fact, I’m strongly considering switching to one of those two. (I’ve been a pine user in the past, but mutt interests me.)

Mutt and pine have a few of the most important features of my dream email client:

1. Navigating through the mailbox list can be done via keyboard—no mouse required.

2. Transferring a message to a mailbox can also be done with just the keyboard.

3. HTML and text styling is not respected at all.

For example: several times a week I have to copy and paste a styled email from Mail into BBEdit just to be able to read it, since the font size is too small. BBEdit makes it plain text, so it’s in a readable size (a size that I myself set). An email app that does plain text only in the first place would be better.

So... it’s all about spending less time managing email. Anything that can make it faster and easier is a good thing.

Email on two computers?

I’ve got a new laptop on the way—and I was wondering, for all you folks who have a desktop and a laptop, how do you deal with email?

I’d like to be able to be able to read and send email from both computers without going through the hassle of copying files across.

One possibility I’m considering is running pine or mutt on my desktop, and ssh’ing in to my desktop from the laptop. But then I would miss out on the utility of being able to have two message windows open. And I’d not be able to sleep my desktop when I’m using my laptop.

It should be noted that I have a POP account.

So—if you’re in this situation, what do you do?

Stuffit Expander 8 Bug

Since the release a few days ago of Stuffit Expander 8, we’ve been getting email about how freshly downloaded apps won’t launch.

The Aladdin folks put up a page about this issue.

We’re probably going to switch to using gzip compression rather than Stuffit compression.

NetNewsWire Lite 1.0.5b1

We’ve posted a new beta: NetNewsWire Lite 1.0.5b1. The idea is to bring the Lite version up-to-date with the changes in the full version.

It uses Web Kit for HTML rendering, supports custom style sheets, supports gzip compression, and so on. Lots of bugs were fixed. See the change notes for more details.

We’re looking for deal-stopper bugs. We plan to release the finished version next week.