My Takeaways
This is the concluding part of my blog series on Web Application Development in Fsharp using ASP.NET MVC
I would like to begin this blog post by thanking John Sonmez for his inspirational video on the importance of finishing what you started. I haven’t written any blog series like this before, so during this course, I was about to give up but the statement
Finish what you started
kept me going. Thank you John, I have learned a great lesson in my life from you.
Back to the business, In this blog post I am going to share my key takeaways on developing a complete web application in fsharp using ASP.NET MVC
Enterprise application development in fsharp
As a learner of F#, I have spent lots of time in listening to the great talks by the vibrant fsharp community. Though those talks are great, I was intrigued, how these individual pieces would work together in creating a complete enterprise application. Is it really possible?
Developing this complete fsharp-phonecat application answered my questions and I am sure it answered yours too. It may appear hard because of less sources and functional paradigm, but once you figured it out, it would be a cakewalk.
The bottom line is we can create a complete enterprise application in fsharp. As a matter of fact, there is a book written on this subject, F# Deep Dives
If you are not convinced yet, read these testimonials from the commercial users of F#.
Leveraging the existing .NET ecosystem
In my perspective F# is a pragmatic functional programming language. In addition to lot of elegant features of the language, it works seamlessly with the existing .NET libraries. This one characteristic I would say is a blessing. You can say, ‘This feature is really cool’, but at the end of the day it should help you to get the job done. F# is not only cool, It can help you too!
In the sample application we have leveraged the Web Api 2, Razor Views, Asp.Net Identity and the Asp.Net framework itself. So, you can do whatever you are doing in C# in F#! ( With less lines of code )
Using F# in your existing C# Codebase
As F# is a CLI Language it can be added to your existing C# solution. All you need to do just create a new F# project in the solution and this project can work seamlessly with the other projects in the solution.
In the sample application, we have a created a parser for a search criteria DSL using FParsec. Doing this in C# would be very hard. So we can easily wrap this F# implementation in a class library and use it from any C# codebase.
In the step-5 we have automated build process using FAKE which is far better than its counterpart verbose MSBuild xml files. This can be used in any .NET projects!
Less is beautiful
Another cool aspect of F# is you will be writing less lines of code to achieve complex things. It took only 35 lines of code to create a parser for a DSL.
Railway Oriented Programming by Scott Wlaschin is an absolute gem. If you would like to know what F# brings to your plate, I strongly suggest you to listen his talk on Functional Design Patterns. The way you see programming will never be the same after you have seen this presentation.
Summary
In nutshell, F# is just an awesome programming language to create applications. I hope you would have enjoyed this series. If you have any suggestions, kindly leave a comment.
I would like to conclude this post with the below formula
Python + .NET = F#