Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Getting Started With F#

DZone's Guide to

Getting Started With F#

This post is a list of resources for learning F# and overview of my mini-project: Stock Estimator. Read on for the full list and more details.

· Web Dev Zone
Free Resource

Should you build your own web experimentation solution? Download this whitepaper by Optimizely to find out.

I couldn’t resist anymore, and I finally tried F#. For the first two days, it was painful. Some elements of F# syntax are weird. However after getting used to that, F# became a joy, and instead of a week (as I planned) I spent almost two months with F#.

Getting Started

Deep Dive

There is also a book written by Jon Skeet and Tomas Petricek: Real World Functional Programming: With Examples in F# and C#.

Testing

Web Development

The most popular F# Web Framework is Suave. There is the SuaveMusicStore tutorial (code), which is inspired by ASP.NET MVC Music Store tutorial. If you want to build Web APIs with F#, check Building REST Api in Fsharp Using Suave.

It is also worth to check End-to-end Functional Web Development by Tomas Petricek where he showcases building a web app with Suave.

For more, check Web Programming with F# Guide.

Stock Estimator

I created an F#-based app for predicting future stock prices (a $1,000,000 idea!). The back-end is written in F# and communicates with a stock data API (Yahoo Finance) through an F# type provider. There is also Suave Web API (microservice), and ASP.NET Core web app that communicates with it. The front-end is powered by Aurelia Framework and D3 library. In other words, I built the F# microservice, consumed it from a non-F# app, and have reusable logic in a separate project. All communication with microservices happens through the client (with Aurelia Framework). So, there is no usage of F# from C#, but… I also created a simple Console app (with C#) that uses mentioned F# logic. There is also a Windows Forms app for displaying estimates, written in F#, that also has use reusable logic.

Entire source code is available on GitHub. Check it out!

Summary

Programming in F# is pure joy! It’s a great language for working with data. Moreover, F# fits perfectly into today’s world of microservices. You don’t have to rewrite your existing app or create an entire app with F#. You can just create one microservice with F# and see how it works for you!

Implementing an Experimentation Solution: Choosing whether to build or buy?

Topics:
f# ,tutorial ,web development ,getting started

Published at DZone with permission of Jakub Jedryszek, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}