Archive for April 2007

Saturday, April 28, 2007

PHP Becoming Mainstream?

Tim O’Reilly says that the PHP & MySQL For Dummies is now the top selling book for that language, so therefore PHP is becoming mainstream (via John Gruber). I’m confused. I thought PHP 3 was popular, with many hosts including support for it. PHP 4 was definitely mainstream, by just about any definition I can think of. Now PHP 5 is already almost three years old. I guess I don’t know what “mainstream” means.

Thursday, April 26, 2007

HTML and WYSIWYG

Jesper:

You can’t reliably support web programming and provide visual editing and have these features mesh. It can’t be done.

Wednesday, April 25, 2007

Large Cocoa Projects

Brent Simmons has posted some good tips for managing large Cocoa projects.

Notifications can make code hard to follow

Singletons, of which the notification center is one, are basically global variables. They’re useful, and they can decouple two classes from one another, but only at the expense of coupling them to the global thing. So I agree with Brent’s advice that two objects that have a relationship should just talk directly; if they’re logically coupled, don’t obscure things with notifications. I think NSNotificationQueue is underappreciated, and perhaps a good smell test is that if you don’t mind your notification being queued and delayed, then your objects are coupled loosely enough that notifications are the right choice.

Key-Value Observing: for prefs only

None of my apps use KVO. I just haven’t had a situation where I thought it would help enough to be worth the expense in complexity. To me, it’s like less explicit notifications with a more convoluted control path. Plus, I get a bad code smell from +setKeys:triggerChangeNotificationsForDependentKey:. The idea that my objects should publish the interdependencies of their properties seems wrong. The whole KVC/KVO system seems to be designed around the idea that objects are dumb structs, and I prefer smart objects that manage their own state and interactions. Other objects should ask them to do things, not set or observe key paths into them.

Bindings are for basic stuff

I really wanted to like bindings, and at one point in the Jaguar days I started designing a framework that would address the same problem that bindings do (in a different way). But after giving them a good try, I’ve decided that they’re not for me. The only place my code currently uses them is in DropDMG’s Automator plug-in, where it’s sort of mandated. Bindings are like the opposite of Perl. They make the easy things a little easier but the harder things much harder. Since the benefit is small, and simple requirements may grow with time, I stay away from the garden path of bindings. Also, I don’t like the code structure that results from using bindings. I find it harder to write automated tests for, harder to debug, and harder to do what Brent calls “research” because some of the information is in nib files, which aren’t as easily searched or diffed. Plus, I don’t like putting my logic into nib files or strings. That’s what code is for. I wish Apple had provided a controller framework that was based on objects.

High-level Interface

I agree with the general idea of having different “levels” of interfaces and being conscious of where everything goes. This ties in with the point about notifications; generally, I use notifications to let lower (inner) objects broadcast messages to higher (outer) ones. Using C functions rather than methods is a neat trick to make the levels stand out visually. Personally, I prefer classes because (a) they force me to think about whether I should pass in an object or use a singleton, and (b) it’s easier to access classes/methods via AppleScript or PyObjC.

Use #pragma mark, use the function popup

Both are great. I have BBEdit’s function pop-up bound to Command-Control-N to avoid killing kittens.

Opening Files

I don’t use Open Quickly (though I do use Open Selection) because neither BBEdit nor Xcode offers auto-completion of the filename. Instead, I use LaunchBar, and I have sub-searches setup for each project that I work on. Or, if the file is already open, I use Command-Control-F to open the file pop-up menu and then type-select a file. Plus Control-Tab to switch between counterparts, of course. I also have Command-Control-B bound to a script that opens the current file in a BBEdit disk browser.

Managing Files: flat folder on disk

I go with multiple frameworks, each with a flat list of files.

(More comments from Daniel Jalkut and Jonathan Rentzsch.)

Tuesday, April 24, 2007

Extracting the Vista Fonts

Aristotle Pagaltzis shows how to download and extract the Windows Vista fonts such as Calibri and Consolas. I still prefer aliased ProFont, but Consolas looks pretty nice in ClearType. It looks heavy in Mac OS X except with light font smoothing, where everything else looks too light.

Monday, April 23, 2007

Coda 1.0

Panic has an annoying habit of developing excellent software that just isn’t for me (though I happily used Audion until iTunes came along). Coda looks great, and I imagine that for many people it’s exactly what they want. But there’s just zero chance that I’d use it. I like BBEdit, rsync, Terminal, Safari, Interarchy, Subversion, and my homegrown templating language and tools. I did, however, spend about ten minutes playing around with Coda. That was long enough to see that there’s much to like in its design. And it’s probably longer than I’ve spent in Xcode in the last couple weeks. IDEs bring me nothing but frustration.

Friday, April 20, 2007

Apple: A Romance

Buzz Andersen:

As with any whirlwind romance, though, the honeymoon couldn’t last forever. Apple may be a very special company, but it’s still just that: a company. And, like any company, at the end of day it needs to take care of business. In Apple’s case (or at least the part of Apple I worked in), that business is shipping amazing software on impossible schedules with astonishingly small teams. It’s been Apple’s business since the “90 Hours a Week and Loving It!” days of the original Mac team, and the grand tradition continues to the present day (just ask anyone on the iPhone team how much vacation they’ve had in the last year).

Thursday, April 19, 2007

Code Beach

Code Beach is a “central repository where Mac developers can share pieces of useful code.” The code is all in the public domain. It tracks dependencies, and commenting and syndication features are planned. It would be nice if the actual code were browseable on the Web, and therefore indexable. Via Blake C.

Tuesday, April 17, 2007

Computer Science’s Image Problem

Jens Alfke:

Trying to sell CS as somehow not being about programming is false advertising — it’s like telling kids that chemistry isn’t about molecules or mathematics isn’t about numbers. Sure, there are scientists using computers to design medicines or study the climate. But they’re not computer scientists, they’re biologists or geologists. Computer science is about software.

My experience is that most people wouldn’t be happy doing computer science or programming. I think they just aren’t wired that way. There are a small number of us who knew we would love it, and there are a few who happen upon it in college or later and discover that they love it. But many more are the people who know that they don’t like it, or who are interested enough to try it but don’t get hooked. Image and advertising aside, I think that, once exposed, people quickly see whether it’s for them. So, to the extent that low interest in CS is a problem rather than the normal post-dot-com assortment, I think the solution is to expose more people to CS (both the ideas and the programming) at the introductory level. It’s at least as useful, for general knowledge and mental exercise, as basic chemistry, and if more people in that second group can discover that they have the interest and aptitude, so much the better.

Monday, April 16, 2007

TidBITS Turns 17

Adam Engst announces that TidBITS will be adding inline images and social bookmarking links, and he describes their new document collaboration system that’s based on BBEdit, Subversion, and a custom app.

Saturday, April 7, 2007

Connection Kit

Dan Wood:

The framework is extremely useful. I had done some research on what our options were for Sandvox when we started developing it, and there aren’t many alternatives, if any. One of the best things about this is that the different connection methods share a common interface, so whether you are uploading to SFTP or just exporting to the file system, you use the same code to accomplish it. It also has operations like delete remote file that you can’t find if you used Apple’s APIs.

Wednesday, April 4, 2007

What Google Desktop Installs

John Gruber:

I won’t install software like this on my main machine without knowing everything that’s going to be installed. So I installed Google Desktop on a test machine — an iMac G4 running Mac OS X 10.4.9. Before the installation, I used the Unix ls command to generate a list of every file on the startup drive. I ran the same command again after installation and searched for differences.

Gruber says that the installer does some nasty stuff like silently install an input manager and replace the mdimport tool in /System/Library/Frameworks/. Plus, it installs a kernel extension. I also installed it on a test Mac, and now I’m really glad that I did.

After a few minutes, it said it had finished indexing, although searching didn’t find any results. After rebooting, it started indexing again, although the keyboard shortcut (Command-Command) and the icon in the menu bar were no longer active. So, yeah, it’s beta.

I’m not a fan of “live” installers; I want to be able to download and archive the files that will be installed, so that I can see what they are, and also in case I later don’t want to install the current version.

Tuesday, April 3, 2007

WikiPath

What a neat idea: Ben Gottlieb’s WikiPath is a screensaver that displays pages from a random path through Wikipedia. You might think that it would take some work to find the URLs that a page links to, but -[WebView stringByEvaluatingJavaScriptFromString:] makes short work of that.

Monday, April 2, 2007

Mailsmith 2.2 Semi-Public Beta

Bare Bones has made available a pre-release version Mailsmith 2.2, which is a universal binary and features numerous enhancements—including Spotlight support, Unicode, BBEdit 8.6–style clippings, format=flowed, inline spell-checking, a more flexible Simple Query window, and improved integration with SpamSieve.

Rather than just marking a message as spam or not spam, Mailsmith now records and displays the spam score that tells how spammy or good SpamSieve thought each message was. For example, messages with scores from 0 to 49 are predicted to be good, while those with scores from 50 to 100 are predicted to be spam. A message with a score of 99 is almost certainly spam, while a message with a score of 73 is probably spam. By sorting the (spam) mailbox by spam score, you can quickly review the relatively small number of low-scoring spam messages to check for false positives, without having to scan through all really obvious spam. Mailsmith 2.2 also adds a “Recalculate Spam Score” command, which lets you re-apply SpamSieve to a selection of messages.

Be sure to read the extensive change notes and caveats about pre-release software before downloading.

256 kbps, DRM-free EMI Music on iTunes

EMI:

Apple’s iTunes Store is the first online music store to receive EMI’s new premium downloads. Apple has announced that iTunes will make individual AAC format tracks available from EMI artists at twice the sound quality of existing downloads, with their DRM removed, at a price of $1.29/€1.29/£0.99. iTunes will continue to offer consumers the ability to pay $0.99/€0.99/£0.79 for standard sound quality tracks with DRM still applied. Complete albums from EMI Music artists purchased on the iTunes Store will automatically be sold at the higher sound quality and DRM-free, with no change in the price.

This will probably get me to start buying from iTunes.

Apple:

iTunes will also offer customers a simple, one-click option to easily upgrade their entire library of all previously purchased EMI content to the higher quality DRM-free format for 30 cents a song.

Classy.

Update: Cory Doctorow says:

I could not be happier right now. I really hope Apple decides to make a web-based version of the iTunes store so that I can buy iTunes tracks in future using Ubuntu Linux…

Sunday, April 1, 2007

ATPM 13.04

The April issue of ATPM is out: