Hi, so, when did functional programing become such a huge thing that every language implements. What led to it's popularity? And I'm sure some of you may be wondering: now that we have functional programming in mainstream languages, what's next? Well, I'm going to attempt an educated guess at that. But, first, we need a history lesson of the different programming paradigms, and why they came to be implemented in the popular languages that businesses use each day.
As usual, hardly anything in computer science is "new". There was a LOT of experimentation in the 60s and 70s with different programming languages and thus different paradigms. I'd argue to say that everything language related has been tried at least once during that time period even. I'm not going to cover that here though, instead I'm going to cover their introduction to mainstream languages.
Also, one last thing: This is mostly educated guesses. I have no proof to back me up. It's about like answering "why did Pokemon become popular"... No proof exists, but we can make guesses at why.
The First Mainstream Language
First, we have procedural programming. This was especially well marked with the creation and rise of C. The reason I believe this became popular was because you could write code which could translate very closely to assembly language. Resources were scarce, but writing directly in assembly language had begun to be impractical. Now, you may ask, why didn't other paradigms become popular at this point?
I'll list the problems with each paradigm:
Functional programming was there with Lisp and friends. However, garbage collection is practically required and never comes free. With resources being scarce, this was not the best way to go. Also, at this point most people knew assembly language and still were familiar with low level details like punch cards. Putting a huge amount of abstraction on top of that concept meant that it would be quite hard to learn
Stack-oriented programming was there with Forth and friends. This didn't require garbage collection, but was still a huge layer of abstraction on top of the actual instruction set. Despite this, it didn't mean it was slower. My best guess is that this was harder for assembly-skilled programmers to adapt to.
Ok, so it's seen now that procedural programming is the best step forward from assembly coding because assembly basically is procedural programming. C introduced many things though. The biggest thing is it made cross-compiling feasible, and the language was fairly simple which made making new compilers easy. Looking into all this in detail though really makes me wonder why Forth didn't win out against C for the most popular mainstream language.
Object Oriented Programming
Next on the list of big paradigm shifts: object oriented programming. This of course existed long before it went mainstream. The turning point that it really became popular was with the rise of the GUI. Objects are a natural fit with GUI elements. My guess for why it didn't go mainstream sooner is because it made compilers more complicated and have to worry about more than just doing a single pass at code and calling it good. Eventually, compilers caught up though and C++ replaced C for the main programming language spot. This idea of object oriented programming really got kicked into mainstream with the popularity of Java. You can see some more history about object oriented programming at this very helpful Programmers.Stackexchange answer
So, what's next? Probably the biggest one is garbage collection. Memory(and good collection algorithms) were finally cheap enough to let programmers forget about managing memory. Of course, this existed long before it went mainstream, but most programmers considered it slow and wasteful(which it arguably was at the time). I think the big reason garbage collection went so mainstream is because we finally reached a tipping point where computing time(and resources) were cheaper than programming time.
Generics would probably be next: statically typing an object which can take more than a single type. C++ had it first of course. I'm not sure if it became "mainstream" before it hit Java and .Net or not. It arguably has been popular for sometime now. Ada has had generics since it was first designed in the 70s. I believe the primary reason for generics becoming so mainstream is because object oriented programming became mainstream. Doing OOP in a statically-typed way is quite cumbersome without generics. People were beginning to realize that duplicating code and using tons of explicit casts was really a bad practice.
So, what's next? This is only a guess, but I this is what I think the big paradigm of the next decade will be
I'm of course no stranger to this. I use T4 in a lot of my projects. It's a way to take tedious code and turn it into something that just-works, and wouldn't be possible by other means. Another example of this is all of the dependency injection things out there now. That's really just a step away from metaprogramming. Writing programs which write themselves. And of course, reflection with .Net (and Java?) is common place already. However, there aren't many mainstream languages at this point which make metaprogramming particularly easy. However, we're already seeing a rise in this with mainstream languages like Ruby and Python. Where I think metaprogramming really shines though is in statically-typed languages... where there isn't a lot of easy to use support other than some fairly basic APIs. T4 of course is an exception(and my favorite one), but even T4 has definitely not made it to mainstream usage.
So, why isn't metaprogramming already all the rage? I think the big reason is compiler complexity. It can be an enormously difficult thing to implement an interpreter within a compiler. Other than this though, I truly think it's just a matter of time. This is why I do not have a good reason for why it isn't already the rage. All of the problems it use to have such as code bloat and memory issues really don't matter a whole lot now.