Hacker News new | past | comments | ask | show | jobs | submit login
JWZ on iPhone OS development: "This is why I sell beer" (jwz.livejournal.com)
168 points by bensummers on April 18, 2010 | hide | past | favorite | 40 comments



JWZ makes no sense what so ever. I'm sure he's really good at some kind of programming, or at least that he once was, but he often talks from what he thinks is a position of insight, while actually he's quite ignorant.

The first commenter's explanation of why OpenGL and OpenGLES differ is a fantastic example. JWZ simply never bothered to learn enough about the subject in the first place, but comfortably speaks about the "defining characteristics" of it.

Reminds me of a similar hubbub when he proclaimed that CSS is bullshit and decided to stick with table-based markup, this because CSS (in April of 2003), required a span inside of a h1 to replace his table-soup (to mark up just a headline), when he'd prefer just a h1. http://jwz.livejournal.com/193866.html

Being talented in programming is simply not a binary situation, which JWZ shows quite well: he might be really good at some things, I really don't know, but he is also really ignorant in some of the other things he rants about with confidence.


>Being talented in programming is simply not a binary situation, which JWZ shows quite well: he might be really good at some things

Basically this is saying that JWZ, or any other programmer, is as good as the APIs he memorized and has similar shelf life.

The point JWZ is making, and I think most developers past a certain number of years would sympathize with, is that a well designed API should just make sense to a decent developer. It should follow some common sense and accepted conventions that fit your past experience and allow you to figure it out the way travelers find their way around a well designed airport, or a good mechanic approaches a new engine (before software messed these up too..)

Of course it's always possible to just send developers to RTFM in order to do every minor task. If that's the criteria, all APIs are equally great as long as they have some docs, and software developers are not architects or mechanics or chefs, but well paid employees at a fast food franchise, cooking your McMuffin per the updated company manual.


I agree, but sometimes there are really good reasons to change, or evolve, an API. As with the case of OpenGL and OpenGLES in this very example.

The problem is that JWZ doesn't seem to consider this possibility at all; his seemingly shallow experience with OpenGL is enough for him to assume a position of insight, and his obvious conclusion is that some incompetent buffoon must have been in charge of the API which he does not feel familiar with.

Being great in any field of programming ought to teach you that things are rarely that simple. I simply think that ranting about things which you really aren't that familiar with is a trait that doesn't fit a purported expert in the field — or a purported expert in the field should be able to recognize the things he/she isn't one in.


This kind of griping is what I find myself doing when I don't understand or know something very well. Once you get to really know it, you can put all those complaints out of your mind and focus on getting stuff done. Learning is a process and at least for me, a series of complaints and arguments with myself, trying to reconcile what I observe with what I think should be there, is an important part of the process. If you keep constantly jumping between platforms and APIs, you are always going to compare them at a deficit to what you do know.


True but it only goes so far. For instance, I spent 5 years honing my PHP craft. At the end of that time I was pretty good at it, but I still had to look up whether it was haystack, needle or needle, haystack every time.


Exactly. PHP is notorious for its standard library's inconsistent API. Griping about PHP standard library, if anything, reveals familiarity with it.


Good observation. I know barely anything about ObjC/Cocoa, but if I was pushed to provide an opinion on them I'd start griping about how awful the verbose mixed case method names and prefixes on everything look. Which obviously isn't hindering the other people making fantastic iPhone and Mac applications.


I do think he had a point on the sudden about-face as to whether HTML should specify page appearance down to the pixel: http://jwz.livejournal.com/147024.html


No, they got some intern who was completely unfamiliar with the old library to just write a new one from scratch without looking at what already existed.

It's 2010, and we're still innovating on how you pass color components around. Seriously?

Actually, in the first example, the MacOS code looks like the API designed by clueless interns that don't get OO. It's the same classic mistake of passing in an X and a Y instead of a Point Object from the 1st generation Java GUI library. The iPhone code does the right thing. Instead of passing around un-encapsulated data, pass around Objects instead!


Poor as it is, I think the original intention of the Mac version was to avoid buffer overflows. You can potentially screw up with the iPhone code by doing:

    const CGFloat *rgba = CGColorGetComponents([fg CGColor]);
    CGFloat a = rgba[4]; //Crash!
However, you do have a point in that explicit data structs are better than implicit ones. I would have chosen this API:

    typedef struct {
        CGFloat r;
        CGFloat g;
        CGFloat b;
        CGFloat a;
    } UIRGBAColor;
    
    //...
    
    UIRGBAColor rgba = [fg rgbaComponents];


that's bullshit. why is the right thing to encapsulate your data into an object before passing it around? that's your opinion on what's right, I guess, but I don't think it's the right way.


I suppose for some idiosyncratic value of "right."

In the Point example, the API that respects encapsulation would remain the same between the 2D and 3D versions, along with any code using it. The API with un-encapsulated data would have to change at every single place in the code where a Point was passed.

(In other words, the implementation details of Point have leaked out into the system at perhaps 100's of places. Avoiding this and decoupleing ourselves from implementation is precisely why we have encapsulation in OO.)

How this applies to color is left as an exercise to the student.


How this applies to color is left as an exercise to the student.

This is what I'd like to hear. Cocoa has NSPoint, which is exactly what you're talking about, for points. And NSColor is already a kind of the basic object for colors. Do you really need more primitive types for this?


What object would you pass to NSColor to generate a color from HSB components? Wrap them to NSHue, NSSaturation, and NSBrightness? Or generate NSHueParameters first?

(Please note that I don't intend to argue, I'm asking for a better solution. Thanks!)


I think he's referring to the API to get the components out of the NS/UIColor, not create the NS/UIColor object.


There are individual methods like `hueComponent` if you want them. http://developer.apple.com/mac/library/documentation/cocoa/r...

I still don't get the point.


Your post is disgusting and you are a disgusting person. I'm not sure if there's a purpose to your post, other than to call JWZ stupid. Do you feel better about yourself now?

You say he's ignorant? Have you considered that you are the one who is ignorant? The last time I checked, which was only a few minutes ago, JWZ's post was about his experience writing an iPhone port of an application he had written. It was not a hyperrationalist treatise on the differences between the iPhone and Mac OS X api's. What, do you expect people to be some kind of expert on 3D graphics before trying to get anything done with OpenGL? It's not like he works in the video games industry. It's not his job to read everything about OpenGLES and understand it fully before trying to use it.

Speaking of ignorance, you seem to be ignorant of the fact that, regarding his rant about CSS, you're wrong and he is right. I suppose being talented in the spotting of ignorance is simply not a binary situation, which you show quite well.

What other things are you ignorant about? You're ignorant of how arrogant you are. Well, you might not be ignorant in some of the ways you're arrogant, I really don't know. You're also ignorant of the fact that when somebody complains about an API being different than they expect, it's not insightful to say, "Oh ho ho, you're not well educated on that!" Of course he's not well-educated on the subject! That's the reason he had something to write about!

Oh, did I just say "insightful"? No, wait, you said it first. So he's not speaking from a position of insight, is that the problem? What do you expect, do you expect every blog post to be some insightful commentary to help the reader understand the crazy world we live in? Maybe he was just writing about how his day went. You seem to be ignorant of that, too.


I always figured that the changes to the names of classes from Cocoa to CocoaTouch were done deliberately to make it difficult to port apps from the Mac. You're knowledge of the APIs transfers pretty well, so if you wrote an app for the Mac, it won't be hard to rewrite for the iPhone, but you will have to rewrite it.

Apple seem to like doing this to force developers to become familiar with a new platform. It's much the same as not providing a command line for the original Mac, hence preventing text-based programming, or indeed not allowing cross-platform dev tools to be used for apps that will be sold on the app store.

From a design perspective, I can understand why they do this. They want apps on their platform to be lovingly crafted, just as they themselves have laboured over their products. But still, it can be frustrating for devs.


It's much the same as not providing a command line for the original Mac, hence preventing text-based programming

Not true. Stephenson even talks about this in In The Beginning Was The Command Line. It was called MPW and provided a very Unix-like experience (Makefiles and so on). The rival was THINK Pascal, and then later CodeWarrior, which were IDEs.


I'm not entirely sure where you're trying to go with this. There was no command-line mode for the Mac. You couldn't take e.g. Wordstar (good grief, it's been a while since I last typed that name!) , and run it with little modification on a Mac. You would first have to write a GUI-based console for your text-only app to run in. There was no console SDK. Yes, it was possible to do, but as it would take as much work as writing the app as a proper GUI app anyhow, you might as well forget about the console.


Well, you said there was no text-based programming, whereas I remember doing it... I'm pretty sure you could run your code in the MPW shell and use STDIN and STDOUT as per any C program of the time. CodeWarrior also had this, called WASTE there.


Could you deliver that text program to the user such that they could compose it with others in a standard environment? I think that's the real point - that programmers were discouraged from falling into habits of older platforms.


You certainly could with CodeWarrior, I can't remember about MPW.

And umm, of course programmers should be discouraged from falling into habits of older platforms. Otherwise the web would look like an IBM 3270 :-)


Also Lightspeed C, if memory serves, got in early dibs. Worked nicely, many fewer floppies than MPW. Was IDE, though.

P.S. demallien is completely right. S.O.P. was to hang your code from the GUI event loop (skeleton samples provided).


I think the name changes were done to remind programmers that Cocoa and Cocoa Touch are different and you need to take that into account. Plus, it has been a long while since NS was meaningful. I do wish they had introduced namespaces into Obj-C as part of the iPhone SDK, but oh well.

I remember seeing a terminal emulator for the early Macs that allowed hooking to corporate mainframe apps. It made me very sad.


I don't really understand his complaints about the lack of compatibility between traditional Cocoa (i.e. Foundation+AppKit) and Cocoa Touch (Foundation+UIKit).

I've been working with Cocoa for years. It took me just an afternoon to port a graphics and audio application from Mac OS X to Cocoa Touch. Granted, it's a pretty simple application [1] designed for maximum cross-platform compatibility by being written in C. But jwz's Dali Clock is even simpler with the same portability goal...

In my experience the changes made in UIKit are perfectly reasonable given the constraints of the platform. In many places Apple has managed to substantially improve the experience of mixing plain-C CoreFoundation and Obj-C Cocoa by lowering the historical "impedance mismatch" between the two that still persists in AppKit. There's nothing wrong with doing an API cleanup when the opportunity for a break with the past presents itself.

[1] http://lacquer.fi/2020


His initial goal was to not have to port it -- it was to get it compiling from the same source on both, since they're both Objective-C applications written atop OS X.

What he found was that similar functionality was implemented with an arbitrarily different interface. UIKit is not exactly the same as AppKit (I think it's a little bit cleaner) and breaks AppKit code even for features that are supported on both sides.

If you're used to stable APIs and expect strong justification for changing an interface, especially when there is no apparent change for features supported or efficiency, going from AppKit to UIKit is like having someone flick vinegar off of their finger tips into your eyes.

And if you're used to being able to develop software (using other open source software) on a computer you paid for and run it on a device you paid for without having to pay again and sign a contract limiting your freedom, then it's like getting a right hook to the abdomen.


IMHO, moving from a 23" screen and multi-GB memory to a 3.5" screen and 128 MB is strong justification for changing an interface.

Most of AppKit just doesn't make any sense in a single-task, single-window system. They could have kept some of the classes, but what would be the point? A tiny minority of Mac apps are as simple as jwz's clock. Everything else would need rewriting anyway.


moving from a 23" screen and multi-GB memory to a 3.5" screen and 128 MB is strong justification

This makes no sense in the context of the examples cited. Elsewhere, maybe.


I think this is a function of age.

I'm only 30 now, but I'm starting to get crusty when shit changes for the sake of changing shit :)


I'm somewhat older, and I feel your pain. :-)

But more, I'm disappointed that we haven't spent the effort that goes into reinventing these things every ten minutes on something more productive. There are plenty of simple things in my everyday programming work that could be automated to take less time, given the right language tools or libraries or development environment, but where it is still faster in practice to do everything the "hard" way than the "easy" way. How am I ever going to code up all my pet project ideas in a single lifetime at this rate? ;-)


And AppKit is almost 18 years old; it was started by NeXT and Sun in 1993 or so. UIKit removed a lot of cruft and fixed some pretty big design decisions in AppKit. It was a rewrite that was needed, not because an intern had too much time on his hands.


I know plenty of 30 year olds that love to change things just for the sake of it


It seems to me that stating opinions as if they are flat facts presented by an authority is as good a recipe as any to create needless drama, tempests-in-teacups, which in the end amount to nothing.


Who is JWZ? Is he well-known as a techie? As a techie who runs a non-tech business, I find him interesting due to the fact that he runs a nightclub.


Jamie Zawinski was an early Netscape Navigator, Mozilla, and XEmacs developer. He now runs a nightclub:

http://en.wikipedia.org/wiki/Jamie_Zawinski


He's interesting for far more reasons than running a night club. If you get a chance, check out Coders at Work---he's the first chapter (interview).


It's interesting because he's still mad that Perl killed Lisp 20 years ago.


It's fine to leave me at 0 points but why was I down-voted? In what way have I violated the spirit of the site with this honest question?


http://lmgtfy.com/?q=wikipedia+jwz

Additionally:

"Resist complaining about being downmodded. It never does any good, and it makes boring reading."

http://ycombinator.com/newsguidelines.html




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: