Why Isn't Functional Programming the Norm? – Richard FeldmanMay 31, 2021
Welcome everyone, this is why
programmingis not the
norm. I'm Richard Feldman, so I'll start with the question of why
norm. I, like everyone else, wonder this, as if everyone ever looks around and says, hey, yeah. exactly like I spent a lot of time doing object-oriented programming in my career and then finally found functional programming. I started doing it and I do it more and more and now I've been doing it for several years and at some point I was just, yeah, why isn't this the norm? It seems cool, why doesn't everyone else do this, so I set out to answer this question and it's pretty straightforward, they say why things are the way they are.
Why are they this way instead of that way? I discovered the answer and it turns out the answer is complicated. There is no one alive. A very simple, nice, neat and tidy answer, but in this kind of search for understanding I ended up learning a lot of things. Things about that explain why things have to be the way they are and I will share them with you because it is complicated to divide this into three parts, so first I will talk about the language and then the paradigm and finally the style. I'll start with the language, so what languages are the norm today if not functional programming?
How did they become some of the top 10 most popular languages in the world? So I ended up concluding that this breaks down into three main ones. categories and then two types of exceptions, one is that they had a great app, another is that they had some kind of platform exclusivity, another is that they had a really fast update history, so let's start with the great apps, so this is Apple 2 and run VisiCalc. So the physical is one of the first examples of a great application and what I mean by this is that basically people wanted to use visicalc so much that they sometimes paid more than 10,000 dollars for this hundred dollar software to get the hardware necessary to execute it. people wanted to visit calc in their lives so much that they simply went out and bought an Apple too to be able to run VisiCalc and this is an example that also arises in programming languages, as byte magazine said in 1980.
VisiCalc is the first program available that has been responsible for sales of entire systems and that metaphor also extends to cases where if someone wants to come up with a particular application of a programming language and then buys the programming language itself along the way as a It's kind of a cost to get the application that they want, so here's an example of what you would say is the best application for the Ruby programming language. Well, it's exactly right and I think this really drove home this point when I searched for something like Google Search Trends for both Ruby and Rails and it turns out that they have the same form as in 2005 when Rails is listed as Rails.
The Google search term goes from zero and has a big spike and then Ruby has the exact same spike and then Rails popularity declines. and then Ruby's popularity declines so I think from this I can conclude pretty definitively that just like Ruby's top ten popularity is explained by rails and I don't think if rails hadn't happened, Ruby would be one of them. I think one of the top ten most popular language applications for PHP has changed over time, so I think in the beginning it was basically the things that everyone used it for, which is basically doing dynamic HTML, like if you had an HTML static. page and you wanted to make it a little bit dynamic, it was really difficult to do it faster and easier than PHP, you just like to modify some things, insert some code in the middle of your HTML and then upload a little bit like you know FileZilla. a server and then it's okay, that's it, that's it, but these days it actually seems to have come down to having two particular kits for PHP, so this is a graph of PHP's popularity over time, a little more serious than the by Ruby.
It's been in pretty steady decline since 2004, and in fact, if you look at the bottom line of these two particular PHP apps, WordPress and Drupal, it looks like the total number of visits to PHP is like the sum of WordPress and Drupal. These days, this anecdotally matches what I hear from people. I still hear people using Drupal. It's a good setup. I still hear people using WordPress to create sites for people, but in terms of using PHP for their own site or going out. and then like starting a startup around this, which is kind of like Facebook and Slack are kind of a cautionary tale in that sense, a great app for C was actually systems programming, so back in the day when this came out, this is way before my time, but I actually saw a talk by Brian Kernighan, one of the co-creators of C, and he explains that at that time, if you wanted to do systems-level programming, you wanted to write a kernel or you wanted to write like LS or something like that.
Know the usefulness of the system, its options are basically like assembly language or Pascal, which I'm not a Pascal programmer, but the way he talked about it sounded like it was a ridiculous idea, so apparently it wasn't really done and, so when C came out, it really filled this out. I need a lot of people to be so amazing. I want to do systems programming. I'm going to go for C, that really boosted the popularity of C. I think there's potential for some killer applications of FP, like anything can do it if something comes out. that's popular enough if it takes off, I think I would take that language with me, so the examples that come to mind for Elm, there's a basic Elm UI tone, you don't have to write CSS anymore, you know you can create front-end applications. and it has this whole layout system which is really cool because you don't have to think about CSS, you just write your code, Elm code and then you have a Tomic UI closure like it's a nice database independent of the programming languages, if you want. a really good database and you say hey, I think I'd like to use atomic on the date that Tomic takes off if a group of people say that, I think it would bring closure, it would bring a lot more closure programmers to the world. in the same way that Rails did it for Ruby and finally one reason why ml has this thing called reverie where the basic argument is that you can have a cross platform application built with web technologies but it doesn't actually run, it lets electron's favorite everyone, so all these things you know have the potential to make these languages take off in the same way that they have with non-functional languages, it's just a matter of will.
It will be interesting to see if web assembly changes this. I mean, it's really an uphill battle, but at least it has the potential for us to finally get to C sharp. This is an interesting case because it's about platform exclusivity from two different angles, so first we have Microsoft. Windows, so this is Windows 95 from the mid-90s, you know, it's in the works and Java comes out, something from Sun Microsystems and Java has this write tag line once it runs anywhere and Microsoft doesn't like it This is because you can run it on any operating system.
Trivially that means you don't have to run it on Windows and you can run it on someone else's OS like Mac or Linux or something like that and Microsoft at the time was making almost all of its money on Windows and Windows related stuff so really They didn't want people to write a ton of Java, they wanted people to write something that they controlled, so they came up with this language called C Sharp and that was the language that they controlled that had an almost identical feature set up for Java for some reason. very strange coincidence so what Microsoft really wanted out of this was they wanted a lock like they wanted people to be like ok let's know you use our thing instead of that thing but the way they achieved this was by using the exclusivity of the platform in its vast and really good network of tools and ecosystems, like MSDN documentation and things like that, so if you want to get into Microsoft IDE like Visual Studio, like before Visual Studio code, and you want to get an experience similar to Java, the only way to do it was C Sharp because Microsoft was not going to create those tools for Java, they were only going to create them for C-Sharp and it was successful, so C-Sharp became a very popular language and that is his merit.
It had a number of design features that many people considered improvements over Java and this brought it to the top 10 and finally we have the fast upgrade path, so this basically works based on people's considerations. when they decide to adopt a programming language, of course everyone thinks about the benefits, you know the things that I think will be good if I use this language, familiarity with the language is always a great thing, you know we are human, we have a first impression . of something we're like ooh, that looks good, I know what that is or you're like oh no, that's a lot of parentheses, but hypothetically you know this is something that people do, like we react quickly to things and that impacts yes No. , things become popular, the learning curve is different, you see, well, that's a slide about what the word Monette is like.
Many people have registered. Type scripts do very well in terms of popularity. C++ is possibly the first example of how to do this and be very successful at it. C++ is almost a superset of C. I don't like literally any typescript style, strict superset, but you can often rename the file dot C to dot CPP and just go and get the added benefits of C++ which worked great. Carlina is perhaps the most modern example of this. it's more about the CoffeeScript flavor, what Kotlin is a substantially different programming language from Java, not only does it claim to be a stripped down update, it's like they really emphasize this on the website, 100% interoperable existing codebases, no I have problems migrating.
We have a script that will convert your Java to Kotlin and again also a language that has done very well so most of the languages are in the top ten but there are two that we haven't talked about so one of them It's Java. has a strategy to become popular that, as far as I know, has never been attempted before or since to become popular, which is epic marketing IV, seriously nice, like in the 90s, there was a lot of coverage and in fact, in the early 2000s, basically, everything. With the money they then liked the power that Sun Microsystems was putting behind Java in 2003, they introduced a new half a billion dollar marketing campaign just for Java as nothing more than this programming language and keep in mind this was in 2003, when Sun was like having financial difficulties, so it was after I told them the amounts of marketing dollars they had spent when they were flush with cash and at this point they already had millions of Java users and they said it's not enough, we need announce a new RiRi F.
Zephyr and tell everyone how much money we're spending. This resulted in some pretty funny stuff though, so this is from the late 90s, this is a Sun Microsystems commercial called the spy and it's basically like a James Bond parody, it's like James Bond and Q, they just like it. going through this like a briefcase full of gadgets and questions like this was built with Java technology over and over again, it's like including this credit card that for some reason is like Java code running on it like it's not. I don't know exactly why that's critical to James Bond's success.
There was also a funny moment here in the middle of the commercial where they had this woman in a lab coat holding a C++ textbook. I think it was just to say "hey, C++". programmers use Java, it will be cool and that was the goal of Java, it was supposed to be familiar to C++ programmers, they really wanted to appeal to them. James Gosling in one of his talks said that he used the term as we wanted. to trick them into thinking that Java was something I already understood, so they really pushed this even in the smallest commercial, so it was so successful that it really impacted what today has become the number one programming language, so The history of Java scripts.
The initial development was that Brendan Eich was working for Mozilla. He was tasked with creating a scripting language for the browser so that it could perform real-time scripting in the user interface and his original design was actually based on a Lisp-like scheme of functional programming, which It was what I wanted. Doubt might have been number one, but the people at Mozilla said: Have you seen this Java hypetrain that's coming? We have to go ahead with that, like in the name, just paste it in front, it will have JAV a in our name and it will also create the syntax. it looks like this and it makes you know, the language is object-oriented and Brandeis likes it, and that's the story of why the number one programming language in the world is object-oriented instead of a functional Lisp, you know, I think it's nice.
It grew slowly and steadily over the years, so you can exemplify this by looking at Python compared to two very similar languages, Python Perl and Ruby. This was back in 2005, when Rails was just getting off the ground, so you can see at this point between those three. languages Python was the least popular, so Python had been advancing and Perl is in decline, almost PHP-style, and Ruby at this point has skyrocketed in popularity because Rails just came out, so at this point Python is somewhat So. thirdly, but hey, so slow and steady wins the race as they say and as we see as time goes by, Perl continues to decline, you know, the rails help Ruby go up, but eventually, again, it declines, Python is still browsing. moving forward and then finally Python just gets better, the slope changed a little bit and it just slides up and then when we get to the president it's like holy cow, what happened?
Python is now the number two language in the world came out of nowhere, but it didn't come out of nowhere, I just came out of the slowness where it really did, you know, it never had an on-rails moment where, like, jumped to the moon, it was a slow and steady thing and then eventually, slow and steady, it grew a little bit more and then that was just multiplying it over enough years and eventually it became a really popular language, so good that I almost feel like it is. how we would like programming languages to work, you know?
They just have a good design, people like them and then over time people use them more and that's it, but of course as we see real life it's more complicated than that most of the time, Of course, there are other factors that play a role. in popularity it's not like these particular stories or they are the only things that influence them, but I think they are somewhat secondary to these things, syntax is something we talk about of course, anyone who is useless is familiar with the initial reactions of people in the labor market. the right people always say this is kind of trompe l'oeil with things like oh I don't want to learn that because if I invest in it no one will be able to hire me and then employers say I don't want to use that because if I do I won't be able to hire anyone, well, no, no matter what, this greatly favors the languages that are already popular and in some way reinforces their popularity and, finally, the community, this can be an advantage or it can be an advantage. be something that makes people leave Ruby.
I would say this is a big plus for them, as the Ruby community has a reputation for being really welcoming and friendly. I think among functional programming communities there's a bit of a mix, some of them stand out for being really welcoming, all of these stand out for being a bit arrogant and snotty, so it really depends on where you go, but again, like I said, I think these are pretty secondary to the main ones we just talked about, so let me. ask another question like okay so I can see that there are a variety of explanations for how these languages became popular, but how come they are all oh oh like that?
It doesn't really seem to relate to great apps and stuff like that, how come everyone? These, except C in the top ten, are all object-oriented languages. Is there more to these stories? There's something about object-oriented that causes or is partially responsible for this popularity because it seems like if that's just a coincidence, it's a pretty big coincidence. I looked at this a bit more, this brings me to the paradigm from part two, so Wikipedia defines paradigm as a way of classifying programming languages based on their features, so that because features can overlap, like if you had multiple feature sets, you may also have overlapping paradigms. some languages are, for example, imperative, object-oriented and procedural at the same time or they can be hybrid, object-oriented and functional.
You know, this is something that overlaps, so I was trying to limit it to things that are unique. I like non-Kross paradigms and I say, "Okay, is it true that almost all of these languages are oo because of some unique features that aren't really found in other paradigms?", so this, of course, led to the question of what are the unique paradigms. oo features, I mean, I can think of the things that are talked about is kind of canonical features like encapsulation, maybe inheritance object methods, so I started looking into them, so inheritance falls into two categories, one is what people call interface inheritance.
Basically, it's just another term for subtyping, of course, subtyping is found in all kinds of languages, so it's definitely not exclusive. The other is implementation inheritance, which most people just call inheritance, but I've encountered people who wanted to be more specific for the rest of this talk, when I say inheritance, I mean implementation inheritance. However, it's interesting the implementation compliance, so it's actually considered a best practice, which is why there's this phrase composition over inheritance, like favoring composition over inheritance. I think it was the first time it was used. was in the Gang of Four design pattern books, this really influential object-oriented programming design book, but now this has become something that is repeated in every object, right, that thought leader that almost I've never heard of, this is the way we're supposed to do things, it's like, inheritance is something that is found in almost all object-oriented languages, but you know, it's a little disfavored in favor of composition.
I think that's pretty interesting, which leads me to the conclusion that, like, inheritance. It's one of the unique features of the language and I think it's quite difficult to say that this thing that is recommended not to be used as a best practice is somehow explained as the popularity of all these languages, so I don't think it's inheritance and I especially don't think in this when you think about what are some modern languages that self-identify as being able to support oh paradigms like what do they think of inheritance, so it's a good example of this because this is a language that they don't really nest in for version compatibility. previous ones from any of the other object-oriented languages like Kotlin, of course, you need to have inheritance because they want to have really good Java interop.
Go doesn't care, I mean, go is basically trying to Be another better view based on you know using the learnings from the intermediate time period, really some of them and basically it's like you know we support a style oriented objects. This is from their FAQ, but they have no inheritance. I just decided it wasn't worth it, I didn't want to do it, it's especially interesting when I look at this in terms of what that entails, for what methods and objects, which are two of the other things I said could be some of theC++ program, can we really say that Java's object orientation was a really cool first-class thing or was it just like that, it was familiar to a large group of users and that's why it was an object? oriented and that was what caused its success because we have seen that familiarity and this smooth upgrade path is really a big deal and then of course the same can be said for C-Sharp as C-Sharp was intentionally designed to be exactly the same feature set or very close to it as Java, so it could be presented as a really viable direct alternative to Java, so if you trace this lineage it all comes down to the possible reason why all of these languages are objects. -oriented on this whole lineage here it's just that Yarn list created c with classes and then it wasn't popular enough so we added other features but then the other features don't get the credit, it's the OO that kind of means .
The successful and failed experiment is what gets all the credit in retrospect. Something similar with Objective C like Brad Cox just wanted modularity, he says this several times in the interview but in the end what he ended up deciding on modularity turned out to be small talk because that's what he knew at the time and then of course , Swift needs to have support for Objective C and is therefore also an object-oriented language, so I really like to delve into this, at least with this group of languages. I do not see it. By not seeing that object-oriented caused their success, I'm actually seeing the opposite, which was actually a legitimate coincidence in all of these cases, so what about Python?
Python is neither of these groups, it is not like a direct descendant of C, except in a you. I know a very strange kind of argument that object-oriented caused the success of Python, so I don't have to conduct an interview to point out here, but I do have a quote from the creator of Ruby, which is Matz, and he said that you already know. When I made Ruby I wanted a scripting language that was more powerful than Perl and more object-oriented than Python, so Matz believes Python was not particularly object-oriented. He really wanted something that was much more of an object to write on.
I liked that he was quite interested in these small talk ideas. I think that's really reflected in the Ruby language, so you'd think that if object-oriented is really essential to success, then the fact that math made Ruby more object-oriented than Python and actually As Ruby enjoyed a period of time where it was more popular than Python, that would have led to some sort of long-term success, but of course I already know from previous turrets that that's not what happened. Ruby briefly surpassed Python in popularity, but it was basically because it hit the rails and then once it was gone, you know Ruby is a great application language.
Python is the language that people like because it is design fundamental. is pretty good, so our old languages are the norm because of their unique features. I think the answer is just knowing it there, oh, because modularity is a good idea and it turns out that they originally got it from oh, by chance, okay, which brings us to the end. part style, functional programming style. I am going to claim without any evidence that it avoids mutations and side effects. I say this because I've talked to a lot of people about this and this seems to be some sort of consensus, but at the end of the day, no one is completely sure that there is no authoritative source that we can go to to say what the FP style, so I'm going to state what this is and hope you'll stick with me, obviously, as if there were no language features.
Programming this style is required as you can almost do this in assembly, I'm not saying it would be nice, but in theory you can simply choose not to mutate to choose to have no side effects and most languages, certainly any procedure, having said that obviously, similar languages differ. in their support for this style, some languages are very conducive to programming style, others make it quite difficult, like assembly, so why isn't FP style the norm? Well one argument is just that it's just a matter of time, like he just hasn't had enough time in the spotlight and just like over time he'll become more and more normal until he eventually becomes a species standard.
This is actually a pretty compelling argument, so if you look at the Kotlin FAQ, he says: Is Colin an object-oriented language? or a functional one and the answer is hey hey hey we have both we have oh oh and we became functional like you can use both this is not what you would see in the Java dialect FAQ from the 90s that just didn't exist back then but like These days, functional style is considered a selling point, I mean, oh no, people agree that functional style is good now, don't worry, we support, we have good support for that in a language , remember that we are the main thing.
I have some support for Java, even like Java functional programming and Java like this, this is a real thing. Python sure is the top three languages right there, all these huge selections with C++, there's multiple C++ functional programming in the C++ books, I mean, this is a change, this is, none of these things would have existed in the years 90, no editor will say, oh yeah, like functional programming in C++, let me sign you up, I'll give you a good preview on that like no, this is this. It's a sign that people are accepting the idea that they know what functional programming style they really like.
I don't think people know the languages yet, but the style is gaining ground and I think this is interesting because if at some point in the middle of a transition from op2 style to Fe style, maybe this hybrid is an intermediate stage on the way towards FP becoming the norm, that's something plausible now, how long are we talking about? I really do not know. I mean all this talk, we've been talking on decades-long timescales, so it could be that maybe we're in the middle, but really the middle is like maybe we have another decade or two.
You know, maybe people will start saying that in my next project I'm going to try to adopt language that's really good at this and not just okay at that, as a side effect, no pun intended, and at that point, who knows, maybe that. that changes these classifications, maybe that influences people's decision about what programming languages they are using. Well, to summarize why functional programming is not the norm, it's complicated, but I think we've learned a lot about some of the factors that go into this, we talked about the paradigm and the style of the language, why FP languages aren't are they the norm?
The practice in all languages is to encourage composition over inheritance and without inheritance, since objects and methods are basically not just different from structures and procedures, so I think the answer is no, it's not that oo does that languages become popular, it's just a coincidence that there are just a lot of them, it's just in the way and finally I'm wondering why FP style is not the norm. Well, I think it's only a matter of time before it's becoming the norm. I think it's something we can all appreciate and look forward to in the future. Thank you so much. a lot of questions yes, yes, sure, yes, so um, how do you sue?
How do you see a proper lease in the July image? Is that programming language functional or fucking functional in your mind? Oh man, so you're opening a real can of worms here, so, The question was: how do you see the list fitting in here? Is it a functional programming language or not? So actually this talk was cut down to 40 minutes from about two and a half hours because I had a lot of material in this one of the questions that I started asking people are like and just think about this because it can fry your brain after a while. , it's like if you look at a programming language and decide if it's a functional programming language or not, how do you do it? you do it and I would just go to people and ask them this question and they would say oh well it's this and I would give them a counterexample like well no it's not like it's this so I'll just recite a couple so okay then is a functional programming language if it has support for first class functions like okay then java is a functional programming language no no java but they have to be pure okay then oh camel is not functional . programming as closure is not functional programming no, no, this counts, but okay, you need it as immutability, that's right, that's important, okay, but like this, then, rust is functional programming, there is this, it's immutable by default, even no, no, it's not like that, but you know. you just go around in circles, one person suggested a score like if you have a certain number of things checked then you would cross a threshold and be functional, but in the end I ended up concluding that, to be perfectly honest, classifying languages as functional or not is not the right thing to do. same. somewhat arbitrary, definitely very confusing and ultimately not as important as talking about the style and its support for the style, like being able to avoid mutations and side effects and still have a really good experience, so to respond directly to your question, like what I say that Lisp is like a good functional programming language.
I'd say it really depends on the list, like if there's a list where every part of the standard library requires you to mutate things and do side effects, it might not be closed for good, so I think. It really just depends on the language, yes I'm awesome, thank you very much, thanks for the performance for the ingenuity, yes it isone of those things where the fight is a little slower. C++ is meant to be fast, so people often talk about this with FP because there are reasons you can ask your intern. I was wondering what you thought about performance as a kind of similar aspect of this discussion.
That's a great question, yeah, so the question was, do you know what a factor performance plays in this? So I think performance is one of those secondary concerns. That doesn't necessarily make a language popular or not. I think it affects more the areas in which it can be used. For example, some applications only need the level of control over memory that C and C++ give you. and if you look at Rust, Rust is one of the first new competitors in that space that's viable to challenge for the C and C++ crown in a long time because of that, so I think if you need that level of control over performance, you'd probably You won't go for a functional language, so you probably won't go for any garbage collection language, you know, you just need to be able to manage memory directly, but as we've seen, there are a ton of domains where that's not true, in fact. , like almost everyone else, so all the other languages now in the top ten except C and C++ are garbage collected, so I think as far as performance goes, it really depends on what your performance needs. um, if you're writing as a backend server language, in many cases you don't like it, you know Python is perfectly acceptable since it's not that fast, but a lot of people say, yeah, but it's okay, it's good enough. like to be dominated by the network in the database anyway, so who cares?
I think it's really domain specific and generally to answer the question I would say performance is a consideration but it's pretty secondary. To the other factors I talked about before I also don't think it's true that functionals last performance, but that's like a myth, it's just not that if you have a mutation and you can do it everywhere, then certain algorithms are available to you. which are otherwise not available, but if you're not using those algorithms anyway it doesn't matter, and there are also certain performance optimizations that you can only get if you have certain functional guarantees, so yeah, after continuing for a while thanks come back to teach thanks
If you have any copyright issue, please Contact