How to solve every problem in Cocoa

Yes, really, every problem. Don’t think of Cocoa as "simple things simple, complex things possible" (actually, was it Cocoapenextstepsody or Perl who started with that tagline? Or someone else? I digress) but "simple things simple, complex things simple but you’re looking at it wrong". With Objective-C 2.0 (particularly properties), Core Data, Cocoa Bindings and Cocoa Scripting, almost every "it doesn’t work" moment comes down to getting something wrong with KVC or with KVO – either observing the wrong key, or typoing a method name such that you aren’t KVC-compliant for a key you need to be, getting validation wrong or unexpectedly going down the -setNilValueForKey: path. So do yourself a favour:

#define GLInstanceMethodEntryLog(format, ...) NSLog(@"-[%@(%p) %@] entry: %@", NSStringFromClass([self class]), self, NSStringFromSelector(_cmd), [NSString stringWithFormat: format, ##VA_ARGS])

Now because all of the retain count bugs disappeared when you turned the garbage collector on, the remaining issues are with that bit of code the PHBs are paying for ;-)

Posted in cocoa, gnustep, objc | 1 Comment

Project: Autonomous Revolutionary Goldfish

I was going to write, am still going to write, about how silly project names get bandied about in the software industry. But in researching this post (sorry blogosphere, I’ve let you down) I found that the Software-generated Gannt chart was patented by Fujitsu in the US in 1998, which to me just explains everything that is wrong with the way the US patent system is applied to software. For reference, Microsoft Project was written in 1987 (although is not strictly prior art for the patent. Project does everything in its power to prevent the user from creating a Gannt chart, in my experience).

Anyway, why is it that people care more about the fact that they’re going to be using Leopard, Longhorn, Cairo, Barcelona or Niagara than about what any one of those is? As discussed in [1], naming software projects (though really I’m talking about projects in the general sense of collections of tasks in order to complete a particular goal) in the same way you might name your pet leads to an unhealthy psychological attachment to the project, causing it to develop its own (perceived) personality and vitality which can cause the project to continue long after it ought to have been killed. For every Cheetah, there’s a Star Trek that didn’t quite make it. And why should open source projects like Firefox or Ubuntu GNU/Linux need "code names" if their innards are supposed to be on public display?

I’ve decided that I know best, of course. My opinion is that, despite what people may say about project names being convenient shorthand to assist discussion, naming your project in an obtuse way splits us into the two groups which humanity adores: those of us who know, and those of you who don’t. The circumstance I use to justify this is simple: if project names are mnemonics, why aren’t the projects named in a mnemonic fashion? In what way does Rhapsody describe "port of OPENSTEP/Mach to PowerPC with the Platinum look and feel"? Such cultish behaviour of course leads directly to the point made in the citation; because we don’t want to be the people in the know of something not worth knowing, we tend to keep our dubiously-named workflow in existence for far longer than could be dispassionately justified.

Of course, if I told you the name of the project I’m working on, you wouldn’t have any idea what I’m working on ;-).

[1]Pulling the Plug: Software Project Management and the Problem of Project Escalation, Mark Keil. MIS Quarterly, Vol. 19, No. 4 (Dec., 1995), pp. 421-447

Posted in Business, metadev, mythicalmanmonth | Leave a comment

Objective-C Design Patterns

Certain events at work have turned me into a bit of a design patterns geek of late, and as such I stumbled across this DDJ article from 1997 (the title of this post is the link). According to del.icio.us not many other people have stumbled across it, but it’s a great article. The code listing links seem to 404 even though the listings are at the bottom of page 1 of the article.

Something very important can be learned from this article, which is at best covered tangentially in the GoF book: Design patterns are not language-independent. Calling the C++ and Objective-C ways of writing code "pattern idioms" ignores the point that actually, the code you come up with is more important than the design (customers don’t typically want to pay the same cash for your UML diagrams that they do for your executables), and gasp different languages require different code! Different patterns can be used in ObjC and Smalltalk than in C++, and different patterns again in object-oriented Perl. Different patterns will be appropriate for working with Foundation than with the NeXTSTEP (pre 4.0) foundation kit or with ICPak101. Designing your solution independent of the language and framework you’re going to use will get you a solution, but will not necessarily produce the easiest solution to maintain, the most efficient solution or one that makes any sense to an expert in the realm of that language and framework.

Posted in cocoa, gnustep, objc, ooa/d | Leave a comment

FSF membership

I am now an associate member of the FSF. This is a good way to support Free Software development (including GNUstep, and you don’t even need to be able to code :-). I’ve added a referral link to the sidebar – I don’t get a kickback obviously, although I do get gifts if enough people are referred by me, and it helps the FSF to track where donors are getting their information from. If you use Free Software, you might consider donating some cash – especially now that the dollar’s so crap ;-).

Posted in Business, fsf, GNU, gnustep | 1 Comment

Post #100!

And to celebrate, we look at the differences between managers and humansprogrammers.

Posted in Business, mythicalmanmonth | Leave a comment

Upcoming Cocoa nerd stuff

I have organised a NSCoder Night for this coming Tuesday, November 27. It shall be in the Jericho Tavern pub at 8pm; bring yourself, bring an interest in Cocoa, and perhaps bring some code to talk about or work on. There won’t be any agenda as such, just a group of NSCoders talking about NSCoding.

In January, PaulHR and I shall be entertaining OxMUG on the subject of Getting Things Done�™ – in particular I have now started braindumping my many to-do lists into OmniFocus and I’m finding it very expressive and useful. In fact preparing that talk has just zoomed its way over to my OF inbox :-). That talk shall be Tuesday, January 8th.

Posted in cocoa, gtd, nscoder, omnifocus, oxmug | 1 Comment

Verify your backups

Apple shipped Mac OS X 10.5 this weekend, and three of the features are Time Machine, dtrace, and improved CHUD tools. Time Machine, dtrace, CHUD tools. iPod, mobile phone, web browser. Time Machine, dtrace, CHUD tools.

To spell that out in long hand, it’s very easy now to see how various features in the Operating System behave. And in the case of Time Machine, we see that it walks through the source file system, copying the files to the destination. When I last gave a talk to OxMUG on the subject of data availability, it was interesting to notice how the people who had smugly put their hands up to indicate that they performed regular backups became crestfallen when I asked the second question: and how many of you have tested that backup in the last month?

Time Machine is no different in this regard. It makes copies of files, and that’s all it does. It doesn’t check that what it wrote at the other end matches what it saw in the first place, just like most other backup software doesn’t. If the Carbon library reports that a file was successfully written to the destination, then it happily carries on to the next file. Just like any other backup software, you need to satisfy yourself that the backup Time Machine created is actually useful for some purpose.

Posted in backup, dtrace, leopard | Leave a comment

+1-415-312-0555

Back in 1992, Robert X. Cringely wrote in Accidental Empires: How the boys of Silicon Valley make their billions, battle foreign competition, and still can’t get a date [Oxford comma sic]:

Fifteen years from now, we [Americans] won’t be able to function without some sort of machine with a microprocessor and memory inside. Though we probably won’t call it a personal computer, that’s what it will be.

Of course, by and large that’s true; the American economy depends on microcomputers and the networks connecting them in a very intimate way. It’s not obvious in 2007 just how predictable that was in 1992, as the "networks connecting them" had nothing like the ubiquity which is now the case. When "Accidental Empires" was written, the impact of a personal computer in an office was to remove the typewriter and the person trained to type, replacing both with someone who had other work to be doing typing on a system thousands of times more complicated than a typewriter.

What’s most interesting though is the (carefully guarded; well done Bob) statement that "we probably won’t call it a personal computer," as that part is only partially true. All of the people who have Tivos, or TVs, also have a personal computer. All of the people who have mobile phones and digital cameras also have a personal computer. The people who have Playstation 3s and Nintendo Wiis also have personal computers. In business, the people who annoy everyone else by playing with their palmtops in meetings instead of listening to what the amazingly insightful Cocoa programmer has to say are also wasting time trying to work out how to sync them with, yup, the personal computer they also have on their desk.

So the question to be asked is not why Cringely got it wrong, because he didn’t, but why hasn’t the PC already disappeared, to be completely replaced with the "it is a PC but we won’t call it that" technology? Both already exist, both are pervasive, and the main modern use of both is remote publishing and retrieval of information, so why do we still tie ourselves to a particular desk where a heavy lump of metal and plastic, which can’t do very much else, sits disseminating information like some kind of [note to self: avoid using the terms Oracle or Delphi here] groupthink prophet?

Posted in Business, cringely | Leave a comment

OmniWeb 5.6 tip of the day

defaults write com.omnigroup.OmniWeb5 WebKitOmitPDFSupport -bool TRUE

Sorry, but it doesn’t view properly and doesn’t print properly either :-(.

Posted in omniweb | 1 Comment

The times, they mainly stay the same

bbum displays a graph of the market capitalization (he’s american, so the z sticks) of a few of the computer companies, noting that if after-hours trading isn’t too surprising, then tomorrow (for Americans, again) the market will open with Apple being the biggest computer manufacturer on the planet. However, these figures fail to show something reasonably interesting.

What have IBM (up 24% y-o-y), HP (up 30 %) or Dell (up 21%) done to enamour you to their brand lately? If you’re anything like me, then they’ve done nothing at all. Selling the same old Operating Systems on the same old hardware doesn’t count as innovative. Compare them with Sun (up 13% year-on-year) or Apple (115%) and you’ll see that there’s basically no accounting for taste on the stock market. While Apple have been selling the shiny gadgets, Sun have been delivering the most observable operating environment on the planet and Dell have been doing, well, shit-all would be a polite phrase, and yet Dell have outstripped Sun in growing their stock price. In fact, HP have managed to blow up their stock price out of all proportion, while fighting scandals and the complete haemmorhaging of their management staff.

Posted in Business | Leave a comment