views:

961

answers:

11

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?

+1  A: 

No, they are not fads. And no, people do not see these as becoming a potential replacement for C#/VB and OOP. People will use them if it saves them time or money.

I think you have to make the call of hopping on the bandwagon and see what other smart guys are excited about, or close your eyes and hope the storm passes in a few years. Some technology will stick while others don't. MVC is as old as OO and functional programming is as old as programming, though.

eed3si9n
Yet MVC and FP are really only just starting to get the exposure that OOP has been getting since... well forever. Why if they're so old and so useful are they only just starting to become more popular?
BobTheBuilder
Internet and database has been around since the 1960s. Sometimes it's just random things in environment like having access to PDP-10 from high school. Or maybe the computers are getting fast enough or the "real world" programmers are catching up to academia.
eed3si9n
A: 

Im sure C# and VB will be there forever... but there will also be a lot of people going in the edge with new technologies. They will be able to do more with less code and you will be able to do more with the code you already have. So dont worry it will be a fair fight.

Even tho... learning more stuff makes you better programming so... its up to you!

what im saying is that theres a lot of fuzz on how learning more languages is great to know what each language is capable of and then use all that information to make better code. But if you spend that same time dominating a language, your gona be fine.

DFectuoso
+12  A: 

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.

Marc Gravell
I will just note that Nemerle is more usable than F# for LOB. Everything you know from C# works in pretty much the same way. The biggest change you will see is just that: immutability by default (and better type inference and less verbose syntax than C#).
Alexey Romanov
The biggest strikes against it: no refactoring support except for renaming; the Visual Studio integration, while quite usable, is far from perfect, and I haven't tried WinForms or WPF designers yet.
Alexey Romanov
Apart from designers, what makes F# _the language_ less suited to "line of business" applications? (I.e., not "none of my people know F#", "my app is already in C#", etc.)
MichaelGG
I've been using MVC in C++ and Java on several large projects for more than 10 years (first as a roll-our-own MVC in C++/Java, then later using Struts in Java). Definitely not a new fad.
Ogre Psalm33
I was referring mainly to ASP.NET MVC; apologies for any confusion
Marc Gravell
+4  A: 

As to MVC, it was introduced in 1979. I remember implementing it for the first time in my career in Aldus Persuasion for Windows (a one-time competitor to Powerpoint) in the 1988/89 time frame. MVC frameworks are all the rage in RIA applications such as Adobe Flex-based web programming (Cairngorm, Mate, PureMVC, etc.).

In my company our first Flex app was not done as MVC, yet we had multiple views into the model. It got to be a mess. We refactored to MVC and life got way better for the developers.

As far as I can tell it's only the folks that try to implement MVC on the server-side via any of the various web frameworks, that are the ones the complain about MVC. The Fallacies of Distributed Computing would have informed them that it was a bad idea to do MVC where the presentation rendering layer is separated by the gulf of a network connection. Distributed MVC is just as bad as distributed objects.

With RIA web apps, such as those based on Flex, MVC is done purely on the client side - just as it was introduced in Smalltalk graphical workstations back in '79. RIA clients then only use async service calls and/or messaging to communicate with the server-side.

For an app that did nothing but throw up a single CRUD form, then yeah, MVC might be overkill. But for rich GUI apps that have a fair amount of complexity going on, MVC can remain a very sensible pattern to adopt.

RogerV
+8  A: 

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.)

Norman Ramsey
I didn't really lump them together because they're related, rather that they're both getting excessive exposure of late and I wondered if they are something I should be looking to add to my toolbox
BobTheBuilder
+1  A: 

Not at all.

Functional programming languages have been here for decades.

Programming models as "MVC" that is actually a design pattern and there are many frameworks using it by some years now.

Probably the only new thing here is your perspective. You didn't knew they existed or they were so wide spread used until they came to the MS world.

My first job was using WebObjects Framework from Apple comp back in 2000. It is very easy to develop with it.

OscarRyz
+5  A: 

I've been seeing a lot of this sort of thing on SO these days. (See here, here, and here for a few examples.)

According to Wikipedia, Lisp is the second oldest programming language still in common use today (beaten out by Fortran). Functional programming is no more a fad than the transistor, the mouse, the computer monitor, the hard drive, or, indeed, the very notion of a personal computer, none of which were present at Lisp's inception in 1958. It is true that functional programming may not be particularly useful in a typical business environment, but its waxing and waning levels of popularity do not make it a fad, nor do they make it a toy. Programmers with a keen appreciation of computing science understand that functional programming isn't so much an invention as it is a discovery--a deep insight into the fundamental nature of computation.

More to the point of your question, if programming is your day job (as opposed to a true passion), is F# a waste of your time? It probably is, in the sense that it is not likely to ever become popular enough to warrant including on your resume. It's also worth noting that if you do invest the time to learn F#, but none of your colleagues can understand your work, you may be doing more harm than good by choosing it as a development tool. That still doesn't make it a "fad." :)

As for MVC, that's been around for a long time now--probably over a decade, but I haven't been keeping track. It's not a silver bullet, nor is it difficult to grasp; it's just another development pattern. It's also worth paying attention to the fact that MVC is not a standard or even a very well specified tech. There are many different ways to interpret MVC, and I would even venture to say that there is more than one right way to do it.

MVC happens to be particularly useful for web development because web applications tend to have very messy front-end code (supporting all of those different browsers is a royal pain) and the last thing you want is to have your business logic mired in with the front-end unnecessarily. Unlike F#, learning MVC is not a waste of time even if programming is strictly just a day job for you, because if you ever find yourself working on a web application, adherence to MVC (even simply loose adherence to it) can save your ass from professional embarrassment.

Parappa
Thanks for pointing out those links - I did attempt a search to make sure I wasn't repeating someone else's question but didn't come up with anything useful, I appreciate the additional resources.
BobTheBuilder
I've had F# on my CV for a while now and it's helped me find a couple of well paid jobs.
Robert
A: 

From the (extremely) basic knowledge I have of functional languages - they MAY have a high place in our future as developers. Many smart people have commented on the fact that since processers aren't getting quicker, more cores will need to be used. Thus parallel programming will become more mainstream. Functional languages are suited to parallel tasks as they do not maintain state (effectively eliminating most of the common problems associated with parallel programing/threads, such as locks etc).

For more information on this particular point I'd like to direct you to this article which discusses mutable/immutable data, and compares c# and f# code snippets.

Josh Smeaton
+2  A: 

The practical use of functional languages in development code depends entirely on what domain you are coding for. As stated in other answers, for classic 'line of business' apps, if you already know C#, you're not likely to be switching to F# any time soon.

HOWEVER:

  • Not using it in development code doesn't mean that it can't be useful elsewhere (analysing data for example, or prototyping algorithms without getting bogged down in OO noise)
  • Learning a functional language will teach you another way to think about coding, which will probably be beneficial to your C#
  • Learning a functional language will also give you greater insight into the functional aspects of C#
  • To complete my list - even though this has been repeated and repeated elsewhere in SO - nobody is suggesting that F# will replace C#, it's just another tool in the box. 'Buying' that tool may be too expensive if you don't need it right now, but at the least, you should try to understand what it does, for the day when your current toolset doesn't suffice.
Benjol
+1  A: 

Functional programming has a who host of advantages as a paradigm: It offers many of the same advantages that object oriented design does when working in smaller teams (data encapsulation, polymorphism, code portability...) It is less prone to bugs due to the immutability of data, and stateless nature. It is easier to thread.

A: 

I won't speak on the viability in web apps for MVC... for those of us developing frameworks which have outlined clear patterns - it is just another way to skin the same cat. I have never struggled on the overall picture of ASP.NET, so to think MVC somehow makes it simpler is often a misnomer. It may be useful for one approach but not all approaches - thus falling to yet another tool in the toolbox.

Is what we need really another tool?

Dave F