9:59:59.000,9:59:59.000 I want to thank everybody for coming. [br]The title of this talk is Clojure, Made Simple. 9:59:59.000,9:59:59.000 On the brochure, they left out the comma. [br]So it's not "Clojure made simple" 9:59:59.000,9:59:59.000 In other words, a tutorial on Clojure, [br]or an easy explanation of Clojure. 9:59:59.000,9:59:59.000 It's not actually a comprehensive explanation of Clojure at all.[br]But I'll look at a slice of what Clojure's about. 9:59:59.000,9:59:59.000 And a way of thinking about why you might want to use it. 9:59:59.000,9:59:59.000 So, I am the person who made Clojure.[br]I currently work on a database called Datomic, 9:59:59.000,9:59:59.000 which is kind of a functional database. It was written in Clojure, it runs on JVM architecture. 9:59:59.000,9:59:59.000 I'm a co-founder of Cognitect, which builds Datomic[br]and sponsors the development 9:59:59.000,9:59:59.000 and stewardship of Clojure.[br]But the main point I wanted to make about myself 9:59:59.000,9:59:59.000 to this audience was because in this talk I might[br]seem somewhat skeptical of Java and 9:59:59.000,9:59:59.000 object-oriented programming, is that I've done and absolute ton of that. 9:59:59.000,9:59:59.000 That's what I did for two decades before I said, 'if I still[br]want to be a programmer, I don't want to do it 9:59:59.000,9:59:59.000 this way anymore.'[br]So I know exactly how apps are built using Java 9:59:59.000,9:59:59.000 and C++ and C# because that's what I used to do. 9:59:59.000,9:59:59.000 That doesn't mean that what I think about them is correct,[br]but that's my experience. 9:59:59.000,9:59:59.000 But I'm wondering about you.[br]How many people program in Java here? 9:59:59.000,9:59:59.000 How many people are happy about that?[br]How many people are actively unhappy about that? 9:59:59.000,9:59:59.000 I'm looking for alternatives.[br][laughter] 9:59:59.000,9:59:59.000 Okay, great. How many people have tried Clojure at all? 9:59:59.000,9:59:59.000 Ok, great. How many people have never heard of Clojure and are in the wrong room? 9:59:59.000,9:59:59.000 [laughter] 9:59:59.000,9:59:59.000 How many people have tried Clojure and are trying to get to use it at work, but not yet? A few. 9:59:59.000,9:59:59.000 Maybe this talk will give you some ways of talking about Clojure's value proposition that could help you. 9:59:59.000,9:59:59.000 How many people actively use Clojure?[br]and somehow are accidentally at JavaOne? 9:59:59.000,9:59:59.000 [laughter][br]Okay, and the rest couldn't get into Brian Goetz's talk. 9:59:59.000,9:59:59.000 I shouldn't even mention that Brian Goetz has a talk [br]right now, because we're going to have people 9:59:59.000,9:59:59.000 filing out. Or maybe you're just tired of[br]Brian Goetz talking about immutability. 9:59:59.000,9:59:59.000 In which case, you're definitely in the wrong room.[br][laughter] 9:59:59.000,9:59:59.000 No, I like him. Brian's a good friend. And his talks are great.[br]So I appreciate your being in this one. 9:59:59.000,9:59:59.000 So, there were very few people who had never[br]heard of Clojure. So I'm not going to 9:59:59.000,9:59:59.000 spend a lot of time on it.[br]Oh, I had one more question: 9:59:59.000,9:59:59.000 How many people have talk, "Simple Made Easy?"[br]How many people have not? 9:59:59.000,9:59:59.000 Okay, a few. So, I may spend a minute describing what[br]I mean when I say 'simple.' 9:59:59.000,9:59:59.000 Clojure is a programming language[br]that runs on the JVM and JavaScript. 9:59:59.000,9:59:59.000 And a substantial subset of Clojure runs on JavaScript.[br]So it's a programming language with which 9:59:59.000,9:59:59.000 you can target both.[br]But originally it only targeted the JVM and the CLR. 9:59:59.000,9:59:59.000 There's still a port to the CLR that's maintained, [br]but it does not see wide use. 9:59:59.000,9:59:59.000 I released it first in 2007. It's had surprising adoption.[br]Especially from my perspective since then, 9:59:59.000,9:59:59.000 given its characteristics. Because it's a lisp,[br]it's functional, it's data-oriented, 9:59:59.000,9:59:59.000 and it has a lot of things that make it seem[br]not like the kind of language that would succeed. 9:59:59.000,9:59:59.000 And this talk will really be about the data-orientation of Clojure. 9:59:59.000,9:59:59.000 So, a lot of the best programmers, and the most productive programmers I know are writing everything in blank 9:59:59.000,9:59:59.000 and swearing by it, and then just producing ridiculously sophisticated things in a very short time. 9:59:59.000,9:59:59.000 And that programmer productivity matters.[br]So Adrian Cockcroft was Cloud Architect at Netflix. 9:59:59.000,9:59:59.000 Now he's at Battery Ventures.[br]How many people think Java goes in the blank? 9:59:59.000,9:59:59.000 Okay. So we know, we know this.[br]There's something about Java that makes it 9:59:59.000,9:59:59.000 not suitable for this blank. Of course, he was saying closure. 9:59:59.000,9:59:59.000 And this talk is about "how could this me true?" 9:59:59.000,9:59:59.000 What makes closure different and possibly a better fit for that blank? 9:59:59.000,9:59:59.000 So the first thing I want to talk about it that I think we have this tendency in programming 9:59:59.000,9:59:59.000 to think about ourselves just a ton. And our languages, and our tools, and our techniques 9:59:59.000,9:59:59.000 are all me, me, me. What we're doing, whatever. We lose track of the fact that we're 9:59:59.000,9:59:59.000 all working for somebody else who's - or ourselves - but for a business or an organization 9:59:59.000,9:59:59.000 that's trying to accomplish something in the world and the software is completely secondary 9:59:59.000,9:59:59.000 to that task, right? It should be measured always in terms of the cost-benefit ratio, the 9:59:59.000,9:59:59.000 return on investment, right, how quickly can we get a product to market, and "is what 9:59:59.000,9:59:59.000 we're doing profitable?" If we're not doing that, we're not being good 9:59:59.000,9:59:59.000 participants in our businesses and our organizations. 9:59:59.000,9:59:59.000 So what do the stakeholders want? 9:59:59.000,9:59:59.000 They really want two things: 9:59:59.000,9:59:59.000 they want something good and they want it soon. 9:59:59.000,9:59:59.000 So, something good - we think we know how to make things good 9:59:59.000,9:59:59.000 We have these techniques and something is good when 9:59:59.000,9:59:59.000 they techniques are successful with them, right? 9:59:59.000,9:59:59.000 So when our types check and our tests pass, 9:59:59.000,9:59:59.000 we have something good. But, of course, we all 9:59:59.000,9:59:59.000 known that with out best efforts in those things, which 9:59:59.000,9:59:59.000 I'm not saying are bad activities by the way, but 9:59:59.000,9:59:59.000 no matter what we do there, we end up with programs that don't work. 9:59:59.000,9:59:59.000 We all know we have programs that type check and test pass 9:59:59.000,9:59:59.000 and they don't work. And they don't work from the 9:59:59.000,9:59:59.000 perspective of the stakeholder. In other words they 9:59:59.000,9:59:59.000 don't do what the program was supposed to do, and what is was 9:59:59.000,9:59:59.000 supposed to do was conveyed between people or through 9:59:59.000,9:59:59.000 documentation or papers or things that are not in programming languages. 9:59:59.000,9:59:59.000 They have to meet operational requirements, and they have to be flexible. 9:59:59.000,9:59:59.000 Now there are some times when people just want something soon 9:59:59.000,9:59:59.000 and they don't want something good. Now there are 9:59:59.000,9:59:59.000 actually better languages than Clojure for that. 9:59:59.000,9:59:59.000 Right? Just give me something fast, that I'm absolutely 9:59:59.000,9:59:59.000 definitely going to throw away; will not grow; will 9:59:59.000,9:59:59.000 not expand; will not take me further. 9:59:59.000,9:59:59.000 So these first two things are means, right, they're good but they're 9:59:59.000,9:59:59.000 only good insofar as they help ensure the latter three things. 9:59:59.000,9:59:59.000 So if we break it down, what [br]is it supposed to do? 9:59:59.000,9:59:59.000 Again, it's a perspective thing. 9:59:59.000,9:59:59.000 If the stakeholder thinks it's doing[br]what it's supposed to do, they're fine. 9:59:59.000,9:59:59.000 And of course, they're gonna have[br]expressed concerns about software, 9:59:59.000,9:59:59.000 what it should do, 'it should do this[br]when I push this button,' 9:59:59.000,9:59:59.000 and they're gonna have unexpressed[br]presumed things, like 9:59:59.000,9:59:59.000 'It should be secure', 'it shouldn't cause[br]the computers to go on fire' 9:59:59.000,9:59:59.000 '...because it's so slow', 'it shouldn't[br]require three new data centers,' 9:59:59.000,9:59:59.000 'it should keep running and not[br]stop for an hour every day'. 9:59:59.000,9:59:59.000 Those are sort of the unstated[br]presumptions of something being good. 9:59:59.000,9:59:59.000 But it ends up that if you build large,[br]elaborate, stateful programs, 9:59:59.000,9:59:59.000 it's extremely difficult to ascertain[br]whether or not they are going to do 9:59:59.000,9:59:59.000 what they're supposed to do. 9:59:59.000,9:59:59.000 And in fact, if you build any one[br]of those things, 9:59:59.000,9:59:59.000 if you just build a very large program,[br]or a very elaborate program, 9:59:59.000,9:59:59.000 or a very stateful program,[br]it will be as hard to figure out 9:59:59.000,9:59:59.000 if it's going to do what it's[br]supposed to do. 9:59:59.000,9:59:59.000 So one of the things Clojure is[br]oriented at is making it easier 9:59:59.000,9:59:59.000 to understand whether or not your program[br]is going to do what it's supposed to do, 9:59:59.000,9:59:59.000 mostly by making it substantially[br]smaller, 9:59:59.000,9:59:59.000 and also by making it more functional. 9:59:59.000,9:59:59.000 In terms of operational requirements,[br]there's a boatload of things, 9:59:59.000,9:59:59.000 there's a boatload of unstated[br]requirements of software. 9:59:59.000,9:59:59.000 You know, [?], can I deploy it[br]in a normal way with all my stuff 9:59:59.000,9:59:59.000 with the people who know how to[br]run my machines and everything else. 9:59:59.000,9:59:59.000 And that's one of the targets of Clojure. 9:59:59.000,9:59:59.000 Clojure was meant to be hosted,[br]it's just a JAR, 9:59:59.000,9:59:59.000 it runs in the environment, it's easy[br]to sneak in, right? 9:59:59.000,9:59:59.000 It's just one more JAR,[br]and then we're running. 9:59:59.000,9:59:59.000 But it's not a small thing. 9:59:59.000,9:59:59.000 If you wanted to adopt common lisps, say,[br]Pascal, 9:59:59.000,9:59:59.000 you would be asking your ops team and[br]your deployment team 9:59:59.000,9:59:59.000 to start manipulating something completely[br]alien 9:59:59.000,9:59:59.000 whose characteristics they [br]don't understand. 9:59:59.000,9:59:59.000 In terms of security, everything that's[br]available from the JVM for security 9:59:59.000,9:59:59.000 is available via Clojure. 9:59:59.000,9:59:59.000 And then of performance and other[br]concerns -- 9:59:59.000,9:59:59.000 A very important thing though is that[br]now we can also reach the browser, 9:59:59.000,9:59:59.000 so having people write applications where[br]some part of the overall system 9:59:59.000,9:59:59.000 touches the browser. 9:59:59.000,9:59:59.000 So right now, you use two[br]different things, 9:59:59.000,9:59:59.000 and I almost definitely[br]use two different things. 9:59:59.000,9:59:59.000 And I think it's the strength of Clojure[br]that we're delivering, the same 9:59:59.000,9:59:59.000 value of proposition in both places,[br]both on the server and in the client. 9:59:59.000,9:59:59.000 Even if there are separate devs,[br]the value of proposition is necessary, 9:59:59.000,9:59:59.000 and almost more so in the browser 9:59:59.000,9:59:59.000 which is one of the most complex[br]places ever. 9:59:59.000,9:59:59.000 In terms of performance, a lot of times[br]a lot of times, you might look at the 9:59:59.000,9:59:59.000 dynamic language and say 'Oh, how can[br]it be whatever?', 9:59:59.000,9:59:59.000 but Clojure is right down there[br]with the fast languages. 9:59:59.000,9:59:59.000 Admittedly, the benchmark game,[br]which is a benchmark in a game, 9:59:59.000,9:59:59.000 but it says we can reach that. 9:59:59.000,9:59:59.000 On JavaScript, we have a very[br]interesting result here. 9:59:59.000,9:59:59.000 So Om is a Clojure script library,[br]so Clojure script is Clojure on JavaScript