Mitch Pronschinske is a Senior Content Analyst at DZone. That means he writes and searches for the finest developer content in the land so that you don't have to. He often eats peanut butter and bananas, likes to make his own ringtones, enjoys card and board games, and is married to an underwear model. Mitch is a DZone Zone Leader and has posted 2569 posts at DZone. You can read more from them at their website. View Full User Profile

Develop Web Apps in F# with WebSharper

01.22.2010
| 9101 views |
  • submit to reddit
F# is a relatively new language for Microsoft's .NET framework that is quickly gaining momentum in the financial and scientific software development communities.  IntelliFactory believes that it can forge a new path for F# in the mainstream web application space.  In less than two weeks, the company will debut their WebSharper platform for writing web apps in F# that are easily compiled into JavaScript for the client-side.

F# is a three-paradigm language that uses imperative, functional, and object-oriented programming (class-based).  New programming design approaches that are not easily expressed by just objects are possible with F#.  The functional programming capabilities can also lead to some mind-bending code.  F# is a strongly typed language that uses type interface so that data types don't need to be explicitly declared.  It includes a functional programming component that supports eager evaluation.  The language also uses pattern matching to resolve names into values.



In ASP.NET development, F# also offers productivity advantages over VB and C#.  F# is different because it is statically checked and type-safe.  It addresses weaknesses in ASP.NET development like untyped values, complex form construction, and using strings for IDs and method names that connect markup with code-behind (class-files).  

Writing a web application in F# on the WebSharper platform can be less-time consuming if a developer is not great at writing web apps in JavaScript.  Through WebSharper, developers can write a web app using a large subset of F# and .NET core libraries and then just let WebSharper map the code to JavaScript.  WebSharper can integrate with ASP.NET applications, but it is different from the standard approach because it builds applications from miniature web pages called "pagelets".  The pagelets correspond to functions on the client-side and they are automatically translated into JavaScript.   

WebSharper supports a wide range of JavaScript libraries, making it easy for developers to optimize their code in whatever way they choose.  jQuery, qooxdoo, Flapjax, and Yahoo UI are all supported by WebSharper.  The leap from F# to JavaScript is manageable because both are functional languages that support lambda expressions and closures.  Another unique part of WebSharper is a "formlet".  A formlet is a special pagelet that provides form functionality.  Formlets in Web Sharper run and validate on the client, submitting their result to a either a client- or a server-side callback.

                                                                       jQuery auto-complete



WebSharper will be released on February 8th.  Pricing has yet to be determined, but customers will be required to pay for support.  WebSharper comes fully integrated into Visual Studio.

Want to get ahead of the curve before F# really takes off?  DZone's Essential F# refcard can jumpstart your exploration into Microsoft's newest language.  The card was authored by Chance Coble and Ted Neward.

Comments

Mauricio Scheffer replied on Sat, 2010/07/17 - 8:11pm

There are a number of serious errors in this article:

> F# is a strongly typed language that uses type interface so that data types don't need to be explicitly declared.

There's no such thing as a "type interface" in this context.

> It includes a functional programming component that supports eager evaluation

F# does not include such a component, F# is an eagerly evaluated functional programming language.

> The language also uses pattern matching to resolve names into values.

That's not what pattern matching is.

> F# also offers productivity advantages over VB and C#.  F# is different because it is statically checked and type-safe. 

Both VB.NET and C# are also statically checked and type-safe. The advantage of WebSharper (not F#) is that it also type-checks views.

> The leap from F# to JavaScript is manageable because both are functional languages that support lambda expressions and closures.

No, this is possible not because of language similarities but thanks to F# code quotations.

 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.