LongCut logo

The Value of Values with Rich Hickey

By InfoQ

Summary

Topics Covered

  • Place-Oriented Programming Made Sense Once
  • Values Aggregate to Values
  • Facts Are Values, Not Places
  • Programmers Already Use Value-Oriented Systems

Full Transcript

[Music] uh so the value of

values who here Works in it everybody I think right uh what does that mean what does that stand for

it Information Technology yes so uh yeah or other things so uh so what do we mean when we say information uh as you may know from my

other Keynotes all I do to make a keynote is I use my dictionary because my dictionary has all the answers my dictionary says information is based on the word

inform which means to convey knowledge via facts and the purpose of that is to give shape to the mind and information is just those facts that's what

information is information is facts so what's a fact a fact is a place where information is

stored and what's great about that is that there's a place for every piece of information and facts have operations like get and set and they may

have other operations and uh those operations control how facts can change and the other great thing about facts is that they're they're it's easy

to convey them to convey a fact we just convey its location how many people are uncomfortable right now I am this is not true right this is

wrong everything I just said was wrong dead wrong and you should be uncomfortable this is not what facts

are right so are facts places well what's a place again back to the dictionary a place is a particular portion of space

and space is an important word uh we're going to dig into later uh and in particular the the part about place that matters is the fact

that it's sort of delimited right there there is a specificity to the to the U to the location named by a place or vice versa and we know about places right we

have good uh examples of places in our everyday work in programming right memory addresses our places dis sectors or places they have you know

addresses and we can go to them and we can substitute their contents with other contents and we're very familiar with this notion of a place but I think it's

quite important to think about whether or not with these memory addresses and dis locations we're actually building information

systems that are about information as we just defined it in particular we use memory and we use objects typically

especially at this conference and mutable objects are nothing more than abstractions over places they're little abstractions that are over places

especially you know well in particular mutable objects and they have methods just like the thing I talked before about about facts having methods and objects have methods and this is the

this is the core thing we're Building Systems out of and on the other side on the on the durability side we have the same kinds of Notions we have tables and documents and records all of which are

places all of which have an update notion right the notion of going to the place and setting it to be a new value right these are the these are the

underpinnings from which we build systems but we we're sort of making abstractions on top of them that don't hide what they're about and and I have a word for this I

or a term for this which I call plop Place oriented programming which is what this is and you can tell when it's going on because anytime new information

replaces old information you're doing Place oriented programming there's a reason we do Place oriented programming because way back in

the early days of computers we had to do Place oriented programming right I saw a guy steel to give a great talk where he was talking about working you know

building these systems on a a a computer that had four kilow words of memory and every piece of memory you knew the address you knew that the even number

addresses starting at 2000 were used for a jump table these other addresses over here were used for data and other parts of the addresses were used for code and sometimes they were used for more than one thing because you knew like right

now no one's using this for code so we can use it for data and vice versa you had to do it right there wasn't enough capacity to do anything else computer memories were really small discs were

very small everything was very expensive right so we adopted an approach to programming that was based around the manipulation of places it totally made

sense um and and the key word there the key aspect of that is it made sense it used to make sense right those limitations are gone in the

time that I've been doing programming the capacity of these two things have increased a millionfold a millionfold what other thing in life you

know has the same facts about it um remain true when the size of something changes by a millionfold imagine if your car was a million times bigger than it is what rules would still be would still

apply what characteristics would still be true almost nothing but yet we're we're retaining decisions we made when things were much much smaller and and

and moving forward with them so why does plops still rule it's the key question here right when we talk about Place oriented programming we ofer talking about these two things memory and

Records right um these words had meanings before we had computers yeah right and we've we've taken them

over we've said uh you know memory means addresses in in RAM chips and Records mean you know slots in in database tables uh and worse than just taking over these words because obviously

there's a limitation to the number of words and the analogies roughly hold right the analogies between memory and memory and your head roughly hold U but

the problem is we we've now been doing this for so long that we believe our own myths about what these things mean but we should go back to the facts of memory

and Records right the fact of memory is that it's an open system right if your friend gets a new email address right that doesn't go into your brain and find

your friend's email address cells and replace his email address in that part in you know those neurons in your brain that's not how brains work that's not how memory Works memory is essentially

an open system and it's an associative system it is not an address based system right same thing recordkeeping we used to keep records before we had

computers what did we do you know we took out the stone tablets and we chiseled a thinger we took out the Papyrus and we wrote stuff down right when we had new information what did we

do we did not go and like Smooth over the marble and chisel new stuff we didn't go to the Papyrus and take out erasers and things like that and people built accounting systems before there were computers and they didn't use

erasers either right what did they use double entry accounting and Ledger based accounting they only made correcting entries they did not go back with AAS ERS that's not the way things worked

before we had computers so this talk is about values so it's another term we should Define and again we just go back to the dictionary there's some very interesting

definitions for Value right uh first is relative worth and relative is ends up being a very critical aspect of values right because the next thing is the one we probably are most familiar with

especially in computers right because this next definition is the one that applies like 42 right it's a magnitude it's a number it's something we use to measure something else and that notion

of a value I think is the one we're most readily able to adapt uh but again the bigger notion of value is about meaning and about comparability and about

relative worth that's the bigger notion of value right because um because you when you measure something you have to measure it in terms of something else there's no absolute

measurements right so the comparing part is important so the question right now is is a string of value how many people think it

is I love doing the answer the questions by raising your hands because not everybody has hand apparently how many think string is not a value how many people think it

depends right you always wait for it depends right it's the best answer just so you hold out for it right what does it depend on is it immutable

right if the string is immutable it's a value if it's not immutable it's not a value right how many people worked in programming languages or still do where strings were

mutable how many people want to go back no we don't like this and and it ends up that this uh that this equality notion of value because right now string

doesn't measure something right it's not a magnitude or an amount it doesn't correspond to that definition of value um but it ends up that an immutable

string is a comparable thing right and comparability is where we derive um our ability to do logic and to make decisions right until we can say is this the same as it was yesterday is it

greater or less than what it was you know does the string label this thing correctly you know according to my understanding of it um or anything else we do with information that

comparability and equality test is sort of at the bottom and that goes back to that other notion of value so we really don't we really do not want to go back right so now we want to sort of talk about values not from the

dictionary definition but very specifically in terms of what we do in programming and and there are lots of nuances to this but for the purpose of this talk given it's a half hour I'm

just going to focus on two values are immutable right and values are semantically transparent is the purpose of a value is to expose itself to you so

you can do that comparison and that equality test right value is not about encapsulating something and methods and and doing things right a value is about

saying compare me to something else I'm telling you what my what my um what my precise meaning or significant is significance is right on the label right

on the outside that's what a value is about so you know the reason to give this talk is to talk about sort of the propositions of the value propositions

of values what makes values good um and originally this was an hour long so this is going to go a little bit fast but there's a bunch of characteristics of values that are

valuable the first is that values can be shared right if you have a value if you have an immutable thing can you give that to somebody else and not worry yes you don't have to worry do they have to worry about you now because

you both now refer to the same value anybody have to worry no right so values can be shared that's very very valuable values support reproducible

results right if you define a function in terms of values every time they call that function with the same values will you get the same answer yes if you define a function in terms of places every time you run that function will

you get the same answer no right it depends on what's in the place right reproducible results really matter they allow you to run tests and reproducible tests so many people are running tests

now of of places they don't tell you anything they don't tell you anything they're all conditional upon your ability toing bring that place back to the same place to the same value right

another critical aspect of values is that they're easy to fabricate right you can make up a value from scratch in any programming language quite readily right can you make a string in any programming

yeah can you make a list of strings sure a list of numbers yeah a list of a list of numbers yeah a map of a list of numbers yeah right can I make an instance of your fancy interface in any

other language no right it's not easy to fabricate that it's not easy to make programs that write programs it's not easy to make programs that write tests if your if your programs are not based

around values so the fact that values are easy to fabricate um is important all right values are language independent

Right started to talk about that already right the notion of a list or a string or a number or a map this has nothing to do with the programming language those things I just said nothing at all right

nor any of the Aggregates of those things has nothing to do with that they're generic right these ideas the the Notions of values are

generic right uh and I think it's it's something that we don't think about often enough in our programming designs and our systems about the actual costs

of specificity right we love specificity we use Java every new idea gets a new class every new thing gets a new thing right what does that cause to

happen you get this explosion of code just a tremendous explosion of code objects were supposed to support reuse they've done the exact opposite thing especially in typed languages you get

very little reuse because you make a new thing every time and what does more code mean more code equals more bugs right away another interesting

thing about values is values aggregate to values and this is something I really want you to focus on right we talked about 42 we talked about a string we talked about sort of atomic thing right

but a list of immutable things is itself an immutable thing and so on and so forth so as you build Aggregates those bigger things are also values and I

think that we tend to stop we say of course string should be immutable but an immutable collection I can't even comprehend it but you should right it has all the same um desirable attributes

that that immutable string did nobody here wanted to program with mutable strings anymore why do you want to program with mutable collections anymore you shouldn't and there's really

important um uh benefits you get from doing this for instance compare it to objects if you have an object and you want to share it what do you have to do you have to define the object you have to find an interface for it and

everything else but then you have to do what what if it's in a concurrent environment what do you have to have for that object some sort of locking policy right very very difficult thing in fact a lot

of languages don't give you any resources for defining it well right it's like there's this napkin and on it we've defined how we're going to use this object right but if you've done that and there's also other kinds of

problems like how do you copy it what what are the cloning semantics whatever you let's say you've done that work and you've done that work for every one of your classes right and now you build something that's a composite of those

things do you get a lock policy from combining them no it all falls away you have to do it all do over again this composite of all these things for which I have lock policies now no longer has a

lock policy I have to come up with a new one I have to come up with a new cloning policy and everything else over again values aggregate to values all the benefits apply to

Aggregates um there are other um benefits you get from values and we see these all the time right values are easy to convey right if I have some piece of information I think is useful I can send

you that value and I know I've communicated to you what I was seeing right if I see something interesting and I communicate to you the place where I

saw it what have I actually conveyed to you nothing right not the information that's for sure because you can go look at that place and see something totally different from what I saw it works the

other way as well right when I want to perceive something right if it's a value I can take my time and look at it right especially if it's a set of values right

if it's a composite thing if I want to perceive something that's based around places how how do I do that there's a bunch of places I want to sort of look at it what do I have to

do I have to stop the world please stop while I look at these places because otherwise I'll look at one and as I turn my head to the other something will have changed by the time I've sort of perceive the whole thing I don't know

that I had anything consistent I don't know that I'm making a decision based on anything consistent and this also goes to memory right how do you remember anything if you encounter an object during the the

course of your program running and you want to remember it what what do you do do you just store the

reference not good enough right what do you have to do clone it how do you do that depends exactly it's a

pends okay so the other thing I want you to do is start thinking bigger bigger than your box bigger than your process right because these value propositions extend to your

systems right and in particular values make the best interfaces now here I don't think we have any arguments I think we're already doing this right what do you send around on the

wires anybody still using corba or decom no no they died for good reasons right we now use values right we send

around Json or XML or you know if you have to but both are both are um representations of values and that allows us to build interfaces to things

that are easy to change on both ends the other aspect of values that's very interesting especially in the large but it's also true in the small right we talked about how do I perceive something I have to lock the world down that

applies in the large as well how many people ever have heard of read transactions yeah how many people like read

transactions no right the whole idea is is counterintuitive and violates physics right in physics we just look at each other we we don't have to stop

everything in order to look at things so when we're programming with values and using values especially in storage we again have reduced coordination and another benefit we get

is location flexibility right if in the small you build a system and the system is defined in terms of uh processes that are communicating values and you decide you know what that part of the system um

I want to rewrite that in a faster language or I want to run it on a different box is that straightforward to do if you're using objects and specific things related to your programming language if

I if I'm passing Java interfaces it's easy for me to rewrite or let's say Ruby interface is it easy for me to write rewrite that in Java no right right we we know we we don't do this in the large

right in the large we don't do this in the large we communicate values but in the small in our programming language we start doing icky things and those icky things keep us from being able to move stuff we can't move it to another thread

we can't move it to another language we can't move it to another box but if we're using values we can that I would call location flexibility so let's get back to inform

uh information technology and back to facts so the first fact about facts is that facts are values right they're not they're not places right that slide up

front was a lie everybody's sitting there saying but don't facts change right don't we have a president at one time then we have a new president

president no they don't because facts incorporate time how is that what does that mean

again the dictionary knows everything because what does fact mean fact means something that happened something known to have

happened or existed it comes from Latin and it comes from a past participle in Latin that means something that happened a fact is something that happened

happen it's not a place it's not something you can change right Bill Clinton was President the fact that he was President will always be a fact we can have new presidents that's a new

fact just like you can have new email addresses right the other thing about facts is that it's very important when you consider facts that it's

insufficient for you to consider recent facts and again we'll get back to the whole point of information right information is to inform right so that

people can uh convey knowledge but knowledge is derived from facts right when we when we try to make decisions we compare times we compare

two different things we combine facts and especially we use different time points imagine if you only knew the present value of any property or attribute in

the world how good would your decision-making capability be be it would be awful it would be absolutely terrible and yet we are

building systems that only know the most recent set of facts we don't know anything else but we're supposed to be making information and decision-making

support systems right so the bottom line is you can't update a fact right and the reason why you can't update a fact is because you can't change the past and that's what facts are they're

documentation of the past so let's go back and sort of revisit what would it mean to build information systems that are about information it would mean that the

systems would be fundamentally about facts they would be about maintaining facts manipulating facts right and presenting facts to users to give them leverage right so they can make

decisions now we think we're doing this right when we're in Information Technology we think we're building systems that are decision support systems right but we're not using

infrastructure that's fact oriented right in in in the most bottom level notion before you even get to the temporal aspect of facts we should certainly be building systems that are

value oriented now that's not to say the programming languages shouldn't have process oriented constructs of course they should but we don't distinguish

them right if you look at any program it's going to have sort of two two different parts right there's going to be the part of your program that's sort of like a machine right it's got a

loading dock and stuff comes in you put it on the conveyor belt and it moves and then it gets sorted and gets split and some stuff goes over here and some other stuff goes over there right all programs have this aspect of themselves which is

process oriented and it's sort of like a machine right and we build programming languages that make allow us to use constructs that are analogous to Little

Machines they do stuff the problem is we apply that technology to everything including to information and information is not a little machine

it's not at all like a machine and so you have to separate out these process constructs and in particular one of the big takeaway should be that place right that all of your constructs related to

place have no role at all in an information model right they are artifacts of the way computers work they have nothing to do with what your software is supposed to be accomplishing if your software is supposed to be

accomplishing information management and decision support so one of the great things about this talk is I

think you all already know this right right because we do decision- making right we know what it takes to support our own decision making we're constantly

comparing the present to the Past right we're trying to spot Trends we're trying to see the rate of change we need to add stuff up that's happened over time we

almost always need a temporal aspect right so how can I tell you I know this is true well it's it's really straightforward we're programmers we have stuff to do we have our own little

businesses right we make stuff what do we make what are we act what's our concrete artifact we make source code right and then we have an operations aspect to

what we do what do we do we run our programs and we maintain information about both these things let's look at programmer it let's look at our own it

systems the ones we build for ourselves Source control is it updated in place how many people use a a directory on the file system for Source control and when you have a new when you have a new edit

to your program you just put it in the directory you really don't want to raise your hand no of course not it's not update in place anybody use a source control

system that doesn't have dates and times on stuff no of course not how would we possibly know what we were doing how could we possibly make the decisions we need to do to run our little software

business business if we didn't have this information no way okay what about our operations it we run our systems what do we do with our

running systems we log we log and log and log we we keep track of everything that's happening right anybody use an update in

place log anyone use a log that says the last latency was five yeah no anybody use a log that doesn't put

time stamps on every entry no of course not how could we possibly understand what our systems were doing right if we didn't have this information how could we make decisions

we know there's no way no way so we don't do this so big data it's all

connected what is Big Data I will contend that a certain percentage of big data is this it's businesses telling programmers that data database you have I like better than the one you gave me

because the one that you gave me only remembers the last thing I told it and your database your logs they know everything that happened in our business you know everything you have times for

everything let's go mine that find so find some good business decision-making information because my database it doesn't have it it doesn't remember the last it doesn't remember anything other

than the last thing right the logs have all the information the logs have the time stamps but I think it's really sort of shame here because we're being

reactive in this area right mining logs we know much better ways to represent information we know how to store information in ways that's leverageable right logs are not that map reduce over

logs are not that logs are full of crap too right they're full of stuff about the program operation itself there is business value information in there we haven't built databases to store that

yet um but that's our that's sort of our fault so I think we're moving into what I would like to call the space age right one more definition space the

Unlimited expans in which all things are located and all events occur what's really interesting about the definition of space is that it has always if you go back to the oldest

definitions in the oldest languages the definition of space has always Incorporated both place and time it's never been something that applied only to one or the other of those two things

it's always connected the two and there's a certain physics aspect to that so if new never fails if you can call new day after day 247 over and over and

over again you are not running in a place you're running in space you're not seeing the edges of things you're not delimited you need new

stuff you get it right if S3 never fills up that's not the cloud that's space right if every time you want to put a file on S3 it says

sure are you worried about the edge of of it right most of the times we don't worry about the edge of space I mean maybe you do but I

don't so Information Systems should have a different approach they should say that new facts require new space right this should be the end of place oriented

programming we've had the facilities to do this for a very long time right if you could afford to do this why would you do anything else anybody feel like I wish I could log but I

can't my disc is only 5 megabytes everybody anybody ever have a 5 megabyte disc cost thousands of dollars yeah it's not that's not that's

not that way anymore right right so you can afford to do this right lots of interesting things will happen when you take this approach a lot of the things that happen in memory with

garbage collection are going to happen with storage right there will be G garbage but that's okay right these are things that we're learning about how to

manage so to summarize unfortunately I think we continue to use Place oriented programming um and the rationale is gone

and the the sadder thing is we continue to make new things that are like this brand new programming languages and brand new databases right that still take this approach still use a place

orientation that's been invalid for at least a decade but certainly for the last five years right the rationale is gone we're missing out on all those

benefits I listed before and I could talk to you about any one of those benefits for an hour there's a huge number of benefits to to using values we recognize them right look at our

information systems for that we use for ourselves we're proving we already know this right we don't overwrite our logs we don't override our source control we're already we're in the space age for

ourselves but we need to be in the space age for the businesses we're supporting right there's definitely demand for this this whole big data push and Mining logs and everything else and tracking everything and keeping the time of

everything businesses know there's tremendous value here they want it the demand is quite obvious we have the resources to do it and I think that the

challenge is to make sure that we do and what I would recommend is that you try to take an information oriented approach to the way you build your programs

[Applause] [Music] thanks

Loading...

Loading video analysis...