00:00:00.000
as the man says I'm my name is Russell ssin I have been around the Ruby community for a long time I worked for a
00:00:05.850
company called hash rocket I've written a couple of books that I'd like you to buy many many copies of and before I
00:00:15.509
really get started I want to say that I helped organize one of the other Ruby conferences Ruby nation and I gotta say
00:00:22.230
it's a pain in the neck getting everyone here is takes more effort and more
00:00:29.160
aggravation than you could possibly imagine so I just like to thank the hash rocket guys and everyone else who will
00:00:36.030
they have right fit women to anyone else to have anything to do with this
00:00:42.540
conference so onto the onto the topic of the day what I want to talk about this
00:00:48.690
morning I'd like to step back a little bit and talk about the things we do and
00:00:53.879
how we do them and in particular I want to talk about insight and intuition and I'd like to start with the question and
00:01:01.920
the question is why okay and it's why is the experience of programming what the
00:01:09.030
experience of programming is so I don't know about you but here's how I spend my
00:01:14.189
work week Tuesdays Thursdays and Saturdays unhappy i'm coding away I'm
00:01:21.090
just everything's going brilliantly Mondays Wednesdays and Fridays a alternate between staring at the screen
00:01:28.110
and banging my head against it right programming is really hard what we do is
00:01:35.340
really really hard and so the question I want to start with is why is what we do
00:01:40.560
so hard what makes it so difficult and I think if you remember back when you were
00:01:47.280
first learning the program it was a surprise right you get this when she first sort of knew how to program a
00:01:52.829
little bit and you get some trivial little exercise you tried to do some trivial little program you wanted the right and it would be really hard and it
00:01:59.460
was kind of a surprise and certainly in the early days of programming I mean software was invented to keep people
00:02:06.479
from having to like program computers by plugging wires in right oh we're going to do this in software and it's going to
00:02:12.510
be so cheesier how did that work out so it actually so it was a surprise in these
00:02:19.220
early days this is a guy from the 1940s sort of at the beginning of what we do
00:02:25.100
and his name was gray water and he was active in those very early days when we
00:02:32.209
were we were first doing programming and I think he actually discovered why what
00:02:37.970
we do is so hard what gray Walter did was he was trying to simulate animal
00:02:43.220
behavior like seeking food and avoiding obstacles and he built this little robot
00:02:48.290
which is the first of its kind if you sort of do the Make Magazine kind of thing people will build robots that will
00:02:55.220
run around the floor and bump into the wall and back up and go in a different direction at home I have a rumba rumba a
00:03:01.640
little vacuum cleaner that basically does the same thing this was the first one gray Walter called this thing a
00:03:08.000
turtle because he had like a plastic shell or metal shell at went on it looked a little bit like a turtle and he
00:03:13.790
wrote he built some some actual hardware software so he could let this thing go
00:03:18.920
and it would bump into obstacles and back up you know the kind of toys that people build and let me tell you it's a
00:03:25.010
kick to Bill if you've never built something like this it's really a lot of fun to do this and I'm sure that he had
00:03:31.250
a lot of fun doing it and one of the other behaviors that he built in that I tried to represent up there at the top
00:03:36.530
is if the battery ran down on the thing it would go seek out a charger there was
00:03:42.019
a light above the charging station and it would go find the charger and plug itself in and recharge and then it would
00:03:47.810
back up and run around for a while and do that over and over and it was all very simple it's just some analog
00:03:53.989
circuits people estimate that maybe there are two or four neurons worth of intelligence in these things the funny
00:04:00.950
thing is well you can imagine he actually built two of these and right so
00:04:06.140
you built two of the coolest things you could possibly imagine what do you do with them you let them run all the time
00:04:11.420
right you turn those suckers on you just let him run funny thing would happen is if you let two of them run at the same
00:04:17.390
time he would come back after an hour two and one would be stone dead and the
00:04:23.810
other one would be running around or one would be upside down kind of ironic because he called them Turtles
00:04:29.840
and the other one would be running around sometimes he'd come back and they'd both be dead right so what's the
00:04:36.650
deal with that turns out that if they both get hungry at the same time they
00:04:42.890
both start the head for the power charger thing there's only one power charger thing and they bump into each
00:04:49.340
other so they back up and then do it all over again they go and they hit each other and they back up and basically
00:04:56.240
they fight to the death over the food he
00:05:02.990
didn't intend what he did the circuit he didn't intend for that behavior to come out it just kind of fell out of the
00:05:09.290
design it just kind of happened and that's why I think programming is so
00:05:16.790
hard because programming is all about emergent behavior we write some code and
00:05:22.370
we're hoping that from very very simple code something like this we're going to get an accounting system out of this
00:05:29.120
thing we don't care nobody cares if we can increment the counter what we want is an online storefront or a personnel
00:05:36.530
system or whatever else so we rely on emergent behavior the problem is that
00:05:42.020
there's emergent behavior we like and there's a merchant behavior that ends up with a dead turtle right and it's hard
00:05:49.670
to control emergent behavior so we are in a sense in the emergent behavior
00:05:56.270
business everything we do is about getting the right behavior to emerge and
00:06:01.730
keeping the wrong behavior from you know also emerging or emerging instead of
00:06:08.330
what we want and which brings me to the topic of my talk which is that we like
00:06:15.350
to think of ourselves as kind of doing logical on a semi mathematical kind of
00:06:23.240
work you know and so we you know if you fix a bug right somebody will say how
00:06:29.780
did you fix that bug and you say well I deduced that this was going on and then the pointer was wrong and then that
00:06:35.120
happened now that's not how you fixed the bug what you did which you stared at it for two days you
00:06:40.760
banged your head a little bit and then suddenly it came to you right so we pretend that this is the kind of stuff
00:06:48.800
we're doing you know we're doing this purely logical stuff when in fact we're really doing something completely
00:06:54.470
different right Socrates does not know why the robots fight and so what I want
00:07:01.070
to talk about is kind of those aha moments what happens after you get done banging your head on the LCD screen what
00:07:07.940
happens you know what is really going on when we do the real work of what we do
00:07:15.290
so the question is where do those aha moments come from and the bigger
00:07:20.840
question is how do we get more of them how do we when we're stuck how do we get
00:07:27.320
unstuck okay so that's insight and intuition how does it work and how do we
00:07:33.320
get more of it well here's one thing it's not magic right we tend to treat it
00:07:40.100
like it's magic item hell i SAT there for two days and suddenly the answer came to me it's not magic it's got to do
00:07:47.780
with this whole left brain right brain thing so now I'm not going to go all psychological on you or anything but I
00:07:53.930
think it's true that our brain our minds are specialized okay it seems to be true
00:08:01.040
that for most people the left side of your brain does the logical the language kind of stuff the right side of your
00:08:07.910
brain is more creative at things in pictures okay I think there's something to that right it is in fact the right
00:08:16.310
side of your brain that looks at that and says foggy highway near a forest
00:08:22.760
right I could have taken that picture outside today but they didn't the thing
00:08:29.900
with this whole left brain right brain thing that I when people talk about it they never ever say as far as I can see
00:08:37.760
is the fact that the two halves of your brain share some common resources it's
00:08:43.760
like you got a dual cpu set up but there's only one network card there's only one disk drive and what that means
00:08:50.720
is that they both not operate at full steam at the same time and that's key okay they share some
00:08:59.629
common resources so how do they work well I think for what we do how it works
00:09:06.800
is you got a bunch of facts floating around in your head right so here I've got like the turtle seek the charger or
00:09:13.279
Turtles back up in collisions but all the facts you know so among the things that I know with metaphysical certainty
00:09:20.509
is down there at the bottom which is bacon is good ok so it's everything you
00:09:25.550
know and there's some background process that's pairing these facts up right
00:09:31.519
turtles seek the charger and Bacon's good that's probably not the most
00:09:36.740
helpful thing in the world but turtle seek the charger and only one turtle can
00:09:42.740
charge of the time that is on its way to something and that's sort of interesting so I think when you're banging your head
00:09:50.600
on the LCD screen what you're doing is you're kind of pairing up these facts in
00:09:55.699
a background process and eventually you're going to come up with some facts that you know give you some illumination
00:10:03.819
which brings me to my first bit of little practical advice which is you
00:10:10.790
need to select the facts carefully and what I don't mean by that is you need to
00:10:16.339
sort of focus in on I'm only you know I'm going to live breathe and eat software engineering for the rest of my life what I mean is you need to filter
00:10:22.579
out the noise right there's so much noise in programming that it can
00:10:30.290
overwhelm you so what is that anybody recognize that the rails log file we all
00:10:36.230
know them what do you find it in a rails log file if mainly you find two things
00:10:43.250
you find information about HTTP I got this get request I get this post request
00:10:48.980
and you find things active record II kinds of things I put this in the database i did this select statement why
00:10:56.420
do you find all that stuff in a rails log file you find that stuff in a rails log file because that was rails is
00:11:01.449
original purpose for being rails was original a a thin HTTP veneer over a relational
00:11:09.770
database right that's not true anymore people haven't paid me for a really long
00:11:16.610
time to write thin veneers thin HTTP veneers / relational databases the
00:11:22.640
applications that most people are building today about a lot of you with rails are a lot more complicated than
00:11:28.910
then you know sort of the stuff that's in here and you know what else we've gotten pretty good at HTTP active
00:11:35.660
records pretty good we don't really need all this information to the bug our applications and yet when we try and
00:11:43.900
debug our applications by putting in log statements we put it in with all of this
00:11:49.100
stuff and there's this huge pile of I don't care a fax in our log files so
00:11:55.790
what I try and get people to do is create a log file in the rails application that is only for the higher
00:12:03.800
level what the heck is this application doing at some high conceptual level so
00:12:10.580
this is just an example of sort of don't pay attention to extraneous facts because they're just they're exactly
00:12:15.830
that and they they disable your ability to get at the insights that you need so
00:12:24.590
would you rather look at that or that hidden somewhere in there right now
00:12:31.880
obviously you could do this with some kind of filtering i just find it easier to create a separate log file but the
00:12:37.790
point is that you need the filter out the noise and sometimes literally you
00:12:44.690
need the filter out the noise who here pairs a lot of people pair okay i pair a
00:12:51.680
pair a lot and i actually do a lot of remote pairing which is I've got T mux and I've got skype running and I'm
00:12:57.800
talking to this person somewhere far away and we're working on the same project and if you think of the
00:13:03.230
experience of caring what do you do you talk a lot right oh I'm going to do this and I'm going to do that and we also
00:13:09.020
feel like we're agile we want to be agile so there's always something in motion right you're moving you're doing
00:13:15.800
things you're you're looking for the new gem and stuff like that and then we hit one of these problems that
00:13:23.540
we need some insight for and typically what happens is that generates an even bigger flurry of activity right we're
00:13:30.649
trying furiously we're trying all the gems were doing this and we're doing that we're talking back and forth so
00:13:36.380
here's the suggestion just be quiet for a while declare a two-minute we're just
00:13:41.959
going to think and stop talking because remember the two sides of your brain they share common resources you cannot
00:13:49.490
talk and think creatively at the same time or you can't think creatively as well if somebody's talking if you're
00:13:57.470
talking if you're furiously looking for the new gem version just that's what
00:14:05.180
that word was um just declare a moment
00:14:11.839
of silence and for two minutes don't talk to each other you'd be amazed with
00:14:17.000
what ideas pop out of that here's another idea change the facts we tend to
00:14:23.570
build applications and we give it some sample data this is like a personnel kind of system you get some sample data
00:14:30.079
right I got four phony people in there and if something goes wrong with it we run these the system with the same
00:14:37.220
sample data over and over and over well here's a counterintuitive thing that
00:14:43.130
actually works change the amount of sample data so that if four people have
00:14:48.140
seven if you got seven try for just change it a little bit now the logical
00:14:54.350
side of your brain will say that cannot
00:14:59.540
possibly make a difference right the amount of my junk data cannot possibly make a difference logically this will
00:15:06.620
not make a difference okay logically your brain does not know logically why
00:15:13.279
the system isn't working in the first place so logically the logical side of your brain should shut up right the
00:15:20.779
intuitive side of your brain will see patterns that it won't see if you just stick to the same amount of data so even
00:15:28.940
stranger is you take some real names real people and you stick them in instead of like fake names
00:15:35.300
and you try that because that may jog something so use real names real people
00:15:42.040
the other you know I have to stop here for a minute I just said these were real
00:15:47.449
people and nobody said it worries me a little bit the other thing you can do is
00:15:54.769
break your system right just put some junk data in there and see where the pieces land right this is the equivalent
00:16:01.430
of trying to get insight in the hell car engine works by sticking a screwdriver in it it works sometimes and the
00:16:08.660
advantage of this is that line of junk data will not come flying out and take a piece of your ear off so try that the
00:16:16.130
other thing you can try if you're looking for some insight if you're looking to jog up your intuition is to
00:16:23.510
see the stuff happening in real time which is a very fancy way of saying just
00:16:29.690
tail your log files try and get information that's happening in time so again the logical side of your brain is
00:16:37.279
saying well if I look at the log file and this came before this I logically
00:16:42.949
know that this happened before that that's true but seeing it happen is
00:16:48.829
something different seeing it makes you believe it with both sides of your brain
00:16:54.430
okay the intuitive side of your brain is not so convinced that this because it's
00:17:00.079
before physically happened before this in time and you need to convince it of
00:17:06.260
that finally well not really finally but there's also a warning i need to give
00:17:13.549
you and I think a lot of us fall into this trap a lot of the time which is
00:17:19.370
that when we get these revelations the lightning bolt comes down and you say I know what the good design is I know
00:17:26.689
what's going on here you get this you know flash of lightning remember that
00:17:32.030
lightning is like four million volts and can do some damage just because it comes as a lightning bolt does not mean it's
00:17:39.020
right and as the perfect example of this I give you this guy this guy is Percival Lowell or he was I
00:17:47.100
guess because he died in 1916 he was one of those people he was from prominent
00:17:53.520
Boston family he was born richer than rich he went the Harvard he then went
00:17:58.620
off and made the zillions of dollars in business on top of what he inherited he became after he got tired of doing that
00:18:04.890
he became a pretty world-class mathematician and then sadly he turned
00:18:10.860
his attention to astronomy Percival Lowell had the misfortune to live right
00:18:17.100
at the end of the era where astronomers actually looked through their telescopes and Percival Lowell looked at Mars and
00:18:24.330
this is what he saw he saw this network of straight lines with nodes and he
00:18:30.810
thought there's got to be some intelligence there there's got to be a civilization there and so all of the bad
00:18:38.730
science fiction you've ever seen about Mars and invaders from Mars and really
00:18:44.970
bad science fiction you can blame you can blame all of this you can blame this on Percival Lowell because it was his
00:18:52.200
idea so that people took really really seriously that led to two you know this
00:18:58.380
idea that there's this old civilization on Mars with canals okay so if you look
00:19:04.950
at the picture of Mars with those straight lines it's absolutely clear
00:19:10.220
those straight lines are evidence of intelligence there's just no doubt about
00:19:15.570
it the question is and there's Percival looking through his telescope the
00:19:21.150
question is is the intelligence at the Mars end of the telescope or the person
00:19:27.840
the low end of the telescope and it turns out those lines are not there
00:19:33.890
turns out that if you look at an object that's got spots on it and the spots are
00:19:39.240
just below what you can see so they're just below your level of vision you're
00:19:45.150
the pattern matching software the same stuff that gives us these revelations I
00:19:50.160
know what the bug is that same stuff will turn those spots in the straight
00:19:55.530
lines with little nodes in your vision and that is what you will see and you will make a horse's ass of
00:20:01.739
yourself if your personal though we are wired to see patterns right what is that
00:20:09.619
it's a cloud no it's not even a cloud it's some light and dark light on a
00:20:17.489
white screen right there's no bunny rabbit there I see a bunny rabbit we you
00:20:24.419
have to watch out just because it comes to you and it seems like the most brilliant revelation and everything just
00:20:30.690
falls into place you need to be very very careful of those things because
00:20:36.389
they may not be right but they will make you believe and in particular if you get
00:20:42.359
a revelation or some intuition that involves numbers particularly statistical kind of numbers be very very
00:20:49.470
skeptical my sister is afraid to fly right it's not that she's a stupid
00:20:55.859
person or anything like that it's that intuitively she believes that the
00:21:01.229
numbers will tell you that it's a dangerous thing to do even though we know that it's not right lots of people
00:21:08.549
are afraid to fly this is a great quote you know buying lottery tickets does not
00:21:14.399
significantly increase your chance of winning the lottery and yet people buy lottery tickets because we're bad
00:21:21.320
statisticians intuitively and I'll give you a example a little more close to
00:21:27.239
home which is this if you flick back and
00:21:33.629
forth the way I do between sort of the Java world in the statically typed world in the Ruby world you will eventually
00:21:40.619
hear this argument and it's a pretty compelling sounding argument the argument goes like this static lling
00:21:47.220
there's a whole class of bugs that you can get with dynamic languages right I think I have an employee object and in
00:21:53.940
fact what I have is a nuclear missile object and then I call fire
00:21:59.440
whoops right you've heard I mean if you hang around with people who do static languages that's what they'll tell you
00:22:06.230
and therefore there's a whole class of bugs that you can get with dynamic
00:22:11.390
languages so I'm trying to illustrate that with a little red extra there that you can't get with dynamic or static
00:22:18.410
languages therefore static languages are better they're more reliable they're safer except they're all here in this
00:22:26.030
room that is not the experience that we have in day-to-day programming so what's
00:22:31.700
the deal well this is a numerical statistical chance based argument so let
00:22:38.240
me let me just make up a slightly different situation what if the number
00:22:43.880
of bugs in any given program was colossal huge enormous and yes that
00:22:51.050
dynamic languages add a few more on top of those huge numbers I don't know if
00:22:56.780
you can see it the little tiny red bit up there on the right suddenly this argument doesn't make much sense or it
00:23:03.590
doesn't seem very compelling anymore and this is more like the experience we have there are no shortage of bugs in
00:23:09.740
programs right so if you add a few more possibilities and you get something back
00:23:15.170
from them might be a good deal particularly if the chart looks like that and not like that so in talking
00:23:22.760
about numbers and intuition and programming the other place you got to
00:23:27.890
avoid is the perfect storm of
00:23:35.530
programming intuition the perfect storm of programming intuition is when
00:23:42.260
somebody says hey Russ can you speed this program up it's taken too long right if somebody tells you to improve
00:23:50.150
the performance of some code that is is the black hole of intuition what are we
00:23:57.860
trained to do I give you some code and I say make it better what are we trained
00:24:02.870
to do we go into the code and we look for the interesting parts we look for
00:24:09.110
the badly written part we look for the ugly parts or alternatively we look for the
00:24:14.600
well-written beautiful part right and if you give someone who hasn't done this
00:24:20.370
very much a program and sake it make it make it faster the first thing they will do is go look through the code and
00:24:26.910
they'll look through the code and automatically they are looking for the interesting parts they good or bad or
00:24:34.100
cool part none of that has anything to do with where that program will decide
00:24:40.500
to take up a lot of time right inspecting code is pretty much the worst
00:24:46.080
way in the world to find out where a program is taking its time you know the best way is you measure it you just go
00:24:53.010
in and you measure it right you profile the code every time anyone has ever
00:24:58.410
asked me to make some code faster I profile the code and it's like oh wow I
00:25:04.860
didn't expect it to be there how did that happen and then I can start program
00:25:11.340
performance is the perfect storm of bad intuition and that's the place that you
00:25:17.940
need to watch very carefully the other thing that you can do so that's sort of
00:25:24.570
the negative side of it the positive side of it is how do you get better at your intuition or having insight and one
00:25:34.650
of the things that I think we sort of think as a culture that I believe is just completely wrong is that there are
00:25:41.880
people who know the facts on one hand and there are people who are creative on
00:25:46.980
the other hand I don't believe that at least not in our world there's people
00:25:52.530
who are creative because they've mastered the facts maybe they've mastered the facts very quickly maybe
00:25:59.610
they've mastered them in a different way in a non-traditional way but creative people who are making real progress have
00:26:05.970
in some way mastered the facts chance favors the prepared mind as what Louis
00:26:11.700
Pasteur said before he heated up as milk so you know the book seven languages in
00:26:19.260
seven weeks if you don't know that book you really should seven languages in seven weeks encourages you to go off and learn about
00:26:27.670
seven different programming languages in seven weeks right and the idea is you may never use any of these programming
00:26:34.270
languages but maybe it will make you better you'll have more facts so you'll have better intuition and I say yes do
00:26:42.640
that and do more oh the problem with set those seven programming languages is
00:26:48.370
they're all fairly high level programming languages right go to the other direction go lower level or go
00:26:54.340
really high level I've sort of hidden assembly off at the bottom so I don't scare the children but you know there's
00:27:02.260
a whole hierarchy of programming languages that you can look at that will
00:27:07.390
give you insights into how things work Ruby if you're using the Ruby that most of us use is implemented in C okay I
00:27:15.250
have an advantage I was C programmer for years if you don't know anything about see there are things that Ruby will do
00:27:21.790
that you just won't get that's and it doesn't take a huge amount of C to see that that was unintentional ah the other
00:27:33.370
way you can go you go sort of in a different direction right learn the solder learn some electronics write
00:27:38.710
everything every program you've ever written runs on electronics why not learn something about that or you're the
00:27:45.160
other way and learn about hopper rating systems and networks and that kind of stuff or alternatively you can do with
00:27:50.260
me and Jim over there do you buy yourself a ukulele right learn about music or a foreign language or something
00:27:56.830
like that all of this stuff all of these things things like music there emergent systems okay they are systems that start
00:28:05.050
with very simple things so ukuleles got four strings okay but they produce their
00:28:11.140
interactions produce this very complicated emergent behavior okay so
00:28:16.230
the more emergent behavior the more systems that you're familiar with that have the same kind of emergent behavior
00:28:22.840
that we're dealing with the better you will it be at it if you like sports why
00:28:28.780
do some teams work and why sometimes do they not right these sports teams are emergent
00:28:36.800
systems why does that work as a painting it's just some blobs of paint on a white
00:28:42.710
canvas why does it work that's Congress I'm not going to ask why that works okay
00:28:49.940
but it is a complicated system with incredibly complicated emergent behavior and if you think about politics you know
00:28:57.560
you could think in terms of the politics of the software you're working on maybe that's a an analogy it'll take you take
00:29:03.800
you a certain distance so here's kind of a summary of all the things that I've said but I just kind of want to go
00:29:11.300
through that quickly because and this is a true story i wrote this talk and was
00:29:16.940
sort of happy with it and then walked around in a daze for a couple of days like it wasn't quite finished you know
00:29:23.810
why do I feel like this talk is not quite finished and then it hit me and so here's the revelation i had see if it's
00:29:30.230
perfect storm or something valuable and it is this we are in the emergent
00:29:35.780
behavior business our whole job is we build these systems that we're hoping
00:29:40.910
have interesting emergent behavior there's all kinds of systems in the world starting with Congress in the
00:29:47.540
United States but worldwide there's you know the environment there's our energy
00:29:53.720
systems there's how we educate people these are all complicated systems that produce even more complicated emergent
00:30:01.280
behavior everyone in this room knows more about merchant behavior than
00:30:06.860
virtually everyone else in this city okay we as a profession are in a unique
00:30:13.340
position to be able to take the things we learn at work and go out and have
00:30:20.660
some insight into the wider world why do the systems that are not computer
00:30:25.670
systems why are they working or why are they not working I am convinced that we as a profession the people in this room
00:30:32.660
have more to contribute in those terms than almost what we do on a day-to-day basis so it's just something to think
00:30:39.650
about but I really I have this feeling I you know I go to a lot of conferences I
00:30:44.750
love you people great and I think you more to contribute outside of your professions to think about that thank
00:30:52.550
you all for listening
00:31:01.240
you