Over a million developers have joined DZone.
Platinum Partner

Develop Web Apps in F# with WebSharper

· Web Dev Zone

The Web Dev Zone is brought to you in partnership with Mendix.  Discover how IT departments looking for ways to keep up with demand for business apps has caused a new breed of developers to surface - the Rapid Application Developer.

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.

The Web Dev Zone is brought to you in partnership with Mendix.  Learn more about The Essentials of Digital Innovation and how it needs to be at the heart of every organization.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}