Welcoming back to the stage... me!
Wow, it's been a long time. I'm sure I'll be telling the stories of these lost years in time, but for now, I've got so much to talk about from today's madness that I'll just give you the necessary background information in one compact, easy to swallow pill. It's the American way.
I'm unemployed and busier than ever. My productive hours for the past month or so have been spent learning the technology necessary to write applications for the Macintosh. When programming, you have three things you've got to learn: an interface with which to communicate with the computer, a language to facilitate that communication, and, because this conversation is persisted in the form of an executable application, a programming environment to handle the overhead of organizing your thoughts, making sure the computer understands you, and packaging your work into a form usable by others who want relive your conversation in a way that's useful to them.
When talking about the Macintosh, these three things are Cocoa, Objective-C and XCode.
Cocoa: Hot drink for a cold day
Cocoa is the interface, what we call an Application Programming Interface, or API. Well, in truth, Cocoa is one of the available sets of APIs, which is why we call it Cocoa, and not simply "the API."
Originally called NeXTSTEP, Cocoa is to programming what the Mac is to everyday computer usability. Having spent the past few years toiling in Java (and its evil twin, C#), Cocoa is like a breath of minty fresh air. The most obvious example of how this is true is in looking at what I spent most of time on with Java versus what I spend my time with in Cocoa.
Consider what every application has. I'm talking about basic things like drag and drop, the ability to undo and redo, saving things to disk and reloading them, changing colors, changing fonts, making things bold or italic, saving application preferences, and a graphical user interface. In Java, I spent a vast majority of my time — I'm talking at least 80% of every productive hour — just trying to get these things working. I say trying, because some things, like a complete drag and drop implementation, or the whole undo/redo thing, never got done, and a lot of things, like saving and loading, never got done well.
With Cocoa, all that stuff's done. It's about as difficult as saying, programatically, "Drag and drop seems like a good idea" and "Undo/redo? Yes" and "Saving stuff? Give me some of that!" and it just works. That's right, the whole "it just works" mentality that Apple's engineers work toward in Mac OS X also guides the APIs that programmers use to make programs for Mac OS X. This probably has a lot to do with the fact that people at Apple actually use the the same tools as any other programmer, so when they make those tools, they expect them to be usable. With programs, as with so much, never use a product its creators are unwilling to use themselves.
Using Java, I really got the impression those guys weren't using the same tools. From the very first line of code you write in any Java application, public static main(string[] args), you can see this to be true. Nobody else gets to have variable-length arguments in their methods, yet every Java program relies on this ability just to get running. We're definitely not playing by the same rules as the guys who made this tool, then, are we?
Objective-C: Reading glasses for code
The second part of the Mac development triad is the programming language, Objective-C. When you come from any of the C-syntax languages, such as C or C++, as well as Java and C# (I'll save the "C# is not C" rant for later), you get used to things looking a certain way. That way, if you're curious, is function(argument). Then you look at some Objective-C and it blows your mind with it's [receiver message] syntax. However, when you spend a little bit of time with Objective-C, disregarding any issues other than syntax at the moment, you can quickly see why this is better.
For example, let's say I had this Sandwich class that allowed me, via a completely contrived static method, to create a sandwich object into my previously declared lunch variable. It's a really big, complicated method, and in Java it would look something like this.
lunch = Sandwich.createSandwich(ham, swiss, potato, true, true, false, true, true, potato)
When you look at this method it's kind of hard to tell what's going on. All of the booleans are meaningless, and while ham and swiss are pretty obvious, potato shows up twice, which doesn't seem to make any sense at all, especially given that we are making a sandwich, and potatoes are not the kind of thing you usually eat between two pieces of bread. This causes the Java programmer to spend a lot of time going back and forth to the Java documentation because every time you write another argument you need to make sure what exactly you're adding, and if your methods are overloaded, you're really up the creek.
Of course, the Java community is smart and they have Javadoc, which makes it really easy to generate good documentation while you're coding. As a Java programmer, that seemed the ideal solution, but, of course, what I didn't realize was that instead of spending half my time writing self-documenting comments, I could just be writing self-documenting code. Look at the same order in Objective-C.
lunch = [Sandwich createSandwichWithMeat:ham cheese:swiss bread:potato lettuce:YES tomato:YES mayo:NO mustard:YES sidePickle:YES sideSalad:potato]
Suddenly we've got the light of day. All those booleans are tied to something explicit, and the weird potato phenomena make sense. Why are there two potatoes? Because one is soft, delicious potato bread, and the other is a nice side of potato salad. Why are there potatoes in a sandwich order? Well, same reason. The method name is so obvious (createSandwichWithMeat:cheese:bread:lettuce:tomato:mayo:mustard:sidePickle:sideSalad:), you might not even need to look at the method description, which makes coding faster, without the mental shift of having to read documentation every ten seconds, and does much to increase accuracy and reduce bugs.
It doesn't take a genius to see why, when NeXT was looking for a language, they chose Objective-C, and that's not even getting into the functionality of the language, which has something all other object-oriented C-ish languages lack: C. Unlike C++, Java, or the incredible mis-named C#, Objective-C is C. This means that the entire C language is right there when you need it. Can't get your drawing code right with the object libraries? Bust open the procedural libraries and get med-C-val on its ass.
Anyway, I hate to get this technical for my non-technical readers, but the utter joy that is Objective-C comes into play later in today's dispatch, so if you skipped all the code and explanation, let me just sum it up for you: Objective-C seems weird at first, but give it about an hour and you will see that it is, in fact, awesome.
XCode: In a nutshell, it doesn't suck
Third — and I will make this very short — I've been learning XCode and its little buddy, Interface Builder. I will just say that I've been avoiding such tools for a long time, instead using a text editor and command line tools, because I could not find an integrated development environment that didn't just suck. If you're an HTML wonk like me, and you see the garbage that tools like Frontpage and Dreamweaver spit out, you know my frustration. As an aside, I don't mean to say that Dreamweaver sucks nearly as hard as Frontpage. I mean merely to point out that even really good machine-generated code sucks a donkey's left nut. The greater point is that the Apple dev tools are IDE done right, and after worshipping at the alter of plain text, from VI through 8 versions of BBEdit, XCode has changed my religion.
Back to school
For the past year I've been going to school at DeVry University, in an attempt to finally finish my damned bachelor's degree. I picked DeVry for several reasons. First, it's right next to my house, and I hate commuting like the Supreme Court hates private property. Second, they have this accelerated program for working adults whereby you can go to class nights and weekends, which was important when I worked on weekdays. Third, they were highly recommended to me by a high school teacher I really admired. Finally, during my initial interview with the admissions counselor, I expressed my frustration with the University of Hawaii's policy that you had to start the computer science program at the bottom, no matter if you already knew, say, what a mouse was. He said that not only do you get to test out of that crap, you get to do so as a matter of course, In other words, they seemed to "get" the fact that if you are seeking a college degree in computer science, you probably already know some computer science.
I have a couple of frustrations with DeVry, however. One of them is they really don't have a washout rate. Pretty much, if you show up and do your work, you will probably end up with a degree. I think the barrier to entry in the computer science field needs to be harder than that, because it's a hard field. You have to really love the stuff to be good at it, and the last thing we need are more mediocre application developers developing more mediocre applications. This has led to there being some pretty frustrating individuals in my classes, and one of these individuals caused quite a ruckus in my first day back after summer vacation.
Honor fight
During the first break, I was talking about how I bought a ton of books over the summer, including one on learning Python. This kid, who has to be at least 21 to be in the program, but who acts 14, made this "eugh!" noise reminiscent of the woman who doesn't like Spam. I responded to that sound by saying, "well, I've seen some really cool things you can do with Python and I wanted to check them out, plus it seems like I know every other scripting language, so I figure I might as well learn this one. His response was to the effect of "Python is the crappiest language to come along since Objective-C."
I think I've made pretty clear my feelings on Objective-C, so of course I wasn't going to just let that go. I said that, while Objective-C seems weird at first, when you work with it a little while you start to really appreciate the readability and dynamism its strange syntax provides. His response was simply that "it ain't C," which, I pointed out, is complete and utter nonsense. Objective-C is C, and indeed, before it was a programming language in its own right, it was simply a C pre-processor. He said that if he wanted to objectify C, he would just use C++.
Then it occurred to me that this kid always talks smack about things he couldn't possibly understand, and that arguing with him on the subject was going to be pointless, because his stated opinions were completely uniformed. All I was going to get was frustrated, so I called him on it. "You don't actually know anything about Objective-C do you? In fact, you couldn't even stand up to the whiteboard and write a single line of Objective-C code, could you?" He got defensive and said I was shit talking and that he hated shit talkers. I told him he was the biggest shit talker up ins, and he told me if I shit talked one more time...
I told him I wasn't shit talking at all; that I was simply pointing out that he was shit talking something he didn't know the first thing about, and he actually started walking toward me, then, when the professor came back in, told me I was lucky. I was lucky? Wait, he was going to fight with me? He was going to actually, physically fight with me, over a programming language? And worse than that, a programming language he not only doesn't know, but in fact, doesn't even know about? That is the stupidest, saddest, most pathetic thing I've heard of, but at the same time, it got me really annoyed.
Let's say this guy jumped me in the parking lot. I wouldn't run, because that wouldn't solve anything, but indeed, would make my life hell. No, I would fight with him, and I would win, and what's more, I wouldn't just subdue him, because that would be half-ass, and I don't do anything half-ass. I would pound the living fuck of him until it took a team of skilled surgeons to put him pack together into something resembling a living being. When the police came, as they inevitably would, they would look at me and they would say, "you're 30 years old, six-three, three hundred pounds, and you just wiped the asphalt with a kid half your size? You're going to jail."
The little man is always scrappy like a little dog. I always thought that was somehow a defensive gesture, like, "I'm little, so I have to be mean, just to survive." This near-altercation made me realize that line of reasoning is bullshit. For one thing, I was small my entire pre-adult life, and I didn't get mean. No, it occurs to me that while the big man may make empty threats of physical violence, the small man can afford to call anyone out — the bigger the better — because even though they would get pounded, they know that in the court of public opinion, they are always going to be the victim, and that the big man must know this, thus they know the big man will not fight with them, and they will be able to seem tough by always showing the big man down.
Other Challenges
The class I'm in is advanced database, which means getting elbow deep in Oracle's PL/SQL, as well as doing some data mining and warehousing work in Microsoft's SQL Server 2000. Now, I don't mind Oracle, but I don't really like Microsoft or their products, so I was loathe to deal with SS2K. However, I don't really know database stuff, so I'm just as loathe to strike out on my own, which is what I usually end up doing when I get frustrated with my school-issued Windows laptop and start doing stuff on my Powerbook. Thus, I went ahead and (tried) to install SS2K.
Instead of simply, of, I don't know, working, the installer told me I didn't have enough free disk space. No, it said, you need at least 475 MB free to install this miserable piece of software. I checked the disk, and it had some 24.4 GB free. Now, where I come from 24 billion is bigger than 500 million, so I was a bit confused. I brought this up to the Windows using people behind me and they said that, in order to install from a CD, you either need to copy the CD to disk first, or mount the CD as a network drive. What amazed me about that response was not that it was so in defiance of any kind of logic, but that it was something that they "just knew," and indeed, that they not only accepted, but considered as normal.
I copied the disk, but it still didn't work. I tried and checked everything I could think of, and let me tell you, I can think of a lot of things. Then, when all else failed, and had been failing for an hour or more, I went ahead and consulted that most useful of technical resources, Google. I found, within the first page of my search results, not only an error that was similar, but indeed, a person in an experts forum complaining of the exact same issue, with screen shots and everything. His conversation, which lasted over gods-know-how-many frustrating months, was a lot of other people telling him what he needed to do, and his telling them that he already did that and, just as he had said three posts up, it didn't work.
Nobody really seemed to grok his problem, as they kept making suggestions that would, say, rely on the software being successfully installed, whereas I knew that the installer package had not even unpacked. Indeed, I felt his pain in the most real way possible, except that I was simply some student, and this was a person who was actually using this thing for its intended usage. I point this out, because SQL Server 2000 is enterprise software, which Microsoft deems fit for you to stake your multi-billion dollar business on. He eventually discovered the problem in Microsoft's own bug database, and I didn't believe it.
As I had picked the laptop up from re-imaging only that morning, I went ahead and downloaded and installed the software I download and install every time I pick the laptop up from re-imaging. That is, iTunes, Quicktime, and Firefox. Then, those done, I went ahead and tried SS2K again, and it installed without incident. I couldn't believe it, but his research had been correct: SQL Server 2000, an enterprise product that has been out for five years with this known bug, will not install if your disk's free space is divisible by four. Go ahead and take a minute to let that sink in.
It occurs to me that using Windows must be extremely satisfying. That's right, I said satisfying, and I say that because when you figure out the bizarre, illogical way to do something, you really feel like you've won a victory over your computer, since, to the Windows user, the computer is your enemy. When you've been using Windows a long time, since they have been known to let their bugs stand for a decade or more, you really start to accumulate an expert's level of knowledge. This much satisfying, arcane knowledge is a real investment, and you would be loathe to give that up for some computer that has the annoying habit of just working.
Indeed, in a recent interview whereupon I was asked to prove my Mac expertise, I found it difficult, because a lot of that stuff never happens, or happens in a logical way that gets solved without a lot of learning, or has an answer that is pretty easy to find. In the end, using a Mac for five years, I haven't really accumulated the tome-like memories that make you an expert. This gets you out of the habit of learning the arcane, so even things like the Unix terminal become pretty simple. Why memorize the
ps command or the various bitmasks of
chmod when you know help or man or a small book will know it for you. This may have bitten me in the ass, but I won't apologize.
So now my Windows brain has expanded a little. Now I know about the "free space divisible by four" error, and I know that when it occurs, the computer doesn't tell you that it has run into the error, but instead gives you a different, illogical error, from which you must simply psychically divine what it really means. This doesn't make me feel smart, however. Instead, it makes me feel dirty, like you feel after visiting rotten.com or hearing about your parents having sex. At the same time, it emboldens me in my decision to abandon the Windows using masses, and give up this idea of platform-neutrality as promised by Java, in favor of programming to the logical minds of the Mac user.
A new character enter
So now you know about my student status, which means I can tell you that I applied for a received a scholarship to attend Apple's Worldwide Developer's Conference. If you've heard about Steve Jobs' announcement that Apple is moving to Intel processors, you can add to that knowledge that I was there, in the auditorium, when he made that announcement. This was, of course, the WWDC keynote, on the first day of the conference.
What you may not know is that the conference has an extra day for students. The day before, Sunday, is student day, which is a day of goings on for students only. Our own sort of keynote address was given by Wil Shipley, a celebrity among Mac users in the know for founding the Omni group. The Omni group is the company that makes, among other things, Omni Graffle, a program that, when held next to its PC counterpart, Microsoft Visio, pretty much settles the whole Mac vs. PC debate. Well, Wil stopped working for Omni and started a new company called Delicious Monster, which has a product called Delicious Library, which I've used since it came out, and which I love.
For now, I'm not going to get into DM or DL or even how I met Wil or what his talk was about. I will plug his site, wilshipley.com, where you can actually download his talk, and where, I dare say, Wil can speak for himself. I will say, however, that Wil has become my mentor, and more, we have become fast friends. I mention this not only to brag that I'm friends with THE Wil Shipley, but also to finish out my stories of the day.
Yesterday, as on so many days, the Lemur and I drove up to Seattle to have dinner and play Munchkin with Wil. While we were there, he popped into an electronics store and bought a projector. The projector was not in stock, and the warehouse is in Kent, where we used to live, and Wil didn't want to wait for them to have it sent over blah blah blah so I picked it up for him and delivered it to his house. We played with a bunch of different ways to set it up, taking it from a 60" screen to a screen that is so large it's ludicrous to measure it in inches. (It was like, ten feet). Wil is a big fan of the new Battlestar Galactica, and I've been desperately trying to track down the first season so I can be caught up for the big Season Premier party in ten or so days.
Finishing up
From there we drove down to Tacoma to attend a birthday party of one of the Lemur's old friends. There was meat and drink and drunk girls making out and all that sort of goings on. Having already worked on this for several hours, I won't go into it too much, but I will take this as a chance to plug the Lemur's own blog resurrection, Frink! Script! Ptank!. Enjoy.