Archive for the 'programming' Category

Small developers still alive and kicking

Monday, August 14th, 2006

Despite WWDC concerns, small developers are still alive and kicking. Parallels is doing extremely well, although it may soon have a free competitor.

Glenn Wosley lists 5 mystery projects soon coming to the Mac… He missed mine :-) I don’t have a (finished) logo yet, but I do have a tagline: Find It! Keep It!, Software made by Packrats for Packrats, coming soon to a Mac near you!

How soon? Sign up for private beta-testing and find out! I hope really soon.

WWDC: Unreported Leopard features, Apple Design Awards and some WWDC slides

Wednesday, August 9th, 2006

O’Grady leaked a set of Leopard features last week, and now Mac Fix’It confirms them:

Apple’s Design Awards are also out… This is the most complete report from wwdc I’ve found to date, although it doesn’t reveal any secrets. Aaron Hillegass of Cocoa Programming fame has set up a website to share Cocoa Code. Why do his Slides say “Python People Make me Mad”???

AeroXP also has some info of interest to developers

WWDC from a software developer’s viewpoint

Tuesday, August 8th, 2006

When an eagle descends, only the prairie dog it targets runs away. Everyone else sits up and looks at the show. “Will Jack get eaten this time?”

WWDC is exciting for end users. It’s even more so for developers! Of course we all are excited to learn about the latest and greatest, and love unexpected surprises such as DTrace support. However there’s a bad side. Will Apple Steam roll my product?

It happened to Audion with Itunes. It happened to Karelia with Sherlock, and then it seemed to happen again this MacWorld Sandvox.

This WWDC has been particularly ruthless:

It’s hard to argue that Apple should not improve its operating system, bringing the benefits provided by these tools to the masses. It’s even harder to argue that when its competitor Microsoft does the same thing. As did Google, with its free offering of Google Earth. However it’s also really hard for the developers to compete with “Free!”. And these features are free, because they come free with new computers, or with OS upgrades required to run some other application.

My way or the highway!

Friday, August 4th, 2006

rosyna of unsanity wrote a very long entry about Apple and developers. As someone with 25 years experience on other platforms, but relatively new to the Mac, I have observed good and bad sides of programming on the Mac.

The good side is that many Mac developers very helpful, for instance answering questions in forums. Also, because Mac OS X is a mashup of various technologies, I know some of them.

The bad side is that not so much that the Mac does some things very differently but that Apple’s documentation is barely adequate. When I read it, I sometimes wonder whether it’s written to satisfy their marketing department’s need to be cool and easy to use, rather than my needs as a developer to use it.

Only Macs are computers! To start with, there seems to be an assumption that if you are new to some Mac technology, you’re new to computers in general. For instance, the introduction to Cocoa explains basic Object Oriented design. This poor separation of concerns reduces the documentation’s effective signal-to-noise ratio. Even if I do slog through it, I find I can’t find the useful bits later. Indeed, it is in Apple’s interest to welcome those of us coming from similar yet different worlds. I would like a guide of features unique to apple: what are bundles? aliases? uti? metadata (xattr/spotlight)? Interface-Builder? Cocoa? (etc) Why should I care?

Program to the interface! Rather than explaining what a given problem is, how Apple solved it, and the reasons why it solved it in that way, Apple focusses on describing the interface they provide and giving a few simple examples. This is insufficient to building a mental model of how things work. A good mental model is essential to debug problems or to easily extend the functionality of a tool that almost does what one wants. While I agree that one usually benefits from programming to an interface and not to an implementation, there are times where the cost of doing so outweighs the benefits. The documentation should address both needs.

Mac software is perfect! Not. Mac OS X has some fairly basic bugs. For instance NSURL doesn’t always parse URLs correctly… It would help to have links to distilled bug-reports in the documentation, so that one can decide whether using an Apple API is appropriate or not. Instead, because bugs are in an unrelated ADC only system (radar), I have only found about them after encountering them. For instance, I am now rewriting my search code to use Spotlight’s Carbon. This results in having had to reimplement things due to a third party (apple) more often than I ever had to on any other platform (including Windows!).

Memory Management! You’re supposed to just know when to free memory. It turns out that there are rules for Cocoa and for Carbon. Nevertheless, other platforms do things differently, and it would help mac immigrants if this information were linked to relevant APIs.

Good documentation is essential to program in a closed source such as Mac OS X. Linux documentation may not always be perfect, but I’d prefer getting a headache reading source code than getting a headache fishing with google. At least I know I will understand the source code, and I might even learn something.

Obviously the good aspects of the Mac outweigh the bad, or I would program something else. But, Apple could definitely improve its developer documentation.

Maps, folds, and degrees of freedom

Wednesday, August 2nd, 2006

Python 3000 will remove maps and folds. (Python names: map & reduce). I believe this is a mistake.

Fold and map state the nature of the data-dependencies in a segment of code: the way data flows through that code. It is the fact that they limit the data-dependencies that is useful. When I see reduce(lambda x,y: x|y, ss, set()) I know that the sets will all be ored together. When I read a for loop doing the same thing I have to be much more careful, as a for loop does not limit the way in which data flows though it: it has a much higher data-dependency degree of freedom.

Examples don’t really capture this, because it has more to do with the mind of the beholder than the actual mechanics. Nevertheless the difference is real, and has real implications for distributing processing, as this paper from google shows. (via joel).

Indeed the use of maps and folds in Python is limited by other factors. I use maps and folds much more in Haskell, because Haskell efficiently supports functional composition:

f . g = lambda x: f(g(x))
map f . foldl [] g . map h . fold ...

Negative strings

Monday, July 31st, 2006

One often wants to place separators between substrings.
For instance commas between a list of words.
The code has to detect whether it is adding the last element to avoid adding a final comma.
It would simpler if you could subtract a string at the end.

(- “, “) + “, a, b, c, d” = “a, b, c, d”
“a, b, c, d, ” - “, ” = “a, b, c, d”

Non-commutative!