Oh... You feel your brain's been locked up tight Writing good code at only at night Waiting for a job To challenge you
You're cracking your knuckles, trying to code my way But that don't mean I'll hire you right away Laddy, Laddy, Laddy (Lady, Lady, Lady?)
Yo yo... Your mouth's saying hire me Oh woe... But my brain's saying let's see C
If you wanna work for me, laddy There's a price you pay I'm a stickler for design You gotta write code the right way If you want an ADA I can make your wish come true You gotta make a big impression I gotta like what you do
I'm a stickler for design, laddy Gotta write code the right way, money I'm a stickler for design, laddy Add, add, add, and then cut out
The iPhone's coming and AAPL's so not low One more release of Library to go Waiting for someone Who impresses me
Fingers racing at the speed of light And not just because I'm in a Twitter fight Laddy, Laddy, Laddy (Lady, Lady, Lady?)
Yo yo... I only have one engineer to go Oh woe... But I'm still going to hire slow
If you wanna work for me And then Apple someday I'm a stickler for design You gotta write code the right way If you want to get low pay I can make your wish come true Send me sample code, laddy And maybe I'll hire you
I'm a stickler for design, laddy Gotta write code the right way, money I'm a stickler for design, laddy Send, send, send your sample out
First off, Lucas Newman is leaving Delicious Monster -- as of January 1 he will be an iPhone engineer. This is an amazing opportunity for him, one I would never ask a friend to pass up. We remain buddies, although I'm running around Zoka these last couple weeks telling every girl I see that Lucas was secretly super-hot for her and is leaving now, which I think is starting to annoy him. Although, honestly, they'll probably all end up throwing themselves at him and he'll end up on top, again.
For those keeping score at home, this makes Mike Matas, Scott Maier, Tim Omernick, Drew Hamlin, and Lucas Newman that Apple has hired out of my employ. Yes, in fact, 100% of Delicious Monster's ex-employees are now working for Apple! You'd almost think Apple would start to pay me to train people for them. Oh, well. It's every kid's dream to work there, I can't say I blame them. Heck, I might work for Apple myself if they ever asked. And, like, wanted to give me EIGHTY ZILLION DOLLARS.
Also, seriously, if you want to work for Apple, you MIGHT want to, you know... GET TO KNOW ME.
--
Mike Lee is staying at Delicious Monster -- for now... DUM DUM DUM! You have to figure he's playing the various Apple teams off each other -- when you work at Delicious Monster, you don't jump for the girl that asks you to dance. Mike's all: "CoreAudio? Don't waste my time, sweetheart." "OS X Server? I'm sorry, you're not even getting an interview." "Ali Ozer and Scott Forstall got into a fistfight over me at lunch today? Now, see, these guys understand what kind of ball we are playing."
--
I realized tonight that I had yet another problem with CoreData, and it was a doozy, and not something where I could just put a hack on it. In fact, it was indicative of a fundamental architecture mismatch that I've been struggling with since I started this project.
So, this is a little vague, but I thought it might be important to document the process. Basically, when I bang up against a wall, I start looking bigger and bigger and bigger. Like, imagine I'm having trouble with a crumbling wall in an aqueduct -- my programmers brain does this: "Ok, why did I build this wall?" To keep the water in. "Why do I have water?" Because you need that to turn the water-wheel. "Is there some other way to turn it?" Not easily. "Why must it turn?" To power the grinder. "What needs grinding?" Corn. "Is there some other way to grind it?"
I'll get to truly huge things, where I start asking if the world even needs an app that catalogs books and DVDs and now boardgames when we could all be under five feet of water in a few years. Then it's time to take a nap and wake up and start again.
But my point is, you HAVE to question all the basic assumptions that led you to where you are, or you end up spending all your time writing the wrong code. I have always said that if you give me a perfectly spec'ed out program (one with a spec that can actually work, that I'm not going to have to modify as I go along), I can write that program for you in days. Always. The problem with coding is (a) fighting with frameworks, and (b) trying to figure out how the program should look, work, and interact even as we code it.
So we end up spending a lot of times fixing bugs in code that we really shouldn't have written in the first place -- code that doesn't really help the user, that just makes the app more complex, that is for a feature that never should have been put in, or is interacting with the user incorrectly and we're just putting spackle on a wall that's crumbling.
So here I am, tonight, running into my 1,000th bug with the fundamental mis-architecture in CoreData, which is that interacts with the UI layer and the disk layer / undo layer all using the same mechanism. They all rely on -didChangeValueForKey:, which is a huge mistake, because it means that, as a programmer, I can't sneak any data in -- I can't change a value without it creating an undo event.
Consider if, for example, I had a clock and its hands were CoreData objects. As they move forward through time, their position updates, so I'd tell them to update. And each time I did, an undo event would get pushed -- so the user actually could undo time.
This is obviously a contrived example, but it also points to the fundamental problem -- CoreData objects can't mix undoable and non-undoable changes.
So I've been struggling for three years now, trying to bend and hack and cajole CoreData's undo architecture into allowing me to do some actions synchronously and some asynchronously. (For instance, obviously, once the program has downloaded a cover from Amazon in a background thread, you don't want to UNDO the download -- it's not actually a state change, it's just a cache change -- yet, by default we end up with an undo event on the stack, in the MIDDLE of whatever the user is actually doing in the foreground.)
Fight fight gnash gnash complain complain. Tonight I hit on it. I needed to step back. Why isn't this working? Because undo wasn't designed this way in CoreData.
Well, I have undo in Delicious Library 1. It's not "magic" like with CoreData, but it works. In fact, now that I am thinking about it -- I've spent months and hundreds of lines of code trying to get CoreData's "magic" undo to work, when, in fact, there are really only FOUR actions that are ever undone:
1) Add a book -- undo to delete it 2) Delete a book -- undo to add it back 3) Change a property on a book, like its title or author -- undo to change it back 4) Make a loan -- undo to return the book 5) Return a book -- undo to re-make the loan
That's... about it. SO WHY HAVE I SPENT ALL THIS TIME TRYING TO GET COREDATA'S MAGIC SYSTEM TO WORK?
There's only five damn methods, at the top level, that need to participate in undo. It's pretty obvious I should be managing my OWN undoManager, turn off the one in CoreData, and just use CoreData for what it is EXTREMELY good at, which is minimal change tracking and fetching and storing data VERY VERY quickly.
Suddenly all these issues I've been having disappear. I don't have strange extra undo events on my stack when I fault in an object, because although CoreData might think my object changed, it's not driving the undo manager any more -- and when it goes to save, it's going to quickly discover there's no real substantive changes and just discard the whole event.
I don't have to try to work around some undo events by turning undo on and off, which required me to flush CoreData's transactions queue by hand, which was extremely sketchy because if you do it in some circumstances (eg, the middle of inserting a new object) the object will be corrupted.
--
I haven't started this yet -- I'll try it tomorrow. It's nice -- it'll pick up a bunch of the remaining issues I'm having in DL2, and should give us a good solid beta. The important thing here is, I was just too married to part of the code. I was so into using CoreData's magic undo that I kept going farther and farther to make it work, when I really needed to say, "Ok, this doesn't work in this situation, I'm doing my own undo in 40 lines of code."
F.P. Murray Fuzzcat was a pure-bred Persian born to champions, bred by my sister (a veterinarian in California) to show or sell. His nose was deemed "too large" at birth, so she gave him to me, for mere room and board. Later in life, my sister would inspect him and reverse her decision -- he had "grown into" his nose and could have been a champion, had I not already taken his manhood. (Thom-hood?) I didn't have any interest in going to cat-shows with my little guy, but it made me feel good to know that the blood of champions throbbed through his veins.
When a cat dies you understand that most people, while being able to empathize with your pain, won't actually give a crap themselves. Murray didn't work for world peace. He built no homes for orphans, and his response to the Hurricane Katrina was indifference. He was a cat.
But, still. There are lives he touched, especially mine. My only memory of Murray is purring. He was the purriest cat I have ever known. Years ago I would take business conference calls in bed when major clients wanted to chat at 7AM and I wanted to sleep until noon -- I would lie there with my cell phone talking with captains of industry while Murray sat on my chest and purred at me. One time a vice-president for McGraw-Hill interrupted the conference call and interjected, "Wil, are you on a motorboat?" I shit you not.
When I was sad, Murray would lick my ears. When I was saddest, I would wake up and he'd be stretched out beside me, and his little paw would be resting in mine. When I'd wake up he'd sit up and purr at me, from just out of reach. I used to play chicken with him, and sit there staring at him and see how long he'd continue purring before I had to pet him. I'd always give up and give him a scratch before he stopped purring.
Murray had great taste in women, and I trusted his judgment on which ones to date. Upon first meeting Murray, one of my favorite lovers remarked, "You are just a little lover, aren't you?" She honestly loved Murray more than me, I think, and I honestly understand why.
Murray was a gentle soul. If I threw him in the bath for poopy-butt he'd just meow forlornly and try to leave -- I never got scratched by him so that it bled. He was so gentle with his claws that I would frequently forget he had them at all, and not clip them for years at a time, and then one day I'd notice they'd grown inches long and curved all the way around like the stereotypical wizened asian wizard.
Murray was 18 years old, and his kidneys were in advanced failure. There is no cure except an experimental surgery which transplants kidneys from a young, healthy cat into my ancient one. I could not justify that in my head. Over the last two days he suddenly got much sicker, and I finally realized he was done.
As I held him in the vet's office, they gave him a sedative and then the poison. I put my ear up to his nose so I could hear his breathing, and so he could smell earwax, which he really did love. I stroked his throat and with each little exhale I could feel the tiny rattle of a faint purr -- the last purrs he had in him had to come out.
My last words to him were, "Thank you, little guy."
There are so many clichés that, as I grow up, I find are really true. And with every one, I go through the same process:
"Gee, I've discovered this amazing and unique thing about humanity that no one has ever discovered before, but how can I express it in words... Hmm, well, in this case, I want to convey the idea that sometimes you want to express a sexual attraction to a person and have them confirm a reciprocal attraction, but you don't feel a level of attraction where you'd want to start anything long-term -- you just want an innocent exchange of physical compliments... If only there were some succinct way to say it, like, uh...
"Oh, I know: A kiss is just a kiss.
"Oh, wait."
[It's another cliché that every generation thinks they're the first ones to feel every emotion, and have every idea.]
--
"Youth is wasted on the young," my mom used to always say to me, which made me want to smack her, because *I* was young, and I was hearing her basically saying that she wanted to suck the life-force out of me and horde it for herself. That ship has sailed, mom! (I already did the opposite to you.)
Now I'm reasonably old, and I find myself thinking, "Damn, I wish I had all the time ahead of me that I had when I was 20, because I think I've finally started to figure out what life is about, and I was so miserable then, but now I'm worried that by the time I really get it down, I'm going to be enfeebled and not able to enjoy it... if only there were some succinct way to say this... some kind of saying... oh, wait."
Damn you, mom!
But the cruel irony of clichés is we're doomed to not understand them until the moment we re-coin them for ourselves. Just as you can't explain to someone why it's bad to stick their hand in a flame until they've actually felt pain, you can't explain love and loss and happiness and inner peace to someone who hasn't experienced those things, first-hand. And, by that time, their response will just be, "Duh, I know that now, you should have told me a long time ago."
--
Recently I've been thinking about nature of loss, and how we all want to deny to ourselves that it will ever happen to us. We want to believe that every love is our last love, that our cat will outlive us, that our job will continue to be a perfect fit forever, that our health will continue until we drop dead, which we won't ever do anyway, and that our friends will never move away or betray us or simply grow more distant over the years.
And, yes, all evidence points to the contrary. Most people think I'm morbid when I say, "You know, this relationship *will* end badly," and they won't discuss it further with me. But, honestly -- the very best we can hope for is that our relationship will end with one of us dying. And, seriously, that's going to suck for both the dead guy and the person left behind. Or we could hope to both die simultaneously, but, I dunno, that doesn't seem entirely awesome either. ("Hope you die when I do, honey! Good night!")
--
We are denial machines. This is what I've learned going to TED these last couple years -- there are several amazing talks on this, I'll point to this one by Michael Shermer on "Why people believe strange things":
And this one by Dan Gilbert on "Why are we happy? Why aren't we happy?"
There are others which I can't find at the moment -- I encourage you to look around. And maybe I'm doing a disrespect to the incredibly intelligent people who've written these talks by restating them in my own words, but, hey, that's how I do.
So, the gestalt I got from TED was: we are "designed," as beings, to be unreasonably optimistic. That is, we have evolved an unrealistic optimism as a defense to the fact that everything good ends, and in fact ends badly. (By definition -- if we're enjoying something, we don't want it to end, but everything ends, and if we're not enjoying something, the good part has already ended, so QED.)
As we stood erect and grasped things and used tools and grew our brains, we became self-aware, and then aware of the finite span of our happiness, and our genes faced a dilemma (evolutionarily speaking): our race could either be hopelessly discouraged by the tragedy of life, or we could be kept a little bit stupid so we wouldn't think about it. But this is a logical fallacy: a false dilemma -- there's a third route, which I believe evolution took: she gave us with a blind spot. We are, fundamentally, illogical when it comes to our expectations of happiness.
There is another cliché of sorts, or perhaps more of an aphorism: "In 100 years everyone you love will be dust." This is simply a truth. But it's depressing. Right now your mind is busily throwing away that sentence. You are reacting to it as you would a bad smell. You might even be angry that I mentioned it. "Why are you burdening me with this? What the hell good did you just do me?"
But I'm not burdening you, not really. You're not going to be thinking about that sentence tomorrow. It's your defense mechanism -- well, it is if you're a lucky, normal person. There are lots of depressed people out there, and they have trouble ever moving away from those thoughts, so, sorry to you guys, but I bet you've already thought of that one anyway.
Let's consider depression, and also consider that the geniuses we revere today were generally very disturbed, unhappy people. Are we, in fact, evolved not to be too smart, because at some point when you crank up intelligence, you can't help but see past your blind spot, and start to notice that life is, in the end, futile? That no matter how much we struggle, we WILL lose everything; we will die. We will be alone when that happens.
So what, you say? Why not just enjoy the here and now? But I say this is a sham. You're lying to yourself. Because if I told you, with certainty, that you were going to die in 10 minutes, you wouldn't try to enjoy the here and now. You'd be crushed. Paralyzed. You wouldn't say, "Oh, boy, I need to make sure I really enjoy those 10 minutes! I'm going to eat an entire cake, screw the calories! Then have sex without a condom!"
--
I want to note I'm using a generic "you" here, in part to represent myself. Please don't take offense. I'm not trying to pick on YOU you, in particular. Nor am I scorning humanity from some mighty perch. I'm part of this sham. I get up every day and struggle to convince myself that, for some reason, things are going to get better for me, when, by definition, all the available evidence (eg, my life so far) suggests that things will be as good for me as they have been, and no better.
--
Imagine a society of rational beings (without our blind spot for how bad life can be) came to Earth to observe us -- ignore that this race wouldn't have developed space travel because they'd all be too busy staying up until 4am taking bong hits and watching "Chuck" on NBC.com trying to forget how miserable they are.
Now, imagine what they would think of our lottery. This alone pretty much demonstrates that we are unreasonable optimists. We know, KNOW, that the average person who buys lottery tickets will not hit the jackpot. That, in fact, they won't break even. Not "average" as in 51% of people -- we know the vast majority of people lose. We KNOW, and in fact are explicitly told at the point of sale that the odds are amazingly stacked against us, and we are pissing our money down a hole.
And, in fact, even if we were to win, most of us understand the cliché that "money doesn't buy happiness." We've seen the human-interest stories on lottery winners and cluck-clucked over the statistic that most of them report being less happy after winning the lottery, and a large number go bankrupt within a few years.
"But that won't be me!" we say. We are promised, guaranteed by the seller and by every mathematician that our odds are exactly the same as everyone else's, yet we make up new rules for ourselves, in defiance of all logic, that say we're going to win, and moreover enjoy it when we do. Dammit.
Because we need something to look forward to. We need the dream. Once, long long ago, there were two types of people: those who could fool themselves into thinking life was worth living, and those who couldn't. Needless to say, the second group died out really quickly. And the first group has had millions of years to perfect its technique for overlooking the bad in life.
--
Again, I'd like to interrupt myself and say, hey, unreasonable optimism is a really good thing for most of us, most of the time. I mean, I have nothing against being happy, whether it's reasonable or not. If you want to sing in the rain, well, it's a bit of a cliché, but I obviously have nothing against those. I will join you whenever I can.
--
But maybe -- and this is what I've been thinking about -- just maybe, we should be AWARE that we're fooling ourselves. Maybe we need to occasionally pull our heads out and do check on the actual position in the world, and say, "Yes, we need to believe in order to get out of bed in the morning, but we also need to sometimes consider reality from a very rational standpoint, and make sure we're merely singing in the rain, and not singing in a monsoon that is the precursor to a giant flood that's going to kill us unless we climb that hill over there right now."
I feel that way about things I blog about, like global warming or war or politics, obviously. In general, we want to trust our politicians to take care of us -- we need to -- but it is also our duty to examine the world closely every once in a while, and not be surprised if it's screwed up and needs another course correction before we get back to our comfortable denial. It's been needed many times in the past (this isn't even our first energy crisis this half-century), and we shouldn't feign surprise when it happens again.
--
So, yes, when I start a relationship, I tell the woman, hey, you know, in all likelihood this will end in tears. (You're sorry you're not going out with a prize like me, right? Mayhap you're surprised I'm still single at 38?)
But, wait... in my defense (possibly weakly) I'll point out: ending in tears is not necessarily bad. I mean, it's just there. It's a fact that we will end, it's simple probability that we'll end unhappily, unless you want to redefine happiness. So, let's spend a little time planning for it. Thinking about the possible endings. So we can mitigate the bad things that are fungible and probable, and go back to ignoring the rest.
Let's spend some time getting me life insurance, so if I do die, you can continue to live in my house. Let's think about what we'd do if we simply grow out of each other, so we can be civil if it happens.
And most importantly, let me say this to you -- my friend, my lover, my family -- in advance: if it does end, I want you to know I won't regret it. Because everything ends. We spend all our time denying it, and when it finally happens we think it's the biggest tragedy in the world. I know this -- I've lost or given up the most important people in my life several times now. Sometimes I lose sight of the fact that it was inevitable. And if we only let ourselves think about loss when it strikes, we're going to be overwhelmed.
How many relationships end where one person says, "I'm sorry I ever met you?" I've never felt that way. I'm never sorry, because you obviously brought something into my life; that's why I invited you in, in the first place. I'm often sorry that it ended (and sometimes not), but I always knew the end was there. I don't like loss, but an ending doesn't negate all that was good.
--
"Goodbye is hard to say." You knew I was going to end with a cliché, didn't you? I think the person who coined that one was thinking the same things as I am now, and came to the same conclusions, maybe. And that person said, damn, blogs haven't been invented yet -- is there some snappy saying I can come up with that will be remembered by the next generation, so they can avoid all the heartache I had?
Well, no. You can't avoid heartache. But you can understand that it's inevitable. And, sometimes, maybe that's what you need to hear. Yes, you're going to hurt. I'm sorry. Don't let it spoil everything good.