scale.bythebay.io: The Fun of Functional Programming Panel
Recording: scale.bythebay.io: The Fun of Functional Programming Panel
mics for everybody right ah right is Joe stage right yep I'm right okay hello all right I'm Bill vinners I've been using Scala for a long time almost ten years and no I mean over ten years I lost count so I do consulting and training and books I do Scala tests and a lot of functional programming and I have a lot of fun I'm Julie Pitt and I've been actively working in Scala for about five years but I've been fascinated by it for about ten years and there's a little bit of a gap there when I took a job at Netflix and ii kept diving into java for a while so my scala enjoyment was a little bit delayed but i've had fun since then my name is Stu O'Connor I've been doing scala for about the same about five years I got really interested in functional programming actually in college which was unspeakably long ago but and back then I thought I was really cool thing but and I was like I'm gonna go do this when I get out in the world and then it was like no one's actually doing that but I was always I was thrilled that around you know six years ago a good friend of mine said remember that cool stuff we were doing you got to check out this language Scala and I've been hooked ever since so I standard ml specifically and then when good job but then I having fun I started doing scarlet I'm John Dee goes and I'm actually right I'm John Dee goes and I'm actually a CTO so I don't need to code but I do code nights and weekends why because I love functional programming that's how much I love it and I started two companies based on functional programming and it's just totally changed the way I think about writing software and if I could I would be writing code full-time 100% FP but but I have all this other stuff today they do to pay the bills alright thanks guys okay so the format of this I've got a few questions that I thought up this afternoon you can tell I'm really well prepared these these are just meant to be kind of talking points if you have a question you want to bring up I thought about like some kind of elaborate scheme where you tweeted it and stuff and then I thought now we're all in the room just stick your hand up and yell it out and we'll we'll handle it that way so okay so I've got my first kickoff question a very difficult one do you have fun functional programming yes any anyone else care to call this yes yes yeah I think I just told you that okay thanks for coming everybody I think we've having we've established the analyst all right let's jump in alright so a slightly more complicated one to warm things up then what do you think is fun about it so I'll take that one I think one of the fun things about functional programming is that it helps me actually understand software and before I discovered functional programming I basically gave up on software development because I was working on three million line of code Java applications where every object refers to every object in the entire system indirectly through some number of levels of hierarchy and it's impossible to understand it and then functional programming comes along and it says look you can divide your entire program into you functions and these functions given some input will return the same output and so your entire program becomes defined by equations and this way of thinking about your software which is or understanding your software is often called equation or reasoning because you can understand the meaning of any part of your program a equals B and you know what that means simply by substituting a B any time you see an N and that changes the way that you think about software just tremendously you know the meaning of things and you look at the types and they tell you something about while your program is doing and that's very profound and it just it it changes software engineering from this this monstrously complex thing where you can't understand what's going on to something where you can break it down into subproblems and you can understand the subproblems and by understanding the subproblems you can understand the whole so I think my answer to that question would be you know at why is functional programming fun and would be that it's not that functional programming is fun necessarily it's that program X fun look I'm a programmer not because I can earn a lot of money at it I'm a programmer because it's really fun to solve problems like that's what I want to do is I like working out problems the thing that makes functional programming especially fun is that more so than imperative or other styles of programming it lets me concentrate more on the fun parts so instead of trying to track state in my head which is something that's going to come up over and over again it lets me concentrate on just the the piece that gives me business value something I'd say that I think of a lot is how I came into not just doing Scala but doing a lot of very kind of you know deep down pure FP was that when I got into Scala I was in the Scala IRC room and I noticed people talking about Scala said all the time I joined the scholars head room and suddenly it was I was somewhere I really like to be which is in a room full of people that are smarter than me which means I'm gonna be on this learning curve which again is fun but one thing that that that stuck out to me is that the things that they were talking about the things that they are abstracting over were not things like a visitor pattern they weren't things like you know all these these Gang of Four patterns that you you that were all were supposed to have learned but instead they were talking about things that seemed very fundamental to me like how do we iterate or how do we how do we do loops or how do we you know how do we add things together right and this to me sounded very odd it was like well aren't these solved problems and it turns out that they are solve problems and they're solved a lot better using these techniques in FP and that they're solved in a way where if I use the stuff from Scholars ed or from cats or one of these libraries I can kind of say look they've got looping and iterating and that kind of stuff down to the point where they've written real mathematical proofs to say your stuffs gonna work and so again what this does for me is it allows me to say all this stuff I don't have to worry about a while loop where I've got something that's I got a chicken track what I got to set up before the while loop I got to keep track of my exit condition making sure that my loop makes progress May if there's somewhere I got to exit the loop you know trying to keep all that stuff in our head and it's something you were gonna hear uh people like us say and I think it's kind of an arrogant kind of a jerky thing to say so I'm not smart enough anymore to do Python which you know I think is a little bit of a slight on Python but it's it's the point we're trying to make is you know this this gets stuff out of my way so I can just focus on the fun problem I'm actually trying to solve so I'm gonna answer the question with a double negative which is the moment that I learned that not functional programming was not fun how many of you guys come from Java okay and how many of you guys have read effective Java okay not everybody so at my workplace it was like ten years ago we were all about effective Java write book book written by Josh Bloch that had basically a bunch of patterns for really just writing Java code in a pretty sort of fluent and standard way that just kind of made sense and so so my team there we all kind of read this book and we went through all the different patterns and we talked about applying it and we were like really fired up about this and one of the topics that we would be discussing often was which of the three closures proposals was going to make it into Java right there's kind of these three main ones and like a couple months later I happened to go to a talk at my workplace by James Gosling and I somehow miraculously managed to sit next to him at lunch and I said hey you know what's the news which closure proposal is going to make it in and he kind of was just like you know it's like hey you know this is kind of a hard thing and we might not get closures into Java anytime soon and and when I when I put that together with hey you know in effective Java in order to write a immutable class it requires like this sort of 50 lines of boilerplate or like in order to do sort of a lazily initialized singleton you have to do this weird double locking pad I see some people laughing over here like like you guys know what I'm talking about like exactly what I'm talking about and and so at the same time I was listening to this interesting podcast called the Java posse and and so this guy named dick wall was talking about Scala and like how fun it is so I'm kind of comparing those two worlds I'm like oh this this sounds cool so I got more and more excited about it so that's kind of you know going back to that it kind of made me realize wow what are all the things that I'm no longer like thinking about or worrying about that I used to have to worry about I think that that kind of makes it fun for me all right good I really like tinkering with things I like making things work I had fun doing imperative programming um I really like doing like autonomous robotics and you know poking stuff into registers and you know playing at that level doing functional programming I feel like my tinkering the things that I learned the things that I come up with are sort of more fundamentally true right when I'm tinkering with like hibernate to try to get some query optimized like that knowledge is lost at that moment right like whereas with them I'm learning like cats or something I'm finding like deeper meaning and deeper truths about you know category theory or about whatever it may be that I'm looking at so I really like that I really feel like I'm exploring this like new territory there's all these smart people have already sort of like laid this groundwork I can sort of pick it up I'm sense where this ad hoc like technology evaluation yeah I think I just wouldn't add too much to all these things that's just I think programming is fun it's fun because it's creative and it is practical it's utilitarian so it's like designing software's kinda like designing buildings it's you can make them aesthetically pleasing or beautiful even but people can use them for practical things I think is just very rewarding and functional programming I think when I first came to Scala it wasn't just attraction of functional programming it was a lot of but it was a lot of maybe some of the things that Java didn't have I like the static typing but it was much more concise and so it was more than just the functional aspect of Scala that attracted me so I'm gonna invoke a little bit of moderators privilege here I now want to move into what isn't from about functional programming a more difficult question and I'm gonna love one out there that I've seen just because I don't want it to be lost here so we have a wonderful panel of experienced Scala developers bill I know bill and I I know have the privilege of teaching newcomers to Scala and it gives us a perspective on functional programming that it's very hard for people to pick up in the first place that's one of the things that is difficult about it and unfortunately when you've immersed yourself in functional programming for a while that's the way you think and it becomes hard to remember how you used to think before you discovered it so I think that's one of my that's not so fun part is that initial learning curve is tricky and it's hard to get people it's very rewarding as a trainer to get people over that but I think it's very frustrating as a newcomer so is there anything else you want to throw out there it can be anything related to functional programming all the communities and social groups and I don't know everything to do with functional programming the world is not immutable that is a very good one I don't know what else to say about that yeah I'll get the conversation going so what I've seen in in the wild is that there are some organizations that adopt the you know that the scholars eat cats style of FP which you guys like to call FP yeah and that works there when you have a leader on top and they they kind of make sure everyone comes up to speed and you know goes in kind of the same direction so I I have seen real-world examples where that works they've also seen places that do a more functional they'd like to use a mute ability but they don't really have category theory front and center in there their app is more domain-specific kind of things where they talk about lists and seeks and sets and that kind of stuff and then there'll be one person who loves that other style and that I've seen not work so well so I think that's that's a kind of a actually the logical conclusion of that tends to be I've noticed but that person gets frustrated that nobody else is picking it up and leaves and then leaves this pile of code that nobody else knows what to do with so that's that's that's what I thought would be interesting to talk about that because that's wealth not the elephant in the room but it's you know it's a tricky one ya know I would say like 98 percent of functional programming is that that set of immutability and sets and and just just being disciplined about it you know every time you run into one of these cases you know you get so much further just by saying like I'm gonna be disciplined about FP I'm gonna stick with mutability I'm gonna look at you know ways to improve composition and if you do that like all those other things you can sort of grow into with time I would say like one of the difficult things about FP is to sort of like take a breath and and I mean one don't get overwhelmed by all of the the new concepts but to you know don't let frustrations mount that like the industry is in adopting these things as fast as you might think they should right I think the FP is making great strides all throughout all languages all platforms right now things take a very long time you know to change a whole industry and I think that's actually a success it's not something people should be frustrated by so I think fundamentally functional programming is actually quite simple it's programming with functions and a function has a domain and a co domain and these are the types the input and the output type and and every time you pass something in a function it needs to return something in the co-domain if it doesn't if it throws an exception it's not a function anymore and also functions they always return the same output for the same input so they're deterministic and then functions they don't have side-effects they're only effect is computing their output value so that's all that functional programming is there's nothing more to it than that that's it so if you're doing that you're already doing functional programming and then the rest of stuff the reason why we have libraries like Scala Zed and cats and the reason why you're gonna hear things like functor and other things in category theory are just because when you start programming using functions you wonder how to do some things like it's a different way of programming it's kind of a remarkable fact that you can build any program in the world using nothing but the functions that I just described and then it turns out that you're gonna run into problems when you do things like that way yes it has all these benefits to reasoning and modularity and testability and so forth but you're gonna run into problems and fortunately these problems have already been solved like these problems have been solved by mathematicians and that's category theory that's where all these abstractions abstractions come from and they really are basically the the building blocks for how you solve the more advanced problems when you're building function when you're building entire applications in this style but it's important to remember that functional programming itself is very simple and all you need to do to get started functional programming is writing these things that I've just defined as functions and then when you hit problems just know there's stuff out there and you don't have to learn all at once and there's plenty of people like me who like drag you along and spend hours of time explaining because we want to grow the foal like we want you to understand these things and we didn't understand them one day and and we know you're gonna understand them someday if you just persevere and and you know give us an opportunity to help you down this path so take it one step at a time and like never never never fear these weird sounding abstractions because if if you haven't felt the pain then you probably don't need to learn them just yet like use these pure functions try to build your software using this style and then when you run into those pains ask for help but there's plenty of people around who are willing to help you out can you help me John yes okay so I mean my perspective on this is that I have kind of realized at times well I need a sophisticated you know type system for whatever at the time shapeless was kind of the the go-to and I kind of realized hey I needed some kind of fluidity to my types for this particular application and I tried to apply this kind of advanced thing but what I ended up with was a pretty complex mess and I ended up going back to the basics right you know very simple data structures basic functions and that actually worked so you know what I struggle with is making something that sort of can use these advanced powerful concepts but is also very accessible and simple so I you know I I agree with what you're saying and I think it touches on a little bit of what you're saying in that one thing I would think that is something that breeds some of the not fun of functional programming is so we know we're better than everyone else and we're doing everything the better way and we tend to get full of ourselves right programming and software engineering tends to breed egos and that's it's a real problem in our industry and I would say that we have a particularly acute problem with functional programming breeding egos where you can get this sense of oh my god I'm doing it the better way and everyone else who's not doing it my way is a problem and this this is you know there clear problems that have come up in our not just our industry our niche in the industry our little sub niches of our sub niche and I think it's something that we need to check ourselves on from time to time you know I've been humbled recently you know as I up until very recently was working at Verizon we're trying to do massive massive cloud deployments and we're trying to do it on tile with you know pure pure Scala then me and my cohort Tim over here at some point started as you do as you get into infrastructure and you get into big stuff you start playing with go code because it's just how they're doing stuff right and you're like this is terrible you know and you're like oh this is terrible but then you can't it's hard not to then realize you say okay why is everyone doing this they're actually kicking butt and they're actually doing a lot of stuff for getting stuff done faster than we're getting stuff done right you look at what hashey Corp is doing with with you know Nomad and console involved all these things and they're cranking stuff out and they're getting stuff done and it's something you know and it's it's I've been humbled a little bit by that where I always thought like everyone should be doing it my way and being you know I'm probably a jerk to people about that before but there's you know we're not the only game in town and you know although we definitely are doing it the better way we need to remember that you know not to let our egos get get in the way of getting stuff done cause if I can pounce on this just for a second this is the community feel-good hippy side of me when you talk to people try and remember when you were learning and you know don't don't lose touch with that person you were five or ten years ago when you were struggling to understand it it's really easy to be impatient with people when they're asking a lot of questions but you were that you were that person at one point right and another thing I can recommend having just spent the last month or so working with scientists learning are it's really good to immerse yourself in something that you're a complete beginner on again to remind yourself what it's like to be a complete beginner on something just to you know you get good at this stuff and then you lose touch with with that so anyway I I go ahead bill I had a question but that's maybe your job but you know as the moderator i bestow my moderating hours upon you like is when you're talking about the better way to do a loop and one of the ideas that of having a while loop in scholars at the low level if i need to make it faster i can do that i was curious to what extent how often is that too slow is FP any of user using the answer is traversed i think there's always traverse after a great deal of analysis about three point two percent of the time functional code is too slow so you gonna rewrite it yeah that was completely made up in case you didn't get that okay I'm quite good at deadpan right so I do think is this on I don't think functional programming can be too slow sometimes I mean there could be lots of heap allocations immutable data structures and monad transformers stacks and stacks of binds on binds on binds causing massive heap turn and slowing the performance of your application down and so forth and you do eventually run into these types of problems but that said like there are reasonably fast ways to do almost everything in pure functional programming and there are techniques you can use and libraries you can use that are really really fast and one of the trade-offs that you're gonna have to carefully consider is sort of okay functional programming does give you strong types and composability and modularity deterministic functions that are easier to test and so forth some techniques and functional programming can even guarantee resource safety so you can make sure you're not leaking threads and leaking memory and so forth and these things have lots of obvious value to the business so sometimes it's it's a matter of trading off between some things that functional programming is very good at giving you and then some things that in in Scala on the JVM functional programming maybe has has to struggle a bit more with including such things as performing and type inference and so forth and there are definitely some drawbacks that come with trying to do pure functional programming in Scala and on the JVM there's just no denying that in my opinion like for the majority of business applications that I work on I find that the benefits outweigh the costs but we we should be realistic about that and not deny the existence of cause there are real costs to these things it's just that for most of the applications that I've worked on or helped people work on the benefits far outweigh those costs so is anybody taking a peek inside the Scala collections library the implementation because that's not a functional implementation I would say you know it's like you do what makes sense for the situation right even Martin oh Turkey would tell you that it's okay to use var right it's okay to be mutable in the right context so I think I think you know in terms of that's some dissension in the front row it's all right no I mean but seriously I mean it is a multi paradigm language I mean obviously this is about functional programming but there are there is cause for marrying these techniques and I think that really is the best of both worlds kind of thing I do think we should expect things to constantly get better with respect performance to is you know we were kind of on the forefront of things but now you know now Javas got lambdas right so maybe now our mega morphic apply cost goes away and maybe lambdas get fast again you know now that Java has like inspiration to fix this for themselves they'll fix it for us too so I you know I think that this will also happen as we you know as Java becomes more functional they're gonna deal with more garbage and figure out ways to you know reuse stack frames or reuse you know and so though you know what I think tail call elimination will come to Java eventually Java 13 Java 14 yeah yeah and another thing is like there's there's very good techniques in functional programming for hiding low-level parts of a mutable algorithm behind a pure interface so you can use those VARs you can use those dirty implementation techniques underneath the hood and that saves your the rest of your team members from ever having to touch that stuff and still lets you reason about your code in this composable fashion in this equation because as long as the interface is totally pure doesn't really matter what happens underneath the covers I'm happy to take a question from the crowd otherwise I have some more I can throw out there but yeah yes okay go ahead what's missing for good FP in scanner I'm repeating it because they always ask you to do that Dec safety style yeah okay any cost of stack safety is is insane we need better debugging tools how many people here who've said all right let's see what's going on got a stack trace it's free that apply free Dayron fleet I'll apply free dot run flee dot apply and then it runs out of a thread pool thanks and you know you know stack traces become kind of useless and so you know people say what do you do and I'm like I don't know what you do is you hope that someone comes up with like a different paradigm for how we debug our programs or how we you know report errors and stuff like that print line I think I think it's very loose it's it's Scala is you know it's strength as you're getting call in any Java library but that means you that we still have null and we can still get no print exception that means there's there's not it's not easy to track when I'm doing IO and I can just use of our I can use a Val I can use a mutant blobs you can obviously they look the same so what I feel like is you know it's great to be able to do those things any have you can't call into Java someway then nobody's gonna have used it in the first place but I feel like it'd be nice if there is some way to partition or contain or you know put things in their place so that that you can say hey I just I want you to tell me if I accidentally do something with a mutable object and intend it or know it or something like that I got it we should have a naughty keyword and you put everything in there in an old Tiki wood I mean it's kind of like the blessing and the curse of Scala right like that's the great thing about Scala is that it's not Haskell and I don't have to talk to you about an IO monad before we do hello world right what what I can do instead is say all right you know Java cool leave off the semicolons if you want and then we'll talk about the while loop tomorrow right but then like a year later you're like all right now how do I turn all the while loops off because you've had your time and now you got to stop having access to that stuff so you know it is a bit of a trade-off I think from like a day-to-day perspective I think what would make functional programming on Scala a lot better is better support or rather higher performance for mega morphic function calls which are pervasive in Scala programs and they impose significant runtime performance cost and also heap churn is massive in Scala functional Scala programs and the GC is not very good at dealing with this kind of constant pressure on the heap and I think the other thing that would help enormous ly and just sort of usability developer aesthetics usability would be better type inference much better type inference especially of higher kind of types because the amount of type annotations you have to supply in cases can just make make Scala code look real even more verbose and even more ugly than it already is since we're going through our wish list I'd really like a collection library that doesn't throw like just across the board I think that would make more of a difference to me than like half of the abstractions I use in big teams that is isn't throw exception so I don't want get on an option I don't want head I don't want yeah any others because I can think of one more that hasn't come up yet you can well now I find it significant that it hasn't come up yet so it's called syntax no no but no not exactly what I had in mind no um one of the things that always seem to come up was tolling IDs in particular people would complain that the IDE support was banking I believe it's got a lot better I'm not sure is perfect yet but it didn't come up in this group yeah I think senator here because well none eg I des can actually compile the code that I write okay not even enzyme well yeah okay I would like a language server with integration with you know be its code or atom or something would be great enzyme has one that's yeah enzyme won't work for you oh yeah I would like a I have like a language server okay any and that wasn't least one more hand yes you you can share mine yes there was question okay we have mine a lot of you guys talked about learning functional programming aspect and I'm just curious whether for the new generation of programmers whether functional programming as the first language learning opieop appropriate will that will the ego eventually get in the way of learning the other way I mean not that is not a single soul in here probably started functional programming before they started improving imperative programming so if you can touch that aspect I'd be interested did anybody learn functional programming first here no I I have to I have talked to people that out-of-the-box to learn Lisp as their first language for example so I certainly didn't I was basic the first one I learned but yeah I've talked to people who learn blessed first so so yeah I think that if I think everyone's first programming language should be a functional programming language ideally there would be their last programming language and actually I started teaching my daughter functional programming when she was seven and she gets it because the concept of a function is pretty simple right you stick one thing in one side and out comes something else and it's and and and that always works and it's very deterministic that's all that you need to teach functional programming so I've actually talked to a number of people whose first programming language was functional programming and then they had to go out in industry and get a job and then they didn't understand Python I was just so confusing or whatever program Java I mean try to teach someone Scala and object orientation and inheritance and variants and all these things it's so complex compared to teaching them functions and data so I think that like we would do a great service I think to all software engineers if their first programming language that we ever taught them was functional programming so which language [Laughter] ask off without a doubt we're speechless I'm sorry for my traitorous nonsense here up here on this Scala panel it's cuz it's so there's a lot going on it's calling that's true yeah the only thing that Scala has over Haskell is jobs there are plenty of jobs [Laughter] and they pay well math I mean that's really the first functional language isn't it I mean you can you could do functional programming on a piece of paper right so I think I think it's actually a good place to start for sure and making that kind of leap to oh you could actually put that into a computer and it would do something interesting I think that's a really interesting way to think about it that's actually kind of where I came from I was actually you know going to school and applied mathematics and I just came to computer science just because I had to take an elective and then I kind of realized oh I can make the thing do stuff that's kind of cool so here I am any other questions from the audience sir otherwise I'll check one I had in my list of potentials oh yeah okay so on the last one that's something that I've thought about quite a bit I guess and like I feel like functional programming at its core is just simpler and so I feel like it's how you should teach people but where I get tripped up is like one of the first programs that you want to write is something that prints hello world right and as soon as you start talking about monadic IO like that is one thing that I just legitimately seem just like a higher learning barrier and I don't know why do you just think that's inherently a higher learning barrier that people are gonna have to get over if functional programming is first or what I think that we're gonna need to be careful about how we frame things right I made that comment earlier the world is not immutable right the world has side effects so in my mind like functional programming is kind of like this idealistic fairyland in a way because it's this world in which you know you you have these kind of no no side effects happening so I think we do have to be realistic about the fact that at some point the rubber needs to meet the road and so we have to be explicit about here's the boundary where everything is kind of nice and pure and outside of that boundary we have things having side effects so I think that that concept is something we'd have to introduce pretty early on right it's just even with just hello world so maybe maybe you would start with side effects and go move on to you know how would we do monadic IO right can we just ignore print line as a side-effect I'm just saying I mean really I mean I mean it's you know what it would it be terrible to if the first functional programming language was Lisp you know where you're not you don't have any types you have what one type and and you are side effecting but you're at least programming with function like things I don't know you know I sue so here's what I would say here here's what I would say put stir line is a function that takes a string and returns an IO of unit which is a description of a program that prints a line of string to the console but ster line is nothing more than a pure function that pure function just returns a value an immutable value and that via immutable value is nothing more than a description of a program and then the runtime system for that program the main function if you will is gonna look at that value and it's gonna say oh look this is an instruction to print a line of output to the console so I'm gonna do that so here I've explained in 30 seconds what what puts your line is and I didn't use the word monad I just used a function each is immense that's really all it is so I would say you know we can teach them that and maybe we don't have to use monent we don't have to get into a right away but we can teach someone that because I just thought everyone in the room that in 30 seconds it's not that hard it's like nothing more than a function that takes a string and returns a value which is an immutable value that describes an instruction of a program yeah I'll be real quick I just it's moments made by the end of history and there are still other possibilities so for example I'll give you an example that Martin has talked about is using an implicit permission to do an i/o that way if you don't have that if you try to do something with that has a side effect then it wouldn't compile but that would be you wouldn't have to it isn't a monad it yeah you would have to there'd be a because something in the background also that you wouldn't talk about which would be an implicit but yeah the best thing we could do is delete the mutable parts from Scala and just make it more like a school she well so so Tim Tim stole my question but I think that um hello world is a is a stupid place to start teaching programming it's kind of an artifact of the compiled program world where nothing happened until you had an entire program and got to run it in these days where you actually have you know an evaluation loop and you can print you get the ripples yeah yeah you're gonna type stuff at the console you know teach you know iterating over a list actually do some math compute something and then eventually talk about sort of these artifacts of like saving stuff of IO and saving stuff to a file or sending it to a console or something it's a weird concept anyway you have to understand what a computer is which is really different than actually programming so if we're gonna teach programming we should just leave most of that stuff out for a long while until folks understand the concepts hey how come I didn't get applause for my Mona's or at the end of history comment you suggested it elicits oh yeah okay so the number of programmers in the world is increasing at a certain rate is a number of functional programmers in the world increasing at the same rate more or less same question for Scala programmers and what does that mean for the community I have absolutely no idea does anybody know so I can't speak to that like definitively because this requires research that I haven't done but you google that yes good luck but what I can say is like I attend probably like three or four conferences a year and I've done that for quite some time and what I've seen is that the Scala conference is five years ago there was no F P content at any Scala conference it was just like akka and stuff like that and these days you go to a Scala conference and it's 50 percent functional programming you you're getting talks on a junctions and category theories and functors and like lots of zippers and lenses and this and that and that's just really amazing to see that happening and also the functional programming talks are generally tend to be the more popular ones so you can see something's happening and like meetups like I've just seen so many meetups start taking off covering functional programming and we have functional programming meetups in almost every city and sometimes specialized for different languages so what we're seeing is a lot of grassroots effort a lot of people walk about this type of stuff a lot of people do videos there are many more books coming into play it really does feel like there's this bottom-up movement by programmers developers who've just fallen in love with this and want to share it and talk about it and find ways to use it at their work so so the authority on all of these things Google first of all tells me that functional programming languages are doing quite well but then the very next one says that the fastest growing language is Python so there you go Google once again produces somewhat conflicting results I also find that JavaScript is you know if you look at the trend of JavaScript it's on it's on a crazy upward trend so I would guess that you know perhaps not however what I would say is that FP does seem to be leaking a bit into all the other disciplines right I'm now in a shop which is doing no Scala they're doing Java there's some closure around but when I got there a big effort that it just happened was to move their Java code into pure functions and use immutability there they're not you know they're not using Scala Zed and Traverse and all that stuff but they're they know that there's there's a big benefit to purity and to immutability and then what I'm surprised about is I'm like all right let me talk a little category through you guys all right there's this thing called a mono IDE and they're like we actually all know what that is and and I wouldn't have expected that in a Java shop you know two years ago but I so I do think that and another thing that's happening is that you know Scala is becoming very popular right and it used to be that you'd had a lot of people if you're hung out and maybe a Scala help channel you just start to see we saw it start to see a big influx of people who and it used to be akka right it used to be the thing is they were like I heard this cool thing I want to try it out it's a different paradigm and you know it attracted people but then very quickly it became spark right spark is huge driver to Scala that's why I would say more than 50% of people who decide I want to learn Scala now are learning it because they want to learn spark because and I think that what's gonna end up happening is you know if we can attract more people to Scala they're naturally gonna get indoctrinated a bit by FP if they're all a sudden are in this language where all this stuff is enabled so I think we have a good shot at it but but yet JavaScript and Python are killing us I think it's I think it's worth taking the half step back because I've seen this interest in Scala from spark and the vector into it actually seems to be it's a lot of data scientists and a lot of mathematicians they used to Python spark has a Python API if they start using it through that they decide pythons not fast enough and then they see others a spot there's a scholar spark that everybody says runs faster and that tends to be the vector that sucks people in I didn't really have much more of a point than that other than other than I feel the need to defend my son's honor a little bit in in light of the yeah if I may make a wild conjecture about pythons popularity there's been a lot of movement over the last couple years just getting people that haven't been developers into being developers right meetups boot camps all these kind of things and Python is probably an or JavaScript the most popular you know language to use so I'm if I to extrapolate I probably say that it's it may be the fastest-growing because there's actually new folks coming in which is good right which which speaks to your point the question is are they gonna continue on and go to to go to Scala so far we haven't been the go-to language for starting cuz we took that poll earlier like zero people had started with Scala and so why is Python the the in JavaScript why are these things becoming so popular and so popular with the non-programmers is got to be low barrier to entry right like you know imagine when you're like cool you want to do some big calculation so let's talk SBT you know all right you know I whereas with you know you know and maybe it's a terrible story with node but it you get up and running fast or with Python you just type Python and you just start doing stuff and that can be true for Scala but then you'll have someone say well you should never download Scala yourself you should have to the SBT download it for you you know so so we do have some problems there too which you know specifically on barrier to entry I think one more thing to add numpy python has numpy scala does not have anything that competes with numpy I was just gonna say that I saw functional features going into a lot of languages and so it's coming in that way into mainstream life you know programming but it's not taking over in that it like for example Kotlin if you I've looked at that a little bit it has a lot of things that seem similar to just by coincidence similar to Scala but that's not making immutable data structures they're mutable they probably will get that eventually perhaps but it's basically you know has a different philosophy and I was invited to the speaker dinner of their first conference and so I were mice Carla you know sure to kind of I don't freak people out and and they really didn't like Scala and and they really did liked mutability so I think there's you know there's there's different things going on it's not all going towards functional any other I have a couple more Oh yep okay is this the lack of libraries that really the reason that Python is so popular is right now there was a talk today on deep learning for Java where they had a replacement for numpy some kind of not sure how ready it is from do you think that Scala community will step up or is it something that you don't see happening I think I'm sorry I shouldn't do this as moderator but I'm gonna say it really quick I think this is something I'd like to see you know it's one of those things that as open-source developers when you say that somebody will inevitably turn around I say why don't you do that then and there is a good point there but so that one of the reasons that the data scientists and myself were using our and our studio is it solves a particular problem much better than we can in Scala right now and that is taking basically a buttload of numeric data reading it into some kind of table doing some kind of very fast statistical manipulation on it and plotting some stuff out none of those things are impossible in Scala they are all much faster to do in our studio much faster and it would be great to see something that does that in Scala and get all that payoff now when you say faster you mean faster for Less developer time you don't mean less CPU time right because I think Scala does have very sophisticated numerical libraries available you know there's there's lots of them out there but it's not but again I think it's that barrier entry is that we can we can do all the same things they can do we do them just as fast as they can do that we for this performance I would measure in CSV to plotted graph time yeah so one of the things I think personally where I've seen the most benefit from functional programming because it helps us decompose programs into smaller pieces and a reason about them incrementally one of the biggest benefits I've seen is it helps you maintain code over time at a reasonable cost you can change things more quickly and more safely in a functional program than you can at any type of beautiful program and that's very useful when you're building something that's long-lived and has to be maintained for a while but if you're building some throwaway code right once code honestly the maintainability benefits don't matter all that much so I would not be surprised to see if there aren't large sections that don't end up migrating to functional programming or to Scala or even to static typing because when you're writing something it's a one-off you just need to understand at that one time you never even need to look at it again you just want to go from CSV to plotted chart then it's not necessarily important to be able to understand whatever you wrote because you're never gonna look at it again so I've been working on an application that requires doing a lot of math and what I've been using Scala for is prototyping and specifically doing typesafe math and that's actually really saved my butt a lot of times avoided a lot of bugs however once you know the prototype is done then you go well how does this actually scale I've looked at breeze for example and it's mutable and so you start to wonder well you know how do you make this work on GPUs and maybe Scala doesn't actually make sense for all applications it's not necessarily a silver bullet we're talking ourselves out of this song way just get out I can finish up with his functional programming still fun at the end of this yeah well just took continuous so apparently was affirmation like function programming could be like your first and last language and apparently probably this is not the case like and this example and who is them to write like kernels like I'm going to write and so on so probably definitely some usages way if you probably cannot just use function programming yet maybe I don't know i I've not but this is entirely related but when he would when you're speaking about that I've I was reminded of the 25 or 30 year plan or the thing that's been planned for 25 or 30 years which was the the Lisp OS which never seems to have materialized but it's this mythical base that people talk about we're gonna have an operating system written entirely in Lisp at some point I've used one called either symbolics machine so I think that like there's just an enormous number of problems with software today at every single layer of the stack and security vulnerabilities and people being able to hack into systems and just all this kind of crap it is it comes because we write slop code that no one can understand not even the people who wrote it and we don't have formal ways to reason about our software and all this comes back to the fact that we're not using statically typed functional programming and in my opinion it's the best tool we have today for writing correct software and and there are so many applications where we can take these techniques and use them to write things that are provably correct and have lower defects so I actually think that the lower level things which are critically important to get right have a greater probability of migrating towards functional programming techniques because I think they've they've shown the most inclination to solving the problem the problems around security and performance like that's some solved prob Scala wasn't designed to do pure functional programming language and it has to run on the JVM so it has some drawbacks there but there are low-level purely functional programming languages that are very very performant and allow you to do lots of lots of very powerful things and actually there are whole kernels written in functional programming languages that have been verified take flight I had a question yeah hi so several years ago your instructor was in Palo Alto and when asked about the fact that now that they have monads in C++ other C++ guys willing to adopt more like facts of life and that FP is like getting introduced and be honest said I don't know why functional programming failed so any comments from you thank you so I'm gonna be the optimistic one and say that I don't think it failed I think we're seeing it more and more and more in all disciplines if you're writing JavaScript in 2017 you're doing more functional programming than we did in c-sharp and you know 2005 right we're seeing FP get adopted everywhere I think it's really important that we don't like sort of define this all-or-nothing definition of FP that if you're not like purely you know types you know static F or Haskell then you don't count I think it's it's it's permeating everything we do and I'm really excited to see like the research that comes out of that and what other ideas like Martin's you know capability-based idea you know comes out as a result and it's it's not really failed in my opinion is just a slow starter like how long did it take programming languages to get lambdas that took ages from the time when they were invented at the time when modern programming languages just started shipping with them but but you know there's there's hope for the future like like Michael says like these things are changing and people are embracing these techniques and they're migrating into the front and react and all these things are inspired by functional per spark is inspired by functional programming you see really good ideas from FP leaking into all these programming languages and libraries whether on the front end or the back end and it's a sign that there's a motion in this direction because functional programming does solve real problems that programmers run into on a daily basis so going back to you know you know what Vlad was asking about whether or not something like C++ would adopt you know continue to adopt these type of things the the obvious joke answer is that C++ will adopt just about anything it's the kitchen sink of programming languages so I think this is probably wrapping up time right I'm looking around to see whether I should be or shouldn't be we could go on yeah I'm getting the nod that we should start wrapping this up I'm sure everybody wants to go home or to the pub or some other place anyway so um just thank you all for joining me up here thank you all for coming I guess the final question would be are you still having fun with functional programming hell yeah yes yes yes yes yes [Applause] [Music] [Applause]