Bill Dudney
00:00:00
◼
►
Hello and welcome to Developing Perspective. This is the second in the interview series
00:00:04
◼
►
that I'm doing here on Developing Perspective where I sit down with an interesting iOS or
00:00:08
◼
►
Mac developer and talk about their experiences, some of the lessons they've learned, how they
00:00:12
◼
►
work, how they work productively, and hopefully help us all kind of learn and get better at
00:00:16
◼
►
our development as a result. These interviews are longer than 15 minutes, so a little bit
00:00:20
◼
►
of a break from the normal pattern on the show. I try and keep them under an hour, but
00:00:24
◼
►
I just wanted to let you know that I had time. Otherwise, I hope you'll enjoy. Sit back,
00:00:27
◼
►
and today I have Bill Dudney with me.
00:00:30
◼
►
All right, it's my pleasure to introduce Bill Dudney of many things, and I'll go ahead and
00:00:35
◼
►
Bill, introduce yourself, say what you're doing, what kind of work you do.
00:00:39
◼
►
Sure. So my name is Bill Dudney, and I've done a whole bunch of seemingly random stuff
00:00:46
◼
►
starting back in college when I first touched my first NeXT computer in, I think it was
00:00:50
◼
►
89 on system dot 9 which was really cool a lot of fun I did a bunch of objective
00:00:56
◼
►
C and did much worse in school the semester I bought my next computer and
00:01:03
◼
►
so that led to a bunch of whole a whole bunch of next step stuff until 97 I got
00:01:08
◼
►
into Java did that for a while and then decided I was fed up with the whole IT
00:01:13
◼
►
space and got back into the Mac and I was building a Mac app when the iPhone
00:01:18
◼
►
It first came out and my wife built a couple of web apps for the initial iPhone and yeah,
00:01:27
◼
►
they did amazing.
00:01:29
◼
►
We had a bazillion plays on the games that she wrote and made a bunch of money off of
00:01:32
◼
►
Google Ads, which was crazy.
00:01:34
◼
►
Like who makes money off of Google Ads on iPhone games?
00:01:38
◼
►
So anyway, so then when the SDK was announced, I decided it was time to stop messing around
00:01:42
◼
►
with the Mac app I was writing and go build the apps that she did that were the most popular
00:01:47
◼
►
in web technologies to rebuild them in native technology.
00:01:51
◼
►
So I did that and then at the same time I had gotten involved with the prags writing
00:01:57
◼
►
the iPhone SDK book right after I finished the core animation book.
00:02:01
◼
►
And so then I finished that book up and then since then I've written, I don't know, probably
00:02:06
◼
►
another four or five apps for both iPhone and iPad and then many of those have been
00:02:11
◼
►
mine and done a couple for clients and teaching at the iPhone studio or iOS studio as it's
00:02:18
◼
►
known now for pragmatic programmers and pragmatic studio and so a lot of random stuff, speaking
00:02:24
◼
►
at conferences and teaching people all over the place.
00:02:27
◼
►
And a brief stint working in the Mothership?
00:02:29
◼
►
Yes, it was a blast.
00:02:31
◼
►
I loved Apple.
00:02:32
◼
►
It was a very cool place.
00:02:34
◼
►
But it was hard to be away from the mountains and I really missed being able to teach.
00:02:38
◼
►
I didn't think that it would affect me as much as it did, but it was really hard being
00:02:44
◼
►
inside Apple where I couldn't blog about Objective-C or I couldn't talk about iPhone SDK or whatever
00:02:50
◼
►
with people outside because everybody always thought, even if I was just saying something
00:02:55
◼
►
random that I thought was interesting, I didn't want that ending up on Mac rumors, right?
00:03:00
◼
►
So I had to button my lip and not talk about it when I was outside of work, and that part
00:03:04
◼
►
was frustrating.
00:03:05
◼
►
Again, like I was telling you earlier about teaching, I love standing in front of a group
00:03:10
◼
►
of people and saying, "Whatever, blah, blah, blah, this cool thing about iPhone," and then
00:03:15
◼
►
go and watch what cool stuff they come up with and watch the light bulb turn on and
00:03:20
◼
►
stuff like that.
00:03:21
◼
►
That's just a blast and I love doing that and I really missed it.
00:03:24
◼
►
And I missed the mountains, so it was hard to be in California and not in Colorado.
00:03:30
◼
►
So speaking of Colorado, so that's where you're right now in Breckenridge, right?
00:03:34
◼
►
Maybe you can kind of paint the picture of when you go to sit down to work, when you're
00:03:39
◼
►
wanting to be productive, whether that's writing for your book or working on apps for yourself
00:03:43
◼
►
or for clients, what does that environment look like when you really want to get to it?
00:03:49
◼
►
So my most productive time, what I try to do is I'm an early riser, so I get out of
00:03:53
◼
►
bed 4 or 4.30.
00:03:55
◼
►
I spend a half an hour sort of getting caught up on what happened the previous day.
00:03:58
◼
►
I read a couple of blogs and look at stuff on the net and whatever.
00:04:02
◼
►
And then by 5 a.m. I have my coffee brewed and I'm sitting in front of my computer and
00:04:06
◼
►
it's usually dark because you know at 5 in the morning it's dark or whatever.
00:04:11
◼
►
I like the room to be dark.
00:04:12
◼
►
I keep all the shades closed even during the day when it's bright outside and I you know
00:04:18
◼
►
just sort of that's the time after that half hour of sort of waking up and drinking my
00:04:22
◼
►
first cup of coffee.
00:04:23
◼
►
That's when I get in the zone.
00:04:24
◼
►
And then I'll usually work for about two and a half to three hours till around 8 o'clock
00:04:29
◼
►
when the family's awake and everybody's ready to eat breakfast or has already eaten breakfast,
00:04:33
◼
►
then I'll go over. It's been 15 minutes with my family or whatever saying good morning
00:04:36
◼
►
and then I come back and I get back to work. And again, that takes about 15 minutes after
00:04:42
◼
►
that's over to get back in the zone, but that's how I get there is sort of have the room dark
00:04:49
◼
►
and quiet and just sit in front of my iMac and have the brightness of the computer illuminate
00:04:56
◼
►
the room, but that's about it.
00:04:57
◼
►
So you run an iMac?
00:04:59
◼
►
Are you a single monitor kind of person?
00:05:01
◼
►
So I have two monitors and I usually keep design oriented stuff on one monitor and then
00:05:07
◼
►
Xcode on another monitor.
00:05:10
◼
►
I try to keep email hidden or quit for a couple of hours at a time.
00:05:16
◼
►
Although sometimes when there's stuff cooking with clients or whatever I definitely have
00:05:19
◼
►
email going so I can respond right away.
00:05:21
◼
►
But I find that to be really distracting.
00:05:23
◼
►
email things beep and you got a four unread messages I start getting nervous and scratching
00:05:29
◼
►
my chin and fighting the urge to check to make sure nothing's going on or whatever.
00:05:33
◼
►
Yeah, four is I think like any number below five is the worst. Because I find at least
00:05:38
◼
►
for myself if you have like every now and then you see someone just a screenshot of
00:05:42
◼
►
their computer and you'll see it's like two or three hundred unread messages or whatever.
00:05:45
◼
►
At that point it doesn't matter.
00:05:47
◼
►
Exactly. It could be four thousand, right? You just whatever.
00:05:49
◼
►
- It just doesn't matter.
00:05:50
◼
►
But what do you, from a computer,
00:05:51
◼
►
if you only have four or five,
00:05:52
◼
►
then I find that that's, or one is even worse.
00:05:55
◼
►
- Yeah. - What is that?
00:05:56
◼
►
- Yeah, it's always-- - I know what it is.
00:05:58
◼
►
It's one thing right there.
00:06:00
◼
►
- It's very hard to not look at that, yeah.
00:06:02
◼
►
Yeah, so if I have it quit and it's gone,
00:06:04
◼
►
then I find it doesn't distract me.
00:06:07
◼
►
But I also have to have my phone somewhere
00:06:09
◼
►
sitting on a cloth so the way it vibrates
00:06:12
◼
►
when the mail come in, it doesn't make me think,
00:06:14
◼
►
should I launch mail?
00:06:15
◼
►
I think I'll go launch mail
00:06:16
◼
►
and make sure that's not something important.
00:06:19
◼
►
And so in terms of other than Xcode, what tools and apps and things on your computer
00:06:24
◼
►
do you typically use when you're working?
00:06:28
◼
►
So I always have to have some sort of, when I'm writing, I have some sort of text editor.
00:06:33
◼
►
I've been using TextMate.
00:06:34
◼
►
I've been playing with the free BB Edit thing and then even just TextEdit to edit XML or
00:06:44
◼
►
markdown stuff or whatever for stuff that I'm writing.
00:06:47
◼
►
When I'm working on the book or a book for Prague, I'm usually writing in XML.
00:06:54
◼
►
And a lot of people complain about that, but I don't really find it to be that distracting.
00:06:57
◼
►
I guess it's sort of like I have the four or five tags or whatever that I use all the
00:07:03
◼
►
So it doesn't really get in the way for me.
00:07:05
◼
►
Some people, it drives them nuts and they can't ever like get over the hump of being
00:07:09
◼
►
able to just use those four or five that they use all the time.
00:07:13
◼
►
So yes, so that's either TextMate or I think it's called Text Wranglers for listening.
00:07:19
◼
►
Yeah, so people who make BB editors.
00:07:20
◼
►
So you're editing that just in a regular, just a raw text editor with syntax highlighting
00:07:24
◼
►
and all that.
00:07:25
◼
►
Yep, exactly.
00:07:26
◼
►
And so, I mean, the bulk of what goes into a book is text, right?
00:07:30
◼
►
And so there's only a little bit of markup around, you know, this is a class name or
00:07:35
◼
►
this is an Objective-C method name or whatever.
00:07:38
◼
►
So I find I'm really, I'm using those four or five tags, paragraph, Objective-C method
00:07:42
◼
►
in Class Name a lot and the rest of them, you know, there's a ton of flexibility in
00:07:46
◼
►
there in terms of how you can organize stuff and tag it and everything, but yeah.
00:07:52
◼
►
Other tools that I use, I use OmniGraffle a lot to draw pictures, and I do that for
00:07:58
◼
►
both. So when I'm doing either training for Pragmatic Studio or I'm doing public speaking
00:08:03
◼
►
at conferences like CocoConf or whatever, a lot of what I try to do with my presentations
00:08:09
◼
►
is be very visual. I hate going to presentations where there's a thousand words on the screen
00:08:14
◼
►
and I hate sitting through those and I don't want to make presentations like that. So I'm
00:08:18
◼
►
typically doing something very visual. It's either, you know, a screenshot of something
00:08:23
◼
►
going on on the screen or it's a OmniGraffle drawing or whatever. So that's a tool that
00:08:29
◼
►
I use a lot for doing those things. Sometimes it's really helpful for me to use OmniGraffle
00:08:35
◼
►
to sort of sketch out an idea to, like when I'm thinking about, especially if I need to
00:08:40
◼
►
conceptualize the classes of something. Sometimes I'll draw pictures, you know, I hate UML.
00:08:46
◼
►
I used to be a big proponent back in the Java days of doing UML. So I try very hard not
00:08:51
◼
►
to do anything that's even remotely resembling UML. But what I'll do is drop a box, name
00:08:56
◼
►
it, whatever, you know, some class name, and then write some notes about it, and then sort
00:09:00
◼
►
of use that to visualize the interconnections between the classes and how they're going
00:09:04
◼
►
talk to each other and divide up the responsibilities and stuff.
00:09:07
◼
►
Yeah, I always find that I just do that in Xcode.
00:09:12
◼
►
My approach for whenever I'm kind of, if I'm going to sketch something out, I'll just do
00:09:16
◼
►
file new class just ten times and kind of, I don't know, I always think in code I guess.
00:09:22
◼
►
For me that's where I start playing with it is.
00:09:25
◼
►
And for me, more often than not, once I've got a couple, like once you get your beachhead
00:09:31
◼
►
of like, "Okay, this seems to be working, and I'll just keep running in Xcode."
00:09:35
◼
►
So I find that, or I guess it's on a whiteboard, but...
00:09:38
◼
►
So I find sometimes I do that, and sometimes it's really productive for me to start an
00:09:42
◼
►
Xcode and creating new classes.
00:09:45
◼
►
What I find a lot of times is I'm most productive if I do that and then delete all that code,
00:09:51
◼
►
or at least push it aside and start over from scratch.
00:09:55
◼
►
Because what I'll do when I'm like, "New file, new file," and I'm connecting these classes
00:09:59
◼
►
and just basically hacking to see how I think I want this thing to work, is I get to an
00:10:04
◼
►
idea where I'm like, "Aha!
00:10:06
◼
►
That's the way it ought to work.
00:10:07
◼
►
Oh, but I have all this garbage that I've created."
00:10:10
◼
►
I was creating a relatively large XML parser that was taking XML and turning it into Objective-C
00:10:17
◼
►
objects and then vice versa.
00:10:20
◼
►
I asked to have written it three times because I wrote it the first time like, "Oh, this
00:10:23
◼
►
is horrible."
00:10:24
◼
►
And then I started writing out in OmniGraph what I was going to do.
00:10:27
◼
►
I was like, "Oh, this is horrible too."
00:10:29
◼
►
So I pitched that and then I went back to code and created a whole bunch of code.
00:10:32
◼
►
"Oh, this is all horrible, but if it did this…"
00:10:35
◼
►
So it was like the third time was the charm.
00:10:37
◼
►
I talked to a lot of people who have a hard time pitching that code.
00:10:40
◼
►
They're like, "Oh, I just spent a week writing all that code."
00:10:43
◼
►
You know, but if you've got to maintain it for six months, oh, I'd much rather pitch
00:10:47
◼
►
that week's worth of bad code and start over.
00:10:49
◼
►
What kind of version control do you use?
00:10:52
◼
►
That's one thing that I've often…you always hear about, like, for example, Git or Mercurial
00:10:56
◼
►
or one of those.
00:10:57
◼
►
"Oh, the lightweight branching is great," for exactly that kind of reason, where you're
00:11:01
◼
►
creating these experimental or thought branches rather than having it be a big, heavy operation.
00:11:07
◼
►
Is that the kind of way you do it?
00:11:09
◼
►
So, you know, I try to love Git, but it's like, how can we make the simple stuff as
00:11:16
◼
►
heinously complex as possible and then make the really difficult stuff possible?
00:11:22
◼
►
I hate that mentality.
00:11:24
◼
►
I'm really glad that it's free and that it's open source and I love GitHub because you
00:11:27
◼
►
can share stuff and whatever.
00:11:29
◼
►
I love that.
00:11:30
◼
►
I just find Git to be so insanely complex to do really simple stuff.
00:11:34
◼
►
I'm working on a project with my son and in order for us to share code I have to commit.
00:11:39
◼
►
Oh, but wait, commit doesn't do it.
00:11:40
◼
►
I have to commit minus A. Oh, wait, I've got this other thing because he committed one
00:11:45
◼
►
Now I've got to pull.
00:11:46
◼
►
Now I've got to commit again.
00:11:47
◼
►
Now I can actually push it.
00:11:48
◼
►
And that just drives me up the wall.
00:11:51
◼
►
But the client wants that, wants it in Git.
00:11:53
◼
►
So whatever, I'll do it.
00:11:54
◼
►
It's just not my favorite.
00:11:56
◼
►
So I just use subversion or I sometimes use get, but it's behind the Xcode make a snapshot.
00:12:04
◼
►
So that makes it really simple to sort of revert.
00:12:07
◼
►
I find if I'm doing a lot of hacking where I go down a thought branch and I pitch it,
00:12:12
◼
►
I want to make a snapshot so that I keep that around but it's not in the normal stack of
00:12:19
◼
►
I guess I've heard that that uses Git behind the scenes.
00:12:23
◼
►
But I don't care, right?
00:12:23
◼
►
Because it's so simple.
00:12:25
◼
►
Oh, look, here's the list of snapshots.
00:12:27
◼
►
It can get out of hand, and I wouldn't use that as my version
00:12:29
◼
►
control system, because it's all flat and just ends up
00:12:33
◼
►
in one long list.
00:12:33
◼
►
But just as a thought experiment thing, I like doing that.
00:12:37
◼
►
Because it's simple to do.
00:12:38
◼
►
It's so much simpler than Git, push, commit, blah, blah, blah,
00:12:41
◼
►
whatever, dance.
00:12:42
◼
►
I think at Git, I've been using it for so long
00:12:45
◼
►
that I think it's just grown on me.
00:12:47
◼
►
I have the Stockholm syndrome of it now.
00:12:49
◼
►
the problem. It always feels a little heavy-handed for a lot of what it does. And I don't use
00:12:57
◼
►
Git, I think, in a way that I read all these, like, you know, whatever, Pro Git or whatever,
00:13:03
◼
►
Git flow, all these like methodologies and things where you have like 27 branches for
00:13:07
◼
►
all like anytime you start a new concept, you create a branch for it and all this. And
00:13:12
◼
►
for me, I've always found that to be so it's like I'm spending all this time and work building
00:13:17
◼
►
something that doesn't actually work.
00:13:20
◼
►
It's like I'm just playing around outside of my actual job and what I'm trying to do.
00:13:26
◼
►
So the only closest thing to that that I ever do with Git is, one thing I love is that you
00:13:31
◼
►
can branch after you've made a bunch of changes rather than having to do it ahead of time.
00:13:37
◼
►
That whole concept blows my mind where I'm like, "I think I'm going to do something experimental,
00:13:42
◼
►
so I'm going to make a branch."
00:13:43
◼
►
That's never how my mind works.
00:13:45
◼
►
I think about the problem I'm working on.
00:13:50
◼
►
I'm just working on the problem.
00:13:52
◼
►
I'm not really cognizant that halfway through that, I went in this crazy experimental direction
00:13:57
◼
►
more often than not.
00:13:58
◼
►
So what I love is that you can be developing on whatever branch you're on and then you
00:14:04
◼
►
can take your working copy and just say, "Okay, maybe I shouldn't have done it this way."
00:14:13
◼
►
You can just take that, put it off in a branch, and then just go back to where you were before,
00:14:19
◼
►
which is something that I've only seen in some subversion or something.
00:14:25
◼
►
It's much more difficult, in my experience, was to play with those kind of things, like
00:14:29
◼
►
to take your working copy and stash it off somewhere.
00:14:33
◼
►
Do you find yourself going back to those branches?
00:14:36
◼
►
I find that what I typically end up doing is I'm going back to them to grab a method
00:14:41
◼
►
or to grab a little snippet of code rather than necessarily--
00:14:46
◼
►
and I think it's like what you were talking about before,
00:14:48
◼
►
where it's often you'll end up--
00:14:51
◼
►
in order to arrive at the good solution,
00:14:53
◼
►
you end up having to drive through all these crazy twists
00:14:57
◼
►
And often you'll have these tiny little nuggets in between
00:15:01
◼
►
that I actually want to keep, but I
00:15:03
◼
►
want to get rid of the bulk of that
00:15:05
◼
►
and just put those back into a good framework.
00:15:07
◼
►
And so that's what I'll end up doing.
00:15:09
◼
►
Yeah, maybe I need to read ProGet or something.
00:15:13
◼
►
Because I don't--
00:15:15
◼
►
I've never found those-- I mean, I have--
00:15:18
◼
►
on almost all of my projects, I just have master.
00:15:20
◼
►
And then I have these little stashes of code
00:15:24
◼
►
branching off the sides, just to--
00:15:28
◼
►
rather than having this broader process.
00:15:31
◼
►
And I've never found-- and a lot of that, too, I think,
00:15:33
◼
►
is because it's just-- you have to have a different flow when
00:15:38
◼
►
you're working with a team of people, like five or six people.
00:15:40
◼
►
And so, I mean, I think we're both fairly similar in the sense that we're not doing
00:15:45
◼
►
these big corporate projects where it's like you and a team of ten people and you have
00:15:49
◼
►
to have a whole process.
00:15:51
◼
►
And you even have like, often you'll have like the guy on the team, the poor guy on
00:15:55
◼
►
the team whose job it is to manage the version control system.
00:15:59
◼
►
The guy who's doing the merges and builds.
00:16:01
◼
►
I mean, that's not a good job.
00:16:03
◼
►
Pain, yeah, pain.
00:16:05
◼
►
I guess some people are built that way, but it's not me.
00:16:10
◼
►
So that's-- and then in terms of--
00:16:12
◼
►
do you find you use different tools when you're doing--
00:16:16
◼
►
so like, if you're going to be working on code for one
00:16:20
◼
►
of your training things and your book,
00:16:22
◼
►
and you're doing all the source code,
00:16:24
◼
►
do you build that in a different way
00:16:26
◼
►
or using different things than you would if you're actually
00:16:29
◼
►
writing production code?
00:16:32
◼
►
So what happens with that a lot is when you're teaching somebody something a lot
00:16:37
◼
►
of times what you have to do is put aside the complexity that you know needs to be there
00:16:43
◼
►
in order to make it good code in order to illustrate the point
00:16:46
◼
►
that you're trying to get across.
00:16:47
◼
►
So if you're trying to teach someone about, I don't know, NS arrays or whatever,
00:16:53
◼
►
you might do something in where you're trying to get someone to understand what an NS array is,
00:16:58
◼
►
especially if they're new to programming.
00:16:59
◼
►
And, you know, there'd be different things.
00:17:01
◼
►
if it's someone new to programming versus someone who's an experienced programmer but
00:17:04
◼
►
is just trying to learn iOS.
00:17:06
◼
►
But if you're trying to teach someone NS array, for example, and they don't know anything,
00:17:11
◼
►
you might approach NS array in a completely different way than you would already knowing
00:17:15
◼
►
how to do iOS programming and you're sort of in the culture of iOS.
00:17:20
◼
►
You want to bring people in slowly from a conceptual space of "I don't know anything
00:17:25
◼
►
about programming and I've never broken down a problem into small pieces like that" to
00:17:29
◼
►
get them to understand what an array is and how it holds a list of things and they're
00:17:33
◼
►
ordered and whatever, where you would never do that if someone was an experienced programmer
00:17:38
◼
►
and they're coming from Java or wherever, and they already know what a list is in Java.
00:17:43
◼
►
You just need to help them translate from list to Java.
00:17:45
◼
►
So I find I build more than probably the average iOS developer.
00:17:51
◼
►
I'm hitting Command-Shift-N in Xcode just all the time, because in class we build, I
00:17:57
◼
►
know, 15 different projects from scratch that we then end up at the end combining the ends
00:18:02
◼
►
of those three or four different trails into one big app where we take that stuff and reuse
00:18:07
◼
►
it and whatever.
00:18:09
◼
►
And so, you know, every time I teach a class I create 15 or 20 projects at home.
00:18:14
◼
►
Every time I'm writing a new one-hour presentation for CocoConf or if I'm, you know, I'm doing
00:18:19
◼
►
a full day talk at SwipeConf in Australia in a couple, like a month, talking about core
00:18:27
◼
►
graphics. That's another place. You know, I create a brand new project from scratch
00:18:31
◼
►
and I do stuff in those new projects that, as a new developer, how many times, I mean,
00:18:36
◼
►
as an experienced developer, you create one project and then you work on it for years,
00:18:42
◼
►
right? And so I do a lot of that stuff that's probably out of the norm for someone. But
00:18:48
◼
►
On my iMac, I'm always running Terminal and Xcode and TextMate, OmniGraffle most of the
00:18:56
◼
►
time, not always, but most of the time.
00:19:00
◼
►
And those are probably, those are the three big things, Xcode and Terminal.
00:19:03
◼
►
And yeah, I'm always doing stuff in Terminal.
00:19:07
◼
►
I tend to be, I don't know if it makes me a neckbeard or not, but I tend to trust the
00:19:11
◼
►
command line for subversion or get a lot more than I trust Xcode.
00:19:17
◼
►
And I don't know if that's just me being curmudgeonly or whatever, but I tend to do all that stuff
00:19:22
◼
►
through the command line instead of through the Xcode tools.
00:19:25
◼
►
Well, I never use the Xcode tools for version control.
00:19:28
◼
►
I've been bitten by them a few too many times.
00:19:31
◼
►
>> But what I find for Git especially is Git Tower.
00:19:33
◼
►
There's an app called Tower for your...
00:19:35
◼
►
I think it's just called Tower actually, but it's just a Git client.
00:19:38
◼
►
Because I find what it does...
00:19:40
◼
►
The one thing that I like that it does...
00:19:41
◼
►
Because Git has that weird two-phase commit to stage and then actually commit.
00:19:46
◼
►
It makes that process much more obvious, especially coming from a subversion background.
00:19:52
◼
►
Well, I'll have to get that then.
00:19:53
◼
►
Because I'm so used to, yeah, in a subversion background, we're just like, you just like
00:19:59
◼
►
And you're done.
00:20:00
◼
►
If you've added new stuff, it adds it.
00:20:02
◼
►
And if you, you know, it reverses having to do this sort of selective, which can be great,
00:20:09
◼
►
It introduces a huge level of complexity that, you know, with subversion, I was used to pleasantly
00:20:14
◼
►
ignoring that complexity.
00:20:18
◼
►
So switching gears slightly, one of the things that I definitely wanted to talk to you about
00:20:21
◼
►
is so you obviously do a lot of training and teaching for adults, for people who are coming
00:20:29
◼
►
to your classes or going to conferences or those kinds of things.
00:20:33
◼
►
But I know also that your son's a developer and those kinds of things.
00:20:38
◼
►
And one thing I've always wondered about, I have a son, he's three right now, so it's
00:20:43
◼
►
It's a little early, probably, but I've always been thinking about how do you teach programming
00:20:49
◼
►
I was curious how you've done that in terms of, as an educator, it's one of these things
00:20:55
◼
►
like in my mind I have this dream of my students changing from my company to Smith & Son.
00:21:04
◼
►
How do you actually start it?
00:21:08
◼
►
So my oldest is definitely...he's got that personality where he wants to take everything
00:21:14
◼
►
apart and he wants to learn everything.
00:21:18
◼
►
Yeah, I mean, it's phenomenally fun to work with him, too.
00:21:22
◼
►
I've done two projects.
00:21:24
◼
►
One project is completed, it's in the store and has lots of positive reviews and stuff,
00:21:28
◼
►
so it's really cool.
00:21:29
◼
►
And then another one we're working on right now together, and it is insanely fun working
00:21:34
◼
►
If you can make it and sons, it's awesome.
00:21:37
◼
►
Or and daughters or whatever.
00:21:38
◼
►
It's so much fun.
00:21:40
◼
►
But it's definitely a personality thing, I think.
00:21:45
◼
►
'Cause we have a lot of kids and other kids,
00:21:49
◼
►
he's now 15, I forced him, and he would say I forced him,
00:21:55
◼
►
to go through the book called "Learn to Program"
00:21:59
◼
►
from Chris Pine, published by Pragmatic.
00:22:01
◼
►
Phenomenal book.
00:22:02
◼
►
It's focused on Ruby, so if you are definitely focused on iPhone, it might not be the right
00:22:06
◼
►
book if you want to learn how to program for iPhone.
00:22:09
◼
►
But if you want to learn how to program, it's a fantastic book.
00:22:13
◼
►
So he finished it.
00:22:14
◼
►
This is like he was 10 or 11 years old, so it was three, four, five years ago.
00:22:18
◼
►
When he finished it, I looked at his work and he did all the right stuff.
00:22:21
◼
►
He'd get all the programming done and he handed me the book and he said, "I never want to
00:22:25
◼
►
do this again."
00:22:27
◼
►
So you know, I mean, it's just a personality thing where my older son just ate it up and
00:22:31
◼
►
and he loved that kind of stuff.
00:22:33
◼
►
He was reading Stephen Cochan's Objective-C book
00:22:36
◼
►
when he was 11 and doing all sorts of crazy stuff.
00:22:39
◼
►
But to start with, the place he started was Lego Mindstorms.
00:22:43
◼
►
And I can't say enough good about Lego Mindstorms.
00:22:45
◼
►
They are so awesome, especially if your child is into Lego.
00:22:50
◼
►
Just so many cool things you can do on the mechanical side
00:22:53
◼
►
from building the robots.
00:22:55
◼
►
And then you can also go and program them using,
00:22:58
◼
►
they have a visual programming environment,
00:22:59
◼
►
which is a great place to start.
00:23:01
◼
►
teaches you loops and branches and stuff like that.
00:23:04
◼
►
Drive forward for five feet, stop for five seconds,
00:23:06
◼
►
drive forward for five more feet,
00:23:08
◼
►
put on a sensor, a touch sensor, and if you
00:23:10
◼
►
feel a push on the touch sensor, then turn around,
00:23:13
◼
►
things like that.
00:23:14
◼
►
When you say visual programming, so that's sort of like you're
00:23:16
◼
►
dragging in components and wiring them up physically,
00:23:20
◼
►
rather than doing it in code.
00:23:23
◼
►
And it looks like LEGOs, which is kind of cool.
00:23:25
◼
►
So you drag out a block that says,
00:23:27
◼
►
if the touch sensor is hit and then it has a branch on it,
00:23:32
◼
►
and that branch then says turn the motor
00:23:34
◼
►
to reverse for five seconds.
00:23:36
◼
►
That kind of stuff.
00:23:37
◼
►
And so you drag these blocks out,
00:23:38
◼
►
you connect them by drawing lines
00:23:40
◼
►
similar to the way you do an interface builder.
00:23:42
◼
►
And so they have places where inputs come in
00:23:44
◼
►
and places where outputs go out.
00:23:46
◼
►
And so with that then, the person
00:23:49
◼
►
can understand the basics of programming, branching,
00:23:53
◼
►
and looping.
00:23:54
◼
►
And to a certain extent, variables,
00:23:56
◼
►
although it's not very focused on that necessarily.
00:24:00
◼
►
It would be like a sensor, and then that sensor has an output.
00:24:03
◼
►
And so it's kind of a variable, but you don't really
00:24:05
◼
►
get the feel for it.
00:24:07
◼
►
But from there, you can go-- staying on LEGO Mindstorms,
00:24:10
◼
►
building your robots, you can use something called Not Quite
00:24:13
◼
►
C, which is most of C, but it doesn't have a preprocessor
00:24:17
◼
►
and a couple of other things to simplify the compiler.
00:24:20
◼
►
And it will-- I think it uses GCC behind the scenes.
00:24:22
◼
►
It compiles down to assembly language for the processor
00:24:26
◼
►
that's on the Lego Mindstorms.
00:24:28
◼
►
And it also has an environment that'll push it over the USB or IR port
00:24:32
◼
►
to the device and then you can run your programs that you wrote in C.
00:24:36
◼
►
So that was part of the progression that my oldest took, is he first did
00:24:40
◼
►
Lego Mindstorms with the visual programming,
00:24:42
◼
►
then we got not quite C on it, and then at the time I was really into Java in
00:24:46
◼
►
2003 or something, and so we got
00:24:48
◼
►
there was a Legos Java VM that ran on it, and we went down the path of
00:24:53
◼
►
trying to make that work but the tools on the Mac were not very good and so we
00:24:56
◼
►
ended up abandoning that but I think on the PC side that that works so you could
00:25:00
◼
►
through a VM you know with Parallels or whatever be able to do that and then he
00:25:06
◼
►
spent a little bit of time with squeak and scratch which are both small talk
00:25:09
◼
►
based environments from the MIT Media Lab both of those are really cool and
00:25:14
◼
►
then from there he just one day he said I want to write games and he started
00:25:19
◼
►
studying OpenGL and then that led him to linear algebra and so.
00:25:23
◼
►
I mean, he's got that personality where he'll just rip apart everything and he wants to
00:25:27
◼
►
understand stuff.
00:25:28
◼
►
We were talking the other day and he said, "You know, I really wish I had a time machine
00:25:33
◼
►
so I could go back in time and have enough time to learn everything."
00:25:38
◼
►
So it's definitely a personality thing.
00:25:43
◼
►
And I also did...
00:25:45
◼
►
So we homeschooled, so we're part of a homeschool community in Breckenridge, and we did a class,
00:25:49
◼
►
lot of people are asking how did you get Andrew into programming and stuff, friends and stuff.
00:25:53
◼
►
And so we did a class with like, I think we started off with nine kids and we ended with
00:25:59
◼
►
six. Three of them had to drop out for various reasons. But we spent an entire year, once
00:26:05
◼
►
a week for two hours we spent doing programming. And that was just complete basics. This is
00:26:12
◼
►
an array, this is an if statement, this is a for loop, and that kind of stuff. And yeah,
00:26:19
◼
►
What that taught me was that every kid is different and some kids are wired to do programming
00:26:27
◼
►
and some kids aren't.
00:26:28
◼
►
Not to say that they can't learn it, it's just some kids' personality style is they
00:26:32
◼
►
like to take things apart and figure out how they work and then see if they can put them
00:26:36
◼
►
back together.
00:26:38
◼
►
And some kids don't.
00:26:39
◼
►
I mean, you know this in adults too, right?
00:26:40
◼
►
You talk to some people and they're like, "Oh, awesome.
00:26:43
◼
►
I put gas in my car and I stick the key in the ignition and it runs."
00:26:47
◼
►
And other people are like, they're ripping apart their motor to find out how pistons
00:26:50
◼
►
work or whatever.
00:26:51
◼
►
So, you know, kids are the same way.
00:26:53
◼
►
So it is interesting.
00:26:56
◼
►
And it's difficult to push.
00:27:00
◼
►
You can pull, but it's really difficult to push.
00:27:03
◼
►
And so it's a fun adventure, though.
00:27:06
◼
►
It's really cool watching, especially when you get the kids whose, the light bulb goes
00:27:09
◼
►
on, they're, you know, hacking at two o'clock in the morning, sending emails.
00:27:13
◼
►
"Hey, I tried to get this core animation thing to work and I couldn't and this is my code."
00:27:18
◼
►
And I was thinking back to when, as you're talking, it's like I was trying to think how
00:27:23
◼
►
I got into it.
00:27:24
◼
►
And I think my first, the closest, the first time I ever did anything that would be considered
00:27:28
◼
►
programming was I think Logo?
00:27:30
◼
►
Is that what it was called?
00:27:32
◼
►
The Little Turtle?
00:27:33
◼
►
I think it was on a Sinclair Spectrum.
00:27:36
◼
►
Which was, I mean, I have no idea when that was, I have no idea what age that was, but
00:27:41
◼
►
I just remember making the turtle go around.
00:27:45
◼
►
- Yeah, that's awesome.
00:27:46
◼
►
- And then it was basic on the old Windows that shipped,
00:27:50
◼
►
I think it shipped with the old Windows 3?
00:27:53
◼
►
- Yeah, way back in the day.
00:27:55
◼
►
- It was QBasic or something like that?
00:27:57
◼
►
- Something like one of the basic derivatives.
00:27:58
◼
►
- And I just remember that was,
00:28:00
◼
►
and from as early as I can remember almost,
00:28:04
◼
►
it's like you have that aptitude for it,
00:28:07
◼
►
and it just stuck.
00:28:10
◼
►
And it's like now that's how I make my living.
00:28:12
◼
►
That's kind of a crazy thing to think about.
00:28:13
◼
►
It started off with making turtles go around a screen to--
00:28:17
◼
►
Isn't that crazy how that stuff unfolds?
00:28:19
◼
►
My first was a Commodore 64.
00:28:21
◼
►
And I wrote this awesome-- remember--
00:28:25
◼
►
it wasn't Minecraft.
00:28:26
◼
►
No, it was Missile Command, where you had the things
00:28:29
◼
►
and you could choose which base.
00:28:31
◼
►
Kind of style.
00:28:32
◼
►
There's incoming nukes and you would shoot missiles
00:28:34
◼
►
from the ground.
00:28:36
◼
►
And I think it was called Missile Command.
00:28:38
◼
►
Anyway, so I had one that a balloon floated across the sky and you had to shoot the balloon.
00:28:42
◼
►
I had a single missile base at the base.
00:28:44
◼
►
And so I spent hours and hours and hours, till two or three in the morning, writing
00:28:48
◼
►
this program and I had it on a cassette, right?
00:28:51
◼
►
Because that was off the Commodore way back in the dark ages when there was barely electricity.
00:28:55
◼
►
Well, this tape got eaten by the tape machine.
00:28:59
◼
►
I was so mad, I put the whole thing back in the box and shoved it into my closet and I
00:29:04
◼
►
didn't program again until I was in college.
00:29:06
◼
►
That was a crazy thought, but I remember the same thing, that Sinclair Spectrum.
00:29:11
◼
►
I remember when I played games on it all the time, you put it into your tape deck and hit
00:29:17
◼
►
play and you wait while it loads the program onto the computer from your cassette player.
00:29:22
◼
►
Isn't that crazy?
00:29:24
◼
►
At least it wasn't punch cards, right?
00:29:25
◼
►
You can read stories about people with punch cards.
00:29:28
◼
►
At least it was relatively convenient to make copies.
00:29:33
◼
►
You could just put it into--
00:29:36
◼
►
Tape to tape.
00:29:37
◼
►
And you tape to tape, high-fi, and off you go.
00:29:41
◼
►
Yeah, those were the glory days, right?
00:29:42
◼
►
Now it's kids these days.
00:29:45
◼
►
Kids these days, I tell you.
00:29:48
◼
►
So shifting gears again slightly.
00:29:51
◼
►
One thing I was always curious about for someone
00:29:53
◼
►
who's been working on-- who's been doing this for a while,
00:29:56
◼
►
and especially from the progression from back
00:29:58
◼
►
in the Mac days and Xcode as it's progressed
00:30:00
◼
►
in all the different ways.
00:30:01
◼
►
it's like how many how's your debugging process like and how do you go about
00:30:07
◼
►
when you're when you hear when you hear bug how do you go about trying to nail
00:30:12
◼
►
it down and find it and what's your mindset and your approach for that so
00:30:16
◼
►
the first thing I do is is think through the problem and and what I try to do the
00:30:23
◼
►
end this is something I tell all my students is apply the scientific method
00:30:27
◼
►
And that sounds sort of glib or whatever, but so many people don't.
00:30:31
◼
►
They just sort of start randomly sticking log statements in their code and break points
00:30:36
◼
►
and clicking around until they find something that they think is the problem and they apply
00:30:41
◼
►
a change that they copy from Stack Overflow or who knows where, and they click the Go
00:30:45
◼
►
button and the bug is gone in the path that they expected.
00:30:50
◼
►
And what I find happens, and I'm guilty of doing that too, right?
00:30:53
◼
►
It'd be the same thing when I'm in a hurry.
00:30:56
◼
►
What I find when I do that is I've masked the bug.
00:30:59
◼
►
I haven't actually found and fixed the bug, I just changed its behavior and so now the
00:31:02
◼
►
bug is still there but I don't see it because the path I've been following is fixed.
00:31:06
◼
►
And so I first try to think through, okay, what's the real problem?
00:31:11
◼
►
And then I start putting things into the code to force that, you know, to test that hypothesis.
00:31:16
◼
►
It's either true or it's false.
00:31:18
◼
►
And if it's not true, then I have to rethink.
00:31:22
◼
►
Or if it's partially true.
00:31:24
◼
►
So for example, if you expect the box to be pixel-aligned that you're drawing with core
00:31:29
◼
►
graphics on the screen, and for some reason it's showing up fuzzy, well then you can go
00:31:33
◼
►
through and say, "Oh, well duh, the obvious problem is I'm not rounding my rectangle to
00:31:37
◼
►
integer or half integer boundaries or whatever," right?
00:31:40
◼
►
So then I go through and I look and see, "Well, I'm actually doing that.
00:31:44
◼
►
Okay, well now what's going wrong?"
00:31:47
◼
►
So then I would form the next version of the hypothesis to say, "Okay, well, I must be
00:31:52
◼
►
changing that rectangle somewhere else, right? So then I might put a watch point with LLDB,
00:31:58
◼
►
put a watch on that variable, or whatever like that to sort of track down what's really
00:32:03
◼
►
the problem. And then I try to go as far as I can to prove to myself that that really
00:32:07
◼
►
is the issue before I apply a change. Then I apply the change and test to make sure that
00:32:13
◼
►
it really did, leaving all that logging or debug statements or whatever that I put in
00:32:18
◼
►
with the debugger and so forth, leaving all that stuff in place until, okay, so the behavior
00:32:24
◼
►
stopped manifesting itself, but did I actually fix the real problem or did I just mask it?
00:32:29
◼
►
So I try to put enough instrumentation in my code, meaning things like log statements
00:32:34
◼
►
or breakpoints that I turn to continue and put log statements inside the breakpoint,
00:32:39
◼
►
put enough of that stuff in so that when I think I've fixed it and I run, I can see the
00:32:46
◼
►
Another thing that I found really helpful is if I'm doing something like a networking
00:32:51
◼
►
code or something that is happening in the background and it's happening repeatedly,
00:32:55
◼
►
you're downloading 100K of JSON or whatever, and if you put a breakpoint for every 4K that
00:33:01
◼
►
comes down, you have to continue, continue.
00:33:04
◼
►
It gets so tedious that I just don't do that.
00:33:06
◼
►
So what I do is put in log statements and wrap that in a hash if def debug or something
00:33:12
◼
►
like that so that it would only happen when I have the debug thing on. And then I leave
00:33:16
◼
►
that code in there forever because I find a lot of times I am being an idiot with writing
00:33:21
◼
►
networking code and it just sucks in a whole number of ways. And so I put that instrumentation
00:33:27
◼
►
in there, flip on the switch that turns on the logging, and I watch that logging that
00:33:31
◼
►
comes out to determine if I'm really, if I'm getting it right or if I'm doing something
00:33:36
◼
►
wrong. And I'll put statements like, "Is this thread the foreground thread?" And if it
00:33:42
◼
►
is, and I print out an error message saying, "Hey, idiot, you're running your networking
00:33:45
◼
►
code on the foreground thread. You're going to host somebody." And then I always run that
00:33:51
◼
►
with that test flag turned on to print out those logging statements before I declare
00:33:56
◼
►
a branch or a whatever or ship it or make it beta or whatever, just so that I get some
00:34:00
◼
►
sanity check that all that stuff that I put in is doing the right thing.
00:34:06
◼
►
are like things where I'm observing bad behavior. Another thing that I try to do every time
00:34:12
◼
►
before I ship something is run instruments against the code and not just like leaks because
00:34:19
◼
►
a lot of people that I run into run leaks, but I run leaks, the allocation instrument,
00:34:24
◼
►
I run time profiler, I run the core animation instrument and check my frames per second
00:34:28
◼
►
on all my animations and stuff. And I try to do that again before I ship anything off
00:34:32
◼
►
to beta or any other release that anybody else is going to see. And I use the allocations
00:34:39
◼
►
instrument to look at not just am I growing constantly in memory, but how many I expect
00:34:46
◼
►
that I'm parsing JSON so I have a thousand strings because there's a thousand strings
00:34:50
◼
►
coming out of this JSON file. Do I have 12,000 that are transient? Huh. And I scratch my
00:34:56
◼
►
head and start looking at why is that going on. And what I often find is when I do that
00:35:02
◼
►
stuff, I find problems in my code that would have never come up unless I had done that.
00:35:09
◼
►
Because it's not technically a bug. All I'm doing is taking electrons from the battery
00:35:13
◼
►
and increasing entropy in the world, right? Which is a bad thing. And so those are sort
00:35:20
◼
►
of the big things. I put breakpoints and I tell the breakpoint to log and autocontinue.
00:35:26
◼
►
I put breakpoints in and then examine the program at a particular spot in the breakpoint.
00:35:31
◼
►
And then I put logging statements in that are wrapped in some sort of flag that says,
00:35:34
◼
►
do this log or don't do this log, and then use instruments a lot.
00:35:38
◼
►
Interesting with instruments, it kind of makes me think of it's like it's the difference
00:35:41
◼
►
between a program working and it working well.
00:35:45
◼
►
Because it's often, at least I find it's relatively easy to make something work.
00:35:50
◼
►
You can get it, it's like you can get the intended result to happen.
00:35:55
◼
►
But the challenge is usually, it's like the difference between the, like a college professor
00:36:00
◼
►
who always said there's always a naive implementation,
00:36:03
◼
►
and then there's the right implementation.
00:36:06
◼
►
And almost always, it's like you can make something happen.
00:36:10
◼
►
Like you say, and it will work fine.
00:36:12
◼
►
And I often find this especially,
00:36:14
◼
►
but it's the difference between when
00:36:16
◼
►
you're developing the simulator.
00:36:17
◼
►
And essentially, you have infinite speed
00:36:20
◼
►
and infinite memory.
00:36:21
◼
►
And everything's-- your connection's always wonderful.
00:36:26
◼
►
And it works in those circumstances.
00:36:29
◼
►
And then you'll run it on-- you're doing your compatibility
00:36:32
◼
►
You'll put it on an old third gen iPod touch.
00:36:35
◼
►
And you're just like, oh my goodness, what is going on?
00:36:37
◼
►
This is not my code.
00:36:38
◼
►
Who wrote this horrible stuff?
00:36:41
◼
►
This is not going to work.
00:36:43
◼
►
But instruments is a great way to find those kinds of things
00:36:47
◼
►
that it's working.
00:36:48
◼
►
But animations is another one.
00:36:50
◼
►
Where it's like, it's working, but it's at 30 frames a second
00:36:54
◼
►
or whatever.
00:36:54
◼
►
And so you're doing something, or you're
00:36:57
◼
►
being non-optimal in your implementation.
00:36:59
◼
►
- Yeah, and I love that, especially when you flip on,
00:37:02
◼
►
I'm just that kind of person who is,
00:37:05
◼
►
I don't know, it irritates me if I expected a thousand
00:37:10
◼
►
strings to be allocated in pitched, and there's 12,000.
00:37:13
◼
►
Like, what is, like, that's just wrong.
00:37:16
◼
►
Something's messed up there.
00:37:17
◼
►
And it's the same thing of like,
00:37:19
◼
►
looking at the VM tracker.
00:37:21
◼
►
Okay, when my app is running and it's in a steady state,
00:37:24
◼
►
I don't want to have more than 12 meg or 14 meg
00:37:27
◼
►
of dirty memory. I just set that as a goal for myself on any app that I ship because
00:37:33
◼
►
it's one screen full of information, which is probably about 3.5 meg on an old iPhone
00:37:40
◼
►
on a new one. It's probably whatever that is, 10 meg, something like that. And then
00:37:43
◼
►
a couple of meg for data. And that's it, right? Because the data that displays that stuff
00:37:48
◼
►
on screen should only be a small amount. So, you know, especially if you're using Core
00:37:54
◼
►
data or whatever to fetch your data, you have no excuse to fetch all the customers in China.
00:37:59
◼
►
And hopefully that's a billion people who bought your product.
00:38:01
◼
►
But you should never fetch all that into memory at once.
00:38:05
◼
►
And so I love looking at that and sort of digging into those problems.
00:38:08
◼
►
And probably would have made a good tester or one of those QA people who breaks everything.
00:38:14
◼
►
But I like digging into that and finding stuff.
00:38:16
◼
►
It's really fun.
00:38:18
◼
►
One of the things I used to do at Apple that I really loved was helping people who would
00:38:22
◼
►
come in with their apps and say, you know, whatever, this app looks really cool but it
00:38:26
◼
►
doesn't perform very well. And you look them in the eye and say, have you run instruments?
00:38:32
◼
►
And you can tell, because some people hesitantly say, yeah. That's the person who ran leaks
00:38:38
◼
►
like two weeks after they started the project and not again. Most people say, what's instruments?
00:38:45
◼
►
And so you sit down with them and you start showing them in their code. You've never looked
00:38:48
◼
►
at their code before, right?
00:38:49
◼
►
I don't even have access to their code.
00:38:51
◼
►
And I look and say, oh, yeah, see here you're doing
00:38:53
◼
►
networking on the main thread.
00:38:55
◼
►
Oh, and see over here, you're allocating 4 million strings
00:38:57
◼
►
and throwing away 4 million strings.
00:38:58
◼
►
What are you even doing?
00:38:59
◼
►
Like, were you dropped off a turnip truck?
00:39:01
◼
►
What are you talking about?
00:39:03
◼
►
I was never rude to people.
00:39:04
◼
►
But it's really fun to go look at that stuff.
00:39:08
◼
►
And oh, look, this animation's running at 15 FPS.
00:39:11
◼
►
And everything is transparent.
00:39:12
◼
►
See all this red?
00:39:13
◼
►
This really shouldn't be here.
00:39:15
◼
►
So it's fun.
00:39:17
◼
►
I definitely noticed that every time I've gone to a lab at WWDC, almost always the first--
00:39:22
◼
►
and it doesn't even matter necessarily what the problem is I'm having.
00:39:26
◼
►
I've never really ever had a debugging or a work session with one of the people at WWDC
00:39:32
◼
►
lab that didn't involve launching instruments for something.
00:39:36
◼
►
And it's one of those things, though, for the first-- probably the first year or two
00:39:40
◼
►
of being an iOS developer, I never ran it, ever.
00:39:45
◼
►
just never, other than like you say,
00:39:47
◼
►
every now and then running, it's like if I have a leak
00:39:48
◼
►
that I'm trying to track down, it's like,
00:39:50
◼
►
oh, I'll run the leaks tool, that's what it does.
00:39:52
◼
►
But it is, it's this, and it's, for me,
00:39:55
◼
►
it's always one of my highlights of the actual sessions
00:39:58
◼
►
at WWDC are like the what's new in the developer tools
00:40:02
◼
►
instrument stuff, because it's one of these things,
00:40:05
◼
►
like the first time you ever see them,
00:40:07
◼
►
all the little, like the magic check boxes,
00:40:09
◼
►
is the thing that always like blows your mind,
00:40:11
◼
►
where you hit the box and all of a sudden,
00:40:12
◼
►
everything turns green, that's wrong.
00:40:14
◼
►
for whatever definition of wrong is.
00:40:18
◼
►
I have to do off-screen drawing, so it turns this color.
00:40:21
◼
►
It's transparent, so it's doing this.
00:40:23
◼
►
And it's just this amazing thing where
00:40:25
◼
►
it's able to show you the problem in a way that almost
00:40:29
◼
►
doesn't seem possible.
00:40:31
◼
►
That somehow, it's like, how does it know
00:40:33
◼
►
that's where the problem is?
00:40:34
◼
►
And it's like, well, that's--
00:40:35
◼
►
It's awesome, isn't it?
00:40:36
◼
►
It's like they wrote the frameworks on the one end
00:40:37
◼
►
and the tools that debug the frameworks.
00:40:40
◼
►
It's so cool.
00:40:40
◼
►
And the power of DTrace, too, right?
00:40:42
◼
►
I mean, it's like the incremental cost of having that in there and turned off is nil,
00:40:48
◼
►
It's almost nothing.
00:40:49
◼
►
And so you can just spread that stuff everywhere and then flip it on like a switch.
00:40:54
◼
►
You could even – I haven't actually done this in any production app, but you could
00:40:57
◼
►
build your own D-Trace stuff and stick it in your app and then you could run it against
00:41:01
◼
►
instruments and see if your app is doing what you expect.
00:41:04
◼
►
Yeah, I just love instruments.
00:41:06
◼
►
It's like a – I tell my students in class, it's like a code spelunking tool.
00:41:12
◼
►
Like, you see the surface of the mountain and it's very pretty, but when you go spelunking
00:41:17
◼
►
into that mountain, you see the guts, you see what's inside of it, and that's what you
00:41:21
◼
►
get out of instruments is you get to see what's really happening.
00:41:25
◼
►
And we often, within so many different things that we do in life, we have a plan and we
00:41:31
◼
►
start executing it and so many things distract us from the one path that we have laid out.
00:41:36
◼
►
That's what happens with code is you start with this plan, this beautiful abstract design
00:41:40
◼
►
that's perfect in your mind, and then real implementation gets in the way, right?
00:41:45
◼
►
And you end up with all this messy junk.
00:41:47
◼
►
If you don't go back and look at it with instruments, you know, I mean, do you remember what you
00:41:52
◼
►
wrote six weeks ago?
00:41:53
◼
►
I don't even, right?
00:41:54
◼
►
It was yesterday.
00:41:55
◼
►
I forget the stuff that I wrote yesterday.
00:41:57
◼
►
So I just love instruments as a tool to be able to help you figure that stuff out and
00:42:01
◼
►
see what's really going on.
00:42:04
◼
►
The OpenGL ES tool, I don't know if you got a chance to look at that or if you play much
00:42:07
◼
►
with OpenGL.
00:42:08
◼
►
And I'm by no means an expert.
00:42:10
◼
►
My son is big time into that stuff, but I love the OpenGL expert and the other OpenGLES
00:42:17
◼
►
You can tap one button and it captures the entire frame, all the buffers that you're
00:42:20
◼
►
drawing data into and shows you them graphically.
00:42:24
◼
►
All the textures that are bound, how they're bound, flip a switch and it will start running
00:42:30
◼
►
your code through an analyzer that basically turns off the fragment stage.
00:42:36
◼
►
Does the performance change?
00:42:37
◼
►
Okay, well then your fragment stage is probably fine.
00:42:39
◼
►
turns off the vertex stage, oh look at that, the performance went up to 60 FPS, I bet your
00:42:44
◼
►
vertex shaders are hosed.
00:42:46
◼
►
And so then it points that out to you without you having to go through and tweak all that
00:42:50
◼
►
stuff yourself.
00:42:51
◼
►
It's just amazing, it just blows me away how cool it is.
00:42:54
◼
►
Yeah, I've only ever seen the OpenGL stuff in like the WDC sessions.
00:42:57
◼
►
It's one of those things that I've done, I've written almost every kind of game, or almost
00:43:03
◼
►
every type of app you could imagine, and used almost every framework, except things with
00:43:08
◼
►
with OpenGL and games. The one area that, like when I'm talking to a client or whatever
00:43:13
◼
►
kind of experience it is, I can do anything except for games. Anything 3D. I'm an entirely
00:43:21
◼
►
Yeah, it's one of those things I would sorely love to do something. I don't even care if
00:43:27
◼
►
it's a game. I just want to do some OpenGL stuff. I love it. I play with it. Every time
00:43:31
◼
►
I have free time between books or classes or whatever, I end up spending time doing
00:43:35
◼
►
Open GL stuff, it's really, really cool.
00:43:40
◼
►
And I guess the last thing that I kind of wanted to talk about is just in terms of like
00:43:46
◼
►
lessons you've learned or perhaps even better coming from your position as an educator,
00:43:51
◼
►
what are kind of some of these common mistakes or problems that you see people doing over
00:43:56
◼
►
and over again that would be good things to make sure you never, ever do?
00:44:02
◼
►
Some stuff that I see brand new people to the platform do and and it happens across the board and I don't know that
00:44:11
◼
►
There's a few people here and there who don't fall into the trap, but most people do and that's really
00:44:17
◼
►
Thinking about what you're doing before you go to do it. We're so trained with Google now that or whatever search engines
00:44:28
◼
►
Change the background color of a text field
00:44:31
◼
►
What's the first thing people do they don't go read the docs or engage their mind they search on Google find something on Stack Overflow
00:44:38
◼
►
And copy and paste it sure I'm as guilty as the next person of doing that
00:44:42
◼
►
But I see people do that and that's their development approach and they never get to the point where they actually understand
00:44:49
◼
►
What the background property is on a view and they don't understand why it might be better to use background property than to use draw rect
00:44:56
◼
►
They never like
00:44:58
◼
►
process that stuff because they're so conditioned to
00:45:02
◼
►
google copy-paste done ship it kind of stuff
00:45:06
◼
►
um... so that's the number one thing i would encourage people to do is please
00:45:11
◼
►
you know i i understand that needs to happen from time to time but especially
00:45:15
◼
►
when you're learning stop that
00:45:18
◼
►
or it's fine if you go google it and look at it on stack overflow but never
00:45:21
◼
►
copy the code from stack overflow
00:45:23
◼
►
the read the docs on background property
00:45:26
◼
►
And then when you get there and you scratch your head and you say, "Huh," there's a little note at the end.
00:45:30
◼
►
The last phrase in there says, "This is more efficient than drawing a background color in DrawRect."
00:45:35
◼
►
What's DrawRect? Go dig into DrawRect.
00:45:38
◼
►
And that sort of like, "Find the path to peel back the onion," is the most important thing to make you a good seasoned iOS developer.
00:45:49
◼
►
Now that we have Arc and storyboards, I think there's fewer problems that are typical, like
00:45:57
◼
►
people always get stuck on.
00:45:59
◼
►
I still have a lot of people who, from Google or I don't know where, but they get this idea
00:46:04
◼
►
that interface builders shouldn't be used and they should write everything in code.
00:46:08
◼
►
And that's another one of my soapbox things where I just stand up and say, "Look, you
00:46:12
◼
►
gotta pull your head out.
00:46:13
◼
►
That's ridiculous.
00:46:14
◼
►
What are you talking about?"
00:46:16
◼
►
Because a lot of people read these blog posts that say, "Oh, Interface Builder is so slow
00:46:20
◼
►
and whatever."
00:46:21
◼
►
Oh, it just makes me crazy.
00:46:25
◼
►
If it's slow today, it's going to be better tomorrow.
00:46:27
◼
►
And if you write all that code, you're going to be saddled with thousands of lines of code
00:46:30
◼
►
that could be easily represented visually.
00:46:34
◼
►
And then other stuff that people consistently mess up.
00:46:41
◼
►
Even with Arc, I see people struggling with understanding the memory management, and I
00:46:47
◼
►
think the biggest reason that people struggle is, again, that engaging their mind to not
00:46:52
◼
►
just read the docs, but to build puzzles to understand what's going on with retain, release,
00:46:59
◼
►
auto-release, whatever, so that they can understand what's really going on there.
00:47:06
◼
►
It's always one of those funny things.
00:47:11
◼
►
I always find this with myself.
00:47:13
◼
►
There is all these shortcuts that you can take in development, whether that's just grabbing
00:47:18
◼
►
code on Stack Overflow or tools or techniques that you'll find on a blog post.
00:47:24
◼
►
I always think about the most is like these shortcuts that it's almost like you have to
00:47:28
◼
►
have a driver's license before you can use those.
00:47:30
◼
►
I like that analogy.
00:47:32
◼
►
Because if you're sitting there, it's sort of like when you're learning to drive, at
00:47:36
◼
►
least with me, when I was learning to drive, it's like two hands on the wheel, whatever
00:47:41
◼
►
it is, it's like at nine and three or two and ten or whatever you're supposed to do.
00:47:45
◼
►
All of these things that are important for helping you really grasp and have a solid
00:47:51
◼
►
command of the skill that you can ease up on once you're proficient in that task and
00:47:58
◼
►
in that skill.
00:48:00
◼
►
I think I find that myself.
00:48:01
◼
►
It's like there's all these things that you get into trouble
00:48:04
◼
►
when you start doing things that you-- anytime
00:48:07
◼
►
you have code in your app that you don't understand.
00:48:10
◼
►
It's probably even the simplest way
00:48:11
◼
►
when I think of that situation you're describing.
00:48:15
◼
►
I've certainly seen in my consulting days
00:48:17
◼
►
a lot where you see this code and it's like, what does this do?
00:48:18
◼
►
It's like, I don't know.
00:48:20
◼
►
I got that from Stack Overflow.
00:48:22
◼
►
It seemed to work when I put it in.
00:48:24
◼
►
And it's this problem of it's like I often--
00:48:28
◼
►
And when I'm finding the little nugget from Stack Overflow
00:48:31
◼
►
or from someone's blog or something,
00:48:33
◼
►
hopefully what it is is I'm seeing something and saying,
00:48:36
◼
►
oh, right, that's how you do it.
00:48:39
◼
►
It's helping draw that connection between two
00:48:42
◼
►
frameworks that I'm not familiar with,
00:48:44
◼
►
or helping me find the bug in my code where it's like,
00:48:47
◼
►
oh, that's right.
00:48:49
◼
►
Any time you use this class, you have to also do this thing.
00:48:53
◼
►
all these little, like, the little, like,
00:48:55
◼
►
the either undocumented or poorly documented
00:48:59
◼
►
little, like, tricks that you have to do to make things work
00:49:02
◼
►
And if you start throwing too many of those in that you don't
00:49:05
◼
►
understand, then debugging becomes impossible.
00:49:09
◼
►
Because like, what's the old saying?
00:49:11
◼
►
It's like, don't write code that's-- don't write
00:49:17
◼
►
code that's too smart.
00:49:18
◼
►
Because debugging is harder than writing code.
00:49:21
◼
►
And so if you write code that's at your limit of intellect,
00:49:24
◼
►
you'll never be able to debug it.
00:49:25
◼
►
Because debugging is harder, so by definition,
00:49:28
◼
►
it's impossible to debug code that's
00:49:30
◼
►
at your limit of intellect.
00:49:32
◼
►
So write code that's easy and understandable,
00:49:34
◼
►
and then you can actually debug it and work on it.
00:49:37
◼
►
So I certainly see those types of things.
00:49:39
◼
►
I find a lot of times-- and I've been joking about this recently
00:49:42
◼
►
on Twitter-- is that I look back at everything
00:49:46
◼
►
I wrote six months ago, or even six weeks ago,
00:49:49
◼
►
think, "Who's the idiot who wrote this code?" And on the one hand, I think that's positive
00:49:54
◼
►
because you're always learning new stuff and you're always learning new ways to approach
00:49:56
◼
►
things or think about things or whatever. And where I see people fall down, though,
00:50:03
◼
►
is that they buy into that and they say, "Oh, six weeks ago I was dumb," or "Six months
00:50:09
◼
►
ago," or whatever, but then they never go the next step of, "Oh, I'm going to figure
00:50:13
◼
►
out why that works the way that it does or whatever.
00:50:17
◼
►
So yeah, it's an important thing.
00:50:20
◼
►
I think it's too easily overlooked with the ability to make progress on whatever it is,
00:50:27
◼
►
the feature you're trying to implement or the app you're trying to get shipped or whatever,
00:50:30
◼
►
to just copy and paste from someone else.
00:50:32
◼
►
Oh sure, and all the little lies we tell ourselves, "Oh, I'll fix it as soon as I ship."
00:50:37
◼
►
As soon as that--
00:50:38
◼
►
1.1 will have that fixed.
00:50:39
◼
►
Yeah, I'll totally fix that and I won't be cheating on that.
00:50:42
◼
►
That never seems to happen.
00:50:44
◼
►
Yeah, yeah, yeah.
00:50:45
◼
►
Well, I wanted to thank you for taking the time to be here on the show this week.
00:50:52
◼
►
And before you go, I wanted to sort of give you an opportunity to talk about how people
00:50:55
◼
►
can find you, follow you online, those types of things and projects and things you have
00:51:00
◼
►
upcoming that you should know about.
00:51:02
◼
►
Sure, thanks.
00:51:03
◼
►
Yeah, that's awesome.
00:51:04
◼
►
So the Pragmatic Programmer's book on the iOS SDK has been fully updated to iOS 6.
00:51:11
◼
►
We did a beta cut right before we started putting iOS 6 content in there.
00:51:18
◼
►
The book that's currently shipping covers iOS 5 where it's updated for iOS 6 and then
00:51:23
◼
►
as soon as it goes public, we'll ship a beta version that goes public and then it'll go
00:51:27
◼
►
off to the printers and it'll be a couple weeks after that before the paper hits, which
00:51:32
◼
►
I'm really looking forward to.
00:51:34
◼
►
It was a fun book to write and it was really cool to sort of go in and rethink the way
00:51:38
◼
►
we wrote the book the first time.
00:51:40
◼
►
So it's a very different, completely rewritten book, so that was a lot of fun.
00:51:46
◼
►
I'm also working on a book that I'm self-publishing through the iBookstore on C, the language,
00:51:54
◼
►
and all the stuff that, as a proficient Objective-C programmer, that you've looked at and thought,
00:51:59
◼
►
"What is that pointer thing?
00:52:01
◼
►
I'll just pass nil for the error because I don't really understand ampersand error."
00:52:05
◼
►
Stuff like that to sort of help you understand, "What does that ampersand thing really mean?
00:52:08
◼
►
What are pointers and stuff?"
00:52:10
◼
►
kind of some people look at me like I'm kind of nuts but I'm basically going to take you
00:52:14
◼
►
from the type system of C and understanding the basic types and then how they sort of
00:52:20
◼
►
evolved into objects how we ended up with with Objective-C objects by talking about
00:52:25
◼
►
structs and then we're going to implement a really simple version of the Objective-C
00:52:29
◼
►
runtime so you can send messages to your to the struct that you built which is kind of
00:52:34
◼
►
on the one hand sort of nutty and very nerdy and behind the scenes kind of you'll only
00:52:38
◼
►
enjoy this book, I think, if you like to understand how things really work. But on the flip side,
00:52:44
◼
►
I think it's also going to help a lot of people who are proficient at Objective-C but want
00:52:48
◼
►
to take their development to that next level to understand stuff more deeply or whatever.
00:52:54
◼
►
So that will be--it'll definitely be done by the end of the year. I'm working on a lot
00:53:01
◼
►
of really fun HTML5 CSS interactives to sort of show off the code and help people understand
00:53:06
◼
►
how stuff works. So that will be by the end of the year roughly. And then I'm also, speaking
00:53:12
◼
►
of teaching kids, I'm working on a series of books to help kids understand how to program
00:53:17
◼
►
games on the iPhone. And so that'll be like very basic programming all the way up to,
00:53:22
◼
►
you know, doing game type stuff. So I eventually, my goal is to make it all the way to OpenGL.
00:53:30
◼
►
So you have basic programming all the way to loading an OBJ file or a COLLADA file and
00:53:35
◼
►
displaying it on screen and having your bad guys shoot guns at each other. But that's
00:53:40
◼
►
probably a two-year effort to get all that stuff written. So, you know, it's a... and
00:53:44
◼
►
it's also a sort of a background thing.
00:53:47
◼
►
So, yeah. So that's the two big things that I'm doing that are sort of personal and then
00:53:50
◼
►
still doing a little bit of consulting here and there and doing a lot of teaching.
00:53:54
◼
►
If people want to find you online, where to go.
00:53:56
◼
►
Oh, yeah. So I'm @bdudney on Twitter. So you can follow me there. I have a blog at bill.dudney.net,
00:54:02
◼
►
I've been a slacker and haven't been updating nearly as much as I would like to.
00:54:06
◼
►
But those are the two big places where I do most of my public stuff.
00:54:11
◼
►
Again, I just wanted to thank you for taking the time and I really appreciate you talking.
00:54:18
◼
►
It was a blast.
00:54:19
◼
►
It was a lot of fun.