Now that we’ve seen the awesome new stuff in Xamarin Studio for F# let’s go a bit further and actually use some of those improvements to our advantage. However, instead of just a regular blog post, I thought it’d be worthwhile to do a screencast for y’all.
You can view the demo code directly on GitHub. Enjoy everyone!
With the (almost) stable release of Xamarin Studio 6 comes a ton of great new improvements. I absolutely love the new dark theme! However, some huge improvements were made to the IDE for F# support, as well. Improvements that I feel may have gone without much notice. So I wanted to help get those improvements out in the open more as well as to recognize the folks that made all of this happen. At the time of this writing, I’m running the alpha build (v6.1) of Xamarin Studio.
Speaking of recognizing folks, huge shout out to Dave Thomas and Jason Imison for all their hard work in getting these improvements into Xamarin Studio. F# in Xamarin Studio would be nothing without these guys.
Xamarin Studio 6 now includes project templates for Xamarin Forms in F#. This is a pretty big update since, before, you couldn’t even add a PCL project in F# in Xamarin Studio.
With this you can start creating cross-platform mobile applications with Xamarin Forms in F#! While this was doable before, it is much easier without going through a few workarounds to get things working. Just select this project and the templates do everything for you.… Read more
It’s F# Advent time again! This is a yearly event the F# community comes together for the month of December and each person releases an F# related post on a day of their choosing. Today is that day for me this year.
With the recent announcement at Microsoft’s Connect() conference, Visual Studio Code now has an awesome update that can install extensions. With me being an F# fanatic I got excited to see that actually using F# is one of the first extensions available via Ionide which is originally made for developing in F# in GitHub’s Atom client.
While you could technically already “use” F# in Visual Studio Code, it was only for syntax highlighting. You couldn’t run any of the code. This quick post will help show you the steps to started developing F# within Visual Studio code.
While this will be a short post it’s also one that may be one of the most important ones to go over – running unit tests. Most of you probably know that being able to run tests early and often can save a ton of time if issues are found later on. One way to do this is to be able to execute your tests as easy as possible and this is possible within your FAKE script. Once again, FAKE comes with functions to be able to execute our tests in any framework you may be using.
Of course, before running our tests we need to build the project. As we’ve seen in the previous posts, we’ll build the project with the MsBuild function.
let testProj = !! "FakeDemo.UnitTests/FakeDemo.UnitTests.csproj" Target "Build-UnitTests" (fun _ -> testProj |> MSBuild "FakeDemo.UnitTests\bin\Debug" "Build" [ ("Configuration", "Debug"); ("Platform", "Any CPU") ] |> Log "---Unit Test build output----" )
Now here is another cool thing I really like from FAKE – they include helper functions that execute the tests for us. All we need to do is to pass in some configuration and we’re good to go!… Read more
Continuing from part 1 of this series we now have FAKE setup and ready for us to use our automated building needs. Now let’s build our Xamarin Forms application. In here we’ll go through how much FAKE helps us out by including built-in APIs that allow us to easily create our build targets. If you’ve never seen a FAKE build script before, you may be surprised by how little we need to do, since FAKE has all sorts of APIs that can be leveraged.
Of course, before we can really do anything else with our application we need to make sure everything builds so that will be the focus of this post.
In here we’re going to utilize FAKE’s Xamarin Helper library to help us build our iOS application. For our PCL and Android applications, however, we will just use FAKE’s MSBuild helper method as it doesn’t need anything special to build like iOS applications do.
The full script is at the bottom of this post and can be also found on GitHub, but let’s first break it up and talk a bit about each build target.
Being a .NET developer, I’m sure one of your pain points throughout the development process in any project has been trying to setup automated building, testing, and even deploying. However, build tools have been evolving much like other development tools and have been getting much, much better. I’m sure most of you have heard of Rake and there are a ton of other tools that can be used as well. One of those tools we’ll be using here is FAKE – F# Make. I do believe, however, that the concepts you can learn here from FAKE can translate to other MAKE-like build tools such as Rake or Cake if you do decide to go with this similar concept.
In this post, we’ll introduce FAKE and show how to set it up in your project as well as a basic FAKE build script. The full source is available on GitHub and will point to all the code in this section.
While it’s not crucial to have a deep knowledge of F#, some aspects of it can be a bit helpful, such as being able to tap into the community for support and leveraging functional concepts available in F#. While a good bit of the F# projects use it for their building needs, you may recognize a few other projects that use it as well.… Read more
One of the best and easiest ways to use F# in your projects is to use it for unit testing and the same can be said for your mobile applications with Xamarin.
While C# has FluentAssertions as well as Should (I prefer the syntax of FluentAssertions between the two) F# has FsUnit to give more readable test conditions. I would say even more readable than the C# equivalent.
With this post I’ll have a small demo Xamarin project using Xamarin Forms to build the UI. This will consist of a simple navigation and a small class to do some logic. We will use F# for our test project to test both the logic and use Xamarin UI Test to make sure our navigation and screens appear as we intend. These tests are also to make sure our workflows work as intended on several different devices.
Let’s quickly compare the two and see how they look. Within our demo Xamarin application, our PCL project that includes our XAML for Xamarin Forms will also have a class to do some logic for us. For demo purposes, this will just be an
Add class that takes in two integers and adds them together and returns the result.… Read more
With the latest news of the release of Visual Studio 2015 some folks may not have realized but included in it is the newest release of F# 4.0. The .NET Blog has also officially announced the RTM. The most exciting thing about this release of F# is that, since F# has been open source for quite some time now, most of the fixes and updates were made by the F# community.
What exactly is different in the new version of F# is very nicely highlighted in the below video by Lincoln Atkinson.
However, there are quite a few other new features. Let’s take a quick look at a few of the ones I’m excited about.
I’m sure I’m like most of the folks who mess with F# that they do a lot of their work with F# scripts and the F# Interactive, however before F# 4.0 there was no way to debug your scripts. Now we get the best of continuing to use scripts and being able to debug them!
As Lincoln mentioned in the above video, all functions are now normalized across
Array collections. This means that you can access the same functions among each of these collections where as in F# 3.1 that wasn’t always the case.… Read more
While we certainly have been busy getting our hands dirty with Xamarin I’ve been doing some of my own. However, I’ve been messing around with using Xamarin with F#. I mentioned in a previous post that F# can be used very well for enterprise applications. Here’s an in depth look at F# with Xamarin for mobile applications.
But why F# with Xamarin, you ask? Well, it just turns out that I love working with both of these technologies and I got lucky that the awesome folks at Xamarin and Dave Thomas – who does most of the great work with F# for Xamarin – decided to take on F# as a first class language.
Before we get started, it’s helpful to remember that, in F#, if you reference any other part of your code, whether it’s in the same file or not, the part you are referencing needs to be defined before you reference it. More info can be found at the wonderful F# for Fun and Profit site.
Currently in Xamarin (at the time of this writing – version 5.9) there aren’t any actual Xamarin Forms or PCL templates. Though, it is rumored there will be more templates in 6.0.… Read more
Though I have posted a few times on some of the awesome things F# can do for your code, that doesn’t necessarily mean it’s always good choice for each of your applications. You may look at the code features and and some sample code and think This is great, but I can’t see this being used other than in finance or data science projects. True, F# may be used fairly heavily in those areas, but I’d like to argue that it can be quite useful in enterprise applications, as well.
Lena, a fellow F# developer, has a very thought provoking article talking about F# in the enterprise especially when talking to decision makers at companies. I figured I’d expand on Lena’s post and offer my own thoughts to using F# in the enterprise.
The main thing about F#, that I’ve found, is that people often ask I like it, but where can I use it in my day-to-day development? Well, hopefully the below list will help out a lot and may even cause you to rethink what all F# can do for you.
Mobile applications are probably not exactly the first thing you’d think when you hear F#, is it?… Read more