Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are functional languages and programming models like MVC just the next big fad?

Of late, I've been hearing many good things about functional programming languages such as F#. Additionally [and unrelated], I'm also noticing MVC is starting to get a lot of exposure - perhaps since the introduction of Silverlight/WPF.

I've never been one for jumping on a bandwagon without first doing my research - in fact it took me a little while to make the leap to .NET. Someone just commented in one of my previous questions about early adoption of new technologies and it made me stop and think.

I have been fighting to find time to learn WPF but am now starting to wonder if that's the way to go. Are languages such as F#, and the MVC programming model here to stay or are they just the next fad? Or do people really see these as becoming a potential replacement for C#/VB and OOP?

Most of my development is on in house applications either in the form of rich web applications for deployment on the intranet or winforms utility applications for distribution on individual machines. My technologies of choice this far have been pretty standard - T-SQL/PL*SQL, C#/VB, JavaScript/AJAX, CSS.

I guess what I'm struggling to determine is what blend of these technologies would be the most productive/useful to have in my toolbox in the near future?

like image 223
BobTheBuilder Avatar asked Nov 28 '22 00:11

BobTheBuilder


2 Answers

Neither is a fad, and neither is going away any time soon, but in reality I only expect to see one of those two in regular usage by most .NET devs...

There's a big difference between F# and ASP.NET MVC; F# is a functional language - this has a number of advantages in a few scenarios, but for most line of business programming a general purpose language such as C# is generally more usable. There is, however, lots to be gained from knowing about the functional style of programming (especially re immutability). I looked at F#, and I hope it improves my C# even if I never write any production code in F#. Fortunately, thanks to delegates and lambdas, C# can be used in a functional way, even if it isn't formally FP.

ASP.NET MVC, however, is a very different beast; MVC (more generally) is a known, established and trusted pattern that:

  • vastly improves the testability of the presentation tier
  • makes a logical separation of concerns at the UI tier
  • provides more direct access to the underlying html of the page
  • and a lot of other things (model binding, etc)

Or another way: to a lot of people, it makes ASP.NET finally make sense; I fully expect to make a lot of use of ASP.NET MVC in the coming year.

like image 193
Marc Gravell Avatar answered Dec 19 '22 11:12

Marc Gravell


I find it very strange to lump functional programming and MVC in one question; I find them in no way related, other than that both are over 30 years old and very well established in their communities. Since I know something about functional programming I will speak to that.

Functional programming is almost 50 years old and is here to stay, although it is not clear if it will ever become mainstream. What is clear is that functional languages have acted as incubators and then proving grounds for features which eventually find their way into maintstream languages. Some examples:

  • Garbage collection
  • First-class function closures (added to Perl in 1995, in all scripting languages since then; present in Smalltalk-80; emulated in various ways in Java and C#)
  • Parametric polymorphism (templates in C++)

In the long run having functional techniques in your toolbox will make you a better programmer. Or as Eric Raymond says, learn Lisp. (Both Lisp and Haskell are loaded with powerful new ideas that will make your head explode in different, incomparable, but useful ways. F# is more of a consolidation of the very best proven ideas from functional languages, married to the .NET framework. In early 2009, it appears to have the best chance of becoming mainstream.)

like image 42
Norman Ramsey Avatar answered Dec 19 '22 11:12

Norman Ramsey