Alan Kay: Programming and Scaling
From Viewpoints Intelligent Archive
so
of course we never want to spend too much time looking
back especially when talking to students
because the world is in front of you
but one
point I wanted to make and this has always been
true and has never reflected adequately
in any rewards that a person might receive
and that is that when
good work gets done it almost always gets done
first in a powerful research
community of
very friendly and very critical
colleagues who know how to argue
the right way so as you're looking
ahead for yourself finding
these people in general is
critical and finding them in particular
is critical so these are just some of the people that
have
associated with some of the work we've been doing it
viewpoints Research Institute
and
very few awards actually
are given to groups
that this is a real mistake in our field
because I believe in our field that you not only have
ideas you have to get them implemented and
it is often the case that people
with ideas are not so good at implementing and so
you need to have a kind of a team of
different kinds of talents who are able to
work together
one little look-back though
it could be so I as we as the
term is meant today I made up the term object-oriented
programming but I made it up for something
different than the term stands for today
and what the term stands for
today this could be the 50th anniversary
of it so that's quite surprising to think it
nineteen 61
and it goes back to a very surprising
form which is
actually a machine so
there's no object-oriented programming language in 1961
that I'm aware of I actually started
in computing myself in 1961
so there was nothing like an object-oriented programming
back then but there is a piece of hardware that
can most easily be
explained to you is that this was a
computer hardware that
executed a
set of instructions that look like the byte
coded VMs that you're familiar with from Java
in fact those byte coded VMs that Java
have came originally because they were the
basic instruction set on this machine
so this is one of the first attempts
at a building a higher-level machine
to reflect the idea in the early 60s that
we were going to program in levels of language
higher than C and
Bob Barton here invented
this machine and sadly the
hardware of the day is not as advanced as this machine
was so for those of you
who think we've been engaged in steady progress
in some form
of Darwinian processes that are making
things better for us it's actually quite the opposite quite
the opposite in history
you can find really incredible
geniuses like this man who anticipated
so strongly that we
can only emulate his ideas and software
today intel hasn't gotten around to understanding
them yet so this I find
really quite sad on the other hand it
gives you a sense of this person
and if you want to read an interesting paper probably
the shortest greatest paper ever written
in computer science you can read this one
written in 1961 by Bob
Barton new approach to the functional design
of a digital computer it's only six pages long
and it lays out what
a felicitous
execution environment for
language would be like and how it would be realized in
a computer this computer was built by
the way it lived on longest in Germany the
German banking system loved it
because it was uncrashable why was it uncrashable
because it was the first hardware or software system
to have what we call capabilities today
an application programmer simply could not
write a program that could hurt any
other program on the computer that was
built directly into the into the hardware of this
machine and the reason
I'm showing you this just because
part of it is everybody should understand the history
of our field if we were physicists and we failed
to understand what Newton did we should be shot and
but in fact in computing we
are very happy not to understand what most
of the founders of our field actually did so
I always like to pick one of them in
the generation before me and
explain what he did but reason I brought it up
here is that I had a course
from this guy this guy was took
a leave of absence from borrows to come teach
at the graduate school I was at and in
this course which was
about advanced systems design instead of teaching
this course he handed out a list
of all the papers we should read he
said there are a few things known about advanced
systems design in 1966
they're written down in these papers and I expect you to read
every single one of these papers and understand them and
then he said but it is my job
to firmly disabuse
you of any fondly held ideas
you might have brought into this classroom and translated
into less flowery English what he proposed
to do is to take all of our beliefs
about computing and destroy them
and that is what this class was
the best class I've ever had in a
university or graduate school and
why was this a good idea well
we'll see in a second that the biggest problem
we have as human beings
is that we confuse our beliefs with
reality so we seem
to live in a reality here but actually it's a construction
that we look at one way and
another culture might look at it another way and my
little dog Watson might look at this
whole thing from a completely different point of view and when
we treat a construction as
reality you are actually binding the kinds of thoughts
that we can actually have and worse than that we're picking a
tiny part of the past that led to this
particular construction as the only past
we ever drawn so
what this guy did is just demolished everything that
we thought including things that he actually believed
in so he demolished everything no no
proposition was safe
and at the end of it we
actually were free so we could
then learn computing from the point
of view of it being simply opinions
and a little bit
hat have been done so far up that way but might
not have anything particular to do with
a desirable future so here's a paradigm
that existed back then and
is pretty much what we do today and I call it the make
and fix paradigm and it
started off with data structures and procedures they
were like tinker toys maybe a little bit like clocks
we fit we
make gears we fit them together called
api's they have to fit pretty closely
for the thing to work and
that's pretty much the only architecture we have and
of course you can make a tic-tac-toe computer
out of tinker toy this is Danny Hillis has a few
it but like
such things was once dismantled to
be shipped to a museum and when they put it back together
and never worked again and the reason
was it was just luck that all
of these Tinkertoy actually work because there was play there
there strings inside the
strings weren't the same length anymore and
that reminds you of any programs and
this is this murky thing is actually Mexico
City has anybody ever been to Mexico City
so it's 20 million people
couldn't be more smoggy
and it's kind of a mess
and it's just the kind of it's just a slightly
more extreme version of a lot of American cities
where individuals
have carpenters have
decided to do a house here or a house there and
the problem is is that each
individual little ant doing something
has led to a
totality that is almost unbearable
and yet 20 million people are forced to live in it and to
me this is what software today is kind of
like it's
basically using almost the exact same architectures
as we're known 50
years ago because even
the so called object-oriented languages today have lots
of setters in the objects and when you have a setter in an object
urned an object back into a data structure and
so you get this huge
amount of scaling of
complications but you don't get a lot
of bang for the buck
it's not clear what to do with it but
what
yeah
so if
we look at software in terms of lines
of code for instance
a one book
of software is about 20,000 lines of code and a
foot of books is about I have
it here a meter is about a million lines
of code so if you stack up a meters height
high a book it's about only a million lines of code
okay so
if we look at some software systems
for instance Vista has
120 million lines of code in it so
that's a hundred and twenty meters of
books to read and
six thousand books and another
140 million for the apps another seven thousand
books so we're talking thirteen thousand books
for the simplest part of
personal computing that we're all used to anybody
here read thirteen thousand books
anybody here read one book
okay just checking
so
there's a lot and I know a
big software company whose
name you might have heard that has
to deal with a live
base of about 350 million lines of code and
as they say about 145,000
screens so screens
is a term that was used a long time ago for 3270
terminals and so if they call
their user interface today made out of screens it's probably that they
just adapted those old 3270
screens so this is about seventeen
thousand five hundred books worth of software
nobody in that company knows what it is
but they have thousands and thousands of people
maintaining it so the question we should be asking as
computer scientists first let alone engineers
there's computer scientists we should be asking
is that how
rite to get that much
functionality or is something
wrong
so one way of looking at it is if your
are two curves so
the complication curve
here I just put up
you know about a a factor
of a hundred this
and so
we could see that while we like the complication curve to
run at the same rate as the complexity curve it actually
is way ahead of the game so for
a certain level of complexity like say in personal
computing the actual complication
might be a factor of a hundred or a factor of a thousand
like all
but one tenth of one percent in the Microsoft
software suite might be useless
code code that
is there perhaps for compatibility reasons code
that they don't dare take out
in fact I know that for
example if everybody here is probably used Microsoft
Word and it's quite surprising that
Microsoft Word when you have paragraph justification
on actually has selection
errors to this day if you ever had
that happen got justification on you click in
there and you start typing and the type
character goes somewhere else that bug
there for more than twenty five years it's been reported
literally thirty or forty thousand times and
they cannot find the bug
this is the most elementary
thing that you ever do in a word processor is to
be able to select where you want the character go
they can't find it and fact
I've heard that part of Microsoft words listing has
been lost they've had to recreate it from
from assembly code
so that's kind of a state of affairs that
we probably should be thinking about
because when you start getting into factors
of a hundred and factors of a thousand and factors of 10,000
actually talking about the difference between somebody
being able to comprehend something and maybe
not be able to comprehend it at all
so
if we go back to our diagram here we
can pick up some issues that we might care
about now
say something about the communication with aliens issue
a little bit later what that is
and
if we look in this morass
of stuff there's one interesting
thing that isn't like this that
is huge and yet it is tidy
its level of complication
exactly balances its level
of complexity and that's the Internet so
it's worthwhile thinking about that that even in a poorly
done C program the Internet is actually controlled
than twenty thousand lines of code itself
and that twenty thousand lines of code can be written in
about a thousand lines of code so tcp/ip is
a kind of a universal DNA
for an architecture of billions
of nodes in a
dynamic system that has never been stopped
has never been stopped from when it first
got turned on in September 1969
so replaced all of its atoms at
least once and has never been stopped
it has been changed
it has been improved
but in fact it's an eternal system
it is scaled well and so forth and I'm
not talking about the web of course web is
a mess but the internet was done by
experts you had a couple of those guys Vint Cerf and
Bob Kahn here at different times these
guys knew what they were doing and boy
when you look at this I
think why it is why
did the internet turn out so well and why can't we
that way because you could imagine taking the
inner as a model for doing software modules why
don't people do it
and it's the way I look at
it is a little
jump of
qualitative kind happen here and that
jump is kind of a little jump from gear type things to
biological type things
and in fact those of us who had
been biologists contribute some pilot
biological ideas to the design of the Internet because
of course the Internet is one of the few human
artifacts that
we've made that behaves like about like something
that's alive in that
it repairs itself while it is
still running it is able
to expand and grow and so forth and
so
we can think of the Internet is in
it was made but
it has some of these biological ideas in it
so some of the
same kinds of ideas for scaling
were done in software also around the
same time and some of those were successful
at Xerox PARC but
one of the problems
of these
some of these semi new ideas here is when
they got translated into sea based forms
in order to be recognizable
to people the things
that were like this old paradigm were emphasized
here so for example you got this
really terrible idea of having a so-called object-oriented
system and turning it back into data structures by putting
setters in which allow the very same disastrous
remote assignment
statements to to be done and turns the system into
a much more fragile way of thinking about things
but I think that
what's actually going on here
is that there's a new way of thinking
things that represents a brighter future
for programming and if
this is makin fix for
instance you can fix a clock but you have to negotiate with
the system so at some point the
systems are too complicated for a human being to go into too many
feedback loops too many self regulatory
systems and stuff and you wind up at
best negotiating with the system now the
stuff we're doing in here so far is
in
between we built
it by hand but we made a system
as we've made up many other systems
in software but we haven't made the systems capable
enough to be able to be negotiated
with so I just want to have you think
of it in your head of what it would be like if you're
doing a software system in some new form
of development
interactive development kit
what would that software system actually do
besides just doing what you asked it to
do could it for
instance participate in readapting
the software for future needs about
80% of the cost of all
software that is deployed in industry
comes after the software
has been successfully put out the first time
so the life cycle changes
that are required of the software and the integration and
reintegration actually dominate
all the costs of software but
because of the way companies have
to report their earnings and their expenses
companies cannot charge
upfront for
all of the stuff that you really need
to do to software to allow it to be changed downstream so
what they tend to pay for is just enough money to make the thing
run to its original specs and hardly any money to
be able to fix it up later because they just amortize
those costs of the future and the costs are enormous
o
if we take the
internet as one area and then a slightly
more advanced way of thinking about things is that
once we start thinking in biological terms
we also are thinking about Ecology's
and I hope many
of you have thought enough about the Internet to realize that there
are levels of communication protocols
that could be put on top of
tcp/ip
for example interoperation protocols
that could eliminate the
dependence on specific operating systems
and I hope to get to that in
a few minutes okay
way down the road
what
is actually being put together is something
that is going to have to be discussed in psychological
or mental terms because
the if this
is manipulation
up there just wanted to make a little comment about
biology because
sometimes
if we study computers we don't learn
other things
so we can I'm going to read this diagram both
way so at the
inch scale
now there's
what twenty five
thousand Mike
twenty five thousand four hundred
microns per inch and a ecoli
is about two microns long so it's
about 13,000 microns
per inch a little over ten thousand per
per centimeter
and so if we blow it up by
eighty thousand we get to see this and
of course it's very active so we wouldn't
see this we would see a blur and if
we take the next section up there
we get something that looks like this where we see a bunch of large molecules
we take a section of that so
we're now a magnification of about 10
million we see a medium-sized molecule
has about five thousand atoms in it and these are actually
water atoms so if you like books
like this it's called the machinery light of life
by David Goodsell this is a molecular
biologist who likes to paint and he
realized that doing watercolors of
what is actually going on there could be more clear than
computer graphics or anyway this is
marvelous book for getting an idea so these are individual water molecules these
are calcium ions 5,000
atoms or so
and if
you see the size of this thing compared to it in there
and see it in the size of the larger thing they're
about 120 million molecules
that are not water in
a single living thing
so one of the things to think about in computer
terms is the scale jump from the
lower level of architecture which is polymers like
proteins chains of
atoms to make
long molecules the scale jump to what what
it needs to do to make a living thing is
incredible compared to the scale jump we do when we try
to make objects and I think one of the
mistakes we made years ago was to make objects too
small and we missed
this idea that you might get a lot more out of
making a much more capable more universal
object and try to build things in terms of that
and just for comparison
there are just slightly fewer tinker toys
in Danny Hillis tinker toy
tic-tac-toe playing computer as
there are in one of these proteins so so
a protein you could imagine assembling by hand but you could not imagine assembling
a bacterium by hand
okay got aggro on
okay
so here's a
piece of context that
I always like to ask students about
so here's an interesting thing
about all of us is pretty
much from the time we were born every
person in this room was praised for being bright
right
we just talked up a
storm and we were interested in this and we were so
clever and we were encouraged most
of the time to be clever
it
seems like a good thing and maybe it is because here
we are but imagine
being born with twice the
intellectual capacity of Leonardo
smarter than any of us no
question twice the
intellectual capacity of Leonardo but in 10,000
BC how
far are you going to get how
far did Leonardo get Leonardo could not invent a single
engine for any of his vehicles think about that
maybe the smartest person of his time but he's born in
the wrong time his IQ could not transcend
so IQ is
really not worth that much because
talking about vehicles here's
Henry Ford nowhere
near Leonardo but he happened to be born in the right century
century in which people had already done
a lot of work in making mechanical things and so
it was Duck Soup to make a car that worked and sell
millions of them for four hundred and seventy five
dollars apiece and of
course we have Daimler and Benz here
in Germany so basically when you born at
the right time a whole bunch of things are open to you
so knowledge in many
many cases just Trump's IQ
I
and this is because
there are certain special people who invent new
ways of looking at things so
Ford was powerful because Isaac
Newton changed the way new with the way Europe thought
about things so he changed
an entire way of things and it's one
of the wonderful things about the way knowledge works if you can get a supreme
genius to invent calculus those
of us with more normal IQs can learn it
so we're not shut out from
what the genius does we just can't
calculus by ourselves but once one of these guys turns
things around the knowledge
of the era changes completely this
is why in the United States at least computer science
is almost dead because
of course I would get a lot of argument about that because there are
many people there but the
outlook there has gotten pretty weak
and so the way I think of it
is the
outlook at you have on something is what is
going to give you those extra IQ points but
have a really powerful outlook the knowledge you'll gather
will be powerful and then if you have some extra
brights if you happen to be clever
when you have those first couple of things then
you can be very powerful
so I think of knowledge
as silver and outlook as gold
and IQ is kind of a lead weight
this is killing
computer science because a lot of people in computing don't
bother learning anything because it's
not that difficult to learn how to program badly
right and you can be clever and
write a program in JavaScript to do lots of different
kinds of things the problem is you there's no
place to go with it
so when I look at our field today
from this 50-year perspective
well
looking back I would
say the absolute number of four
four and five Sigma IQs is
actually has actually increased
so if we were to take all
of the people in our field vastly
more and look at the superbright there's
just more than there were 40 50 years ago
but the relative number is much
worse because the
total number is increased tremendously and the
number of the superbright is not increased commensurately
and so there's an enormous amount of noise
from the middle today in the field
an enormous number of artifacts from them
similarly there's
a lot more knowledge of computer science today than there was
40 50 years ago
but the general knowledge of
the practitioners has only increased a little bit the
level the small size
of this increase is almost staggering
given what
there is to know that has been written
down in various places and
then the
number of outlooks that are powerful
has gone way up
over those years and
but the general outlook is hardly more powerful
than it was I'm talking about programming here this
is quite static so something
something is going on that reminds me a lot of pop music
right there if
you sit down and learn music there and
look back over the last six centuries and
it's just some of the most incredible
talking just about classical music I'm talking
about jazz any kind of develop music it just
amazing the riches that are there
yet pop music uses 1/100
of 1% of that and
so I think what what's happened is computing
has turned into a pop culture and
the universities are not helping
in general at least in the u.s.
so Cicero anybody
know a good quote about Cicero having to do with
present and past let's
check out your classical education here
so you know who Cicero was
he was one of those old Roman guys
so Cicero once wrote
he who knows only his own generation remains
forever a child
and
basically what McLuhan
is saying here is we tend to be trapped
in a single conception of the present
makes it hard for us to see it in any terms except
the terms that led up to the present that we're in
and he said and
that means it's hard to conceive of a future that
is an incremental on the present makes
sense right the president is
overwhelming to us and there are all these little things that we can do
a little bit better on it
that gives us a kind of a model that's like this
so
here's some rain falling outside making
a little gully by random
and it happens that a gully by random
just happens to be more efficient
at making the gully bigger so
if you just let that go on for a bit you
get these guys there's no
reason for where these are just some
random rain disturbing some things
there but once it got set up it
got interested in itself just
like our brains do so this
is not a bad model of the way human memory
works we start learning something it was very hard
for us to see what else is going on and
so there's this famous picture of Conrad
Lorentz who discovered that the first thing
a duckling saw when it came out of the egg it thought was his mother
and so if Lawrence
arranged it so he was the first thing they saw so
the little ducks would follow him around and when he
went out swimming they'd follow him around and so
I think that's the way people often approach well
your first programming language right
so probably the most disastrous thing
learn is your first programming language even if it's a good programming
language and the reason is is it's tends
to become computing and
so it might be a better idea to learn two or three
programming languages at the same time even though that's a different
kind of struggle but at least relativize
what people think computing
might be so we got this present
it
comes out of one set of things in the past that
we're daily aware of it
gives rise to an incremental future this
is a lot like academic paper writing in the US
I don't know whether you have to do it here but so
almost all the papers written in in the US and computing
academia are counted so the University
of California counts all papers written by
academics they don't care whether the papers are good or bad they
don't care whether a professor
has a really great idea every five years they
do care if the professor writes 10
or 15 or 20 papers each year
and the same with graduate
students because graduate students are taught to follow in
this mold and often the professor has his name on that very same paper
the graduate student in increases his count
so there are a lot of factors here
but the truth is that the
past is vast
enormous there are billions
of people contributing to the past and every
time we think the present is real we
actually cannot see the rest of the past
so we have to destroy the present
one of the ways of doing it is to
try spend a little time each day trying
to think of what you take as reality as
being just a result of
that rain falling on the ground and
being intensified
get rid of it
once you get rid of it
it's a scary situation
because you've said I'm not going to have anything based
on the course that's not possible you're
just trying but sometimes you get
a little feeling this
is not an idea it's just a feeling
it's like
an odor of perfume
but the fun thing is that little feeling can
actually lead you to look in the past in different
places then
you would normally do and you can bring those up
to that feeling and once
you do that that feeling starts
expanding into a vision and the
vision expands into an actual idea
so this is one way of doing
it and some of the most creative people I know actually
operate this way this is where these ideas come
from that are not just incremental to the
present they come out of
vague even muscular sensations
that you have to go chasing to try
out what they are you try and get the idea too early it
can only be in terms of the present
what we do
so everything that human humans
make is technically technology
so I'm going to and we
have a different meaning for technology so I'm going to change the
Greek root of technology is technique
technique means whatever human make
humans make don't let's call it the arts
and
in the arts we have tinkering I'm
going to do these in historical order so
mammals are creatures who tinker especially
primates especially us and
engineering is a kind of principle
tinkering so
it came before math and science
what does it mean by principles
if you don't have math and science well if you build a building
and it falls down you just build it with twice the
cross-sections of all the beams you don't need any math and
if it doesn't fall down you write it down in a book and
you wind up with this big cookbook that by
the way is the way Babylonians did math the
Greeks hated long books of things like that that
led them to invent the company math we use today
that came next
science as we know it today came
about 400 years ago so
anybody here know how
long our strain of humans has been on the planet
how
long have we been here this is it's kind
of important isn't it for context
so you know about so
it happens that we inherit more from our mother
than our Father because
mitochondria and its
DNA don't fit into sperm but they do fit into OVA
and so when
we got a fertilized egg we cannot only get the union of
the two nuclear DNA s
but we also get the female mitochondrial
DNA and mitochondria are a
little bacteria that were captured a long time ago
to help with energy production in cells they were originally separate
organisms so it turns out you can actually
run computer simulations
on the amount of change in the
female line of humanity should
do this sometime because it's kind of interesting and it
turns out that if you run it back we were all defendi
descended from one female
now of course there are other females around back then but
that female lived 192 thousand
years ago so our particular strain
of humanity has been here but for about 192 thousand
that we only invented science
400 years ago
that's how dumb we are think
about it that's why IQ doesn't count
we never were smart enough to invent science
we blundered around
amusing ourselves with stories for
hundreds of thousands of years so
almost everybody in these fields winds
up doing a combination of them and you kind of want to be in the sweet
spot you want to do a little tinkering a little engineering
a little math a little science and really
difference between the fields is more of temperament than the kinds
of things that you learn some people are idealist
some are pragmatists
now if we look at computing
it's mostly tinkering a
little bit of engineering
maybe a little math hardly any science
and when we say engineering
we don't mean real engineering real
engineering uni Empire State Building in New
York was built in less than a year by less than three thousand people
including dem Demmel it demolishing
the original site and occupancy
so it's built at the rate of two stories a
day the steel was still
110 degrees 40 degrees centigrade when
it came from the factories in Pittsburgh
to make the Empire State Building
that's Engineering so whatever it is we do is
like maybe what Egyptians did making
pyramids piling things on top of each other but
in computing we
could not organize 3,000 people to do a major
thing in less than a year right
have you ever heard of it ever
No so
the word engineering seriously and I do I
don't mean it as a metaphor I'm
saying engineering let's not do away with
engineering has meant the last three or four thousand years we
take that word seriously we haven't got it yet in
software we really
don't know how to do it okay
so this is my favorite hairball
it's actually from
a woolly mammoth so that's a big
hairball I'm
gonna get rid of it because but you
something complicated I'm going to replace it with stars because
nicer to look at but if you think of we're given
this phenomena that's the basic
thing it could be a hairball it could be they're
hairballs and what we want to do is make sense of
it in science and we
have language which is computer
scientists you know can all be made out
of the operation NAND or nor which
invented by a guy by the name of Charles purse in
the 19th century so
we can make all things having to do with language out
of that one operation and
what we
want to do is to come up with something in language
that closely mimics mimics the phenomena
that we're interested in and forget in
fact because of the limitations of our brain that's
about as far as we can go because the brain contains
various kinds of languages that does not contain stars and
so we're interested in the relationships
between those so the reason
I'm explaining this is because when I ask graduate
United States what is their meaning of computer science
they always give me an engineering definition which implies
that they have no idea what the word science actually means this
is what it means
but science
doesn't care whether nature made it or whether
humans made it so we can take a bridge do
exactly the same thing
make a t-shirt explains
how this bridge works and what's cool about engineering
is once you make that t-shirt you
can make another bridge get
hose engineers to make more interesting bridge for a scientist
to look at and you can take
this rather far those are
my favorite bridge in Japan longest
suspension bridge in the world and to give
you an idea of how big it is
there's the Great Pyramid of Egypt and the
Empire State Building next to it so it its towers
are actually the size of the
greatest building created in the early 30s
this is some kind of bridge
makes
you feel good to be an engineer at least it makes me
feel good because I this is you know the
ability to really make engineering and science
harmonize with each other there's no greater
so computing we've
got computers we got software here's
John McCarthy he
the abstraction of all that stuff on a t-shirt that's
the Lisp interpreter in itself one
of my favorite things for more than 50 years
ago 1958
if you don't have
a little tear in your eye when you look at that you're missing something
really really important about our field this
is like one of the greatest things that has ever done because
the same thing with the bridge once somebody does that
man you
can start inventing things that are much more
you can invent computer things that are like
like living things and make
Internet's and so forth so this is
really cool stuff and you
can also look at personal computing and ask
how many t-shirts we
Empire State Building worth of code from Microsoft
but we should ask how many t-shirts does it really take
and so one
of the things that we've done in our approach is
finding that problem difficult
it's really hard
thing through because geez we
murse tin this stuff it looks large it's
complicated so
what you can do is make
a little Frankenstein's monster of
a system it isn't
the one you actually want exactly but it's
kind of cute and it's kind of scary and
if it's also kind of small then
you've actually made the thing that will allow you to think
about this other
guy
and Olay enable you to make a baby step
towards capturing millions
of lines of code in a few
tens of thousands of lines of code
that's one of the things we've been doing so
my website the website of
viewpoints search Institute is Vpr
i.org and
there you will read
more about this project and I'll just show you
one example here
from a bunch of principles
one will be the math wins one
tiny Model T
t-shirt programming and a little bit of particles
and fields so this is one
of our colleagues dan amma lang and
he was charged with the
goal of doing all of the computer graphics that you see
on a personal computer and so
that's several millions
of lines of code for instance we took Cairo as an
Cairo is the rendering system and composing
system that's used by Firefox so
it does most of the graphical tricks a few million lines of
code and turns out dan has a mother
and his mother as
high school geometry teacher and she asked him well what are you doing son
a few years ago and he told her and
they sat down didn't come back to work sat
down between Thanksgiving and Christmas and worked out a new way
of thinking about the involvement of arbitrary polygons
with pixels in
math and it looks like this
so this is the formula they came
up with so with that this is without any super
sampling or anything else like that you just execute do what that formula
says and it will give you the exact shading for
perfect anti-aliasing so
of course you can't run that formula so
the next thing he did was to make up a language
there was rather like this mathematical
language but which was executable so
you can think of this as a domain-specific language
although it's fairly general and
it has math in it it's stream-based
it's highly parallel
and so forth and these the 40
lines of math over here comes out to
be about 80 lines of runnable code now you can run
it
and you get
something like this so the
rendering part will render high quality
characters and simple shading and
and so forth like that so so that's 80 lines
of code and of course
there's more features and Dan also has
a brother and this brother is very
good at math also so he and Dan one summer made
up the 26 standard
compositing rules that are used in
Cairo and all of them together was
about 90 lines of code all right
because if you think about it if you don't worry about optimization
or anything else like that the mathematics
here in the right kind of language
it just falls out you're actually
down what a mathematician to write down is the actual relationships
and you get each one of these
things does a different compositing there's the rendering
stuff sampling for making pictures
pen stroking so
the total today is a little bit under 400 because
we added a few more features to it but
basically all of the graphics that were used
to in 2d on a personal computer
can be done in under 400 lines of code okay
that is a big difference compared to maybe
one or two millions of lines of code in Cairo like you
can look at all of it 400 lines of code is just a few
pages well as a hitch
and I'm going to end this talk with just
we get written the hitch of course is you have to make this language run
right so you don't want to spend three
year you'll come up with the perfect language and
then spend three years trying to get it run so you have to have
another language and
this is based out of a paper
from 1964 about how
to make the swirls
simplest compiler compiler done
by a guy at UCLA Val sharee
and we did a modern version
here's Alex Werth who did it and so
the parser for making
the graphics language is 130 lines of this language
which is called Omata and the
the optimizer
and the compiler to a language like C is
another seven hundred some-odd lines so that's what it takes
to make the graphics language so it's a little bit
larger but the nice thing about this compiler
compiler language is you use it for each of the domain-specific
languages that you're making things from and
of course you have to make that language but
what's nice about it it can make itself and it can make itself
in only 76 lines of code and it can optimize itself
in 30 lines of code so you get the idea here all
right so the idea here is that each problem space
has a particularly
felicitous point of view
point of view is worth a D IQ points if you find
point of view you're going to be able to write down the
relationships more or less directly
and that helps you think about the problem you're working on and
then if it's easy to make that domain-specific language
you just came up with run you're
in business because all of a sudden you've got a system
that's actually it's actually working so
I'm gonna so we're out of time
here and I think I'll leave you
with that I was gonna I think that's more than enough information
but this is I think one
the points here that's interesting is that this idea
is not only not new today that's
why they're called dsls today it's a
term we have today turns out this idea was in full
flower 50 years ago nobody
knows about it today because the terms change it
were called problem oriented languages 50 years ago POS
and for
a variety of reasons this whole technique of
making software systems very quickly and very
in small form got dropped
when the commercialization of personal computing
happened in the early 80s note it's not
taught as a as a major technique and very
few kids in the United States know that it's easy to make a
compiler compiler language that is much more general
and much easier to use than say yak so
you learn yak and you're convinced that it is
hard to make a language but in fact yak is bad
the actual techniques of making a
language or actually run much easier to do so
let me leave you with this idea
whatever it is that we think we know today
we should shut it off periodically and
see if we can find other things to learn about thank