Silicon Valley Code Camp : October 8th and 9th, 2011.
Clear Lines Consulting
I have been writing software on .NET for 10 years, mostly C#, until I fell in love with F# and functional programming. I enjoy arguing about code and how to make it better, and get very excited when discussing testing or F#. My other professional interests are applied math and machine learning. If you want to know more about me, you can check out my blog here or find me on Twitter as @brandewinder.
If you want to write “clean code that works – now”, you should look into test-driven development. In a nutshell, the idea of TDD is to first write automated tests, and only then the code that should pass the test. It is a simple and methodical way to write good code, fully tested from the get-go; beyond that, it also promotes better design, and helps keep your sanity during projects. My goal in this session is to get you started with TDD, so that you are ready to use it the moment you leave the room. I will demonstrate how TDD works on a small example, using open-source tools like NUnit. This session is aimed for beginners.
If you want to prove that a complex system works, a good place to start is to check that each piece is working right. Unit testing intends to do just that: take a unit of your code, and verify that it behaves properly. Unfortunately, in “real” software, classes interact with other parts of the system, which makes testing in isolation difficult. Mocking is a technique designed to overcome that issue: replacing dependencies by Mocks, lightweight versions of the “real thing”, allows you to validate the interactions of a class with its “collaborators”. I will discuss reasons you should care about mocks, illustrate how you would go about addressing them by rolling your own mocks & stubs, and demonstrate free, open-source frameworks, Moq, Rhino.Mocks and NSubstitute, which greatly simplify the process. Mocks and Stubs can sound intimidating – the goal of this presentation is to demystify the topic and give you a clear understanding of what they are, where they can help you, and to give you a good quick-start so that you can productively use them in your own code.
With the release of Visual Studio 2010, F# discreetly joined the family of .NET languages fully supported by Microsoft. Like C# or VB, F# is object-oriented and imperative. Unlike them, F# is also a functional language. This makes F# an excellent complement to existing mainstream languages: it interoperates smoothly with them, and handles some problems much better. While not a mainstream .NET language just yet, it has enjoyed a solid adoption in industries such as finance or bioinformatics.
Presenting all of F# in one session would be impossible. Instead, our goal will be to give you a general sense for how F# compares to C#. Starting from a tiny C# application (retrieving and analyzing market data from the web), we will convert it step-by-step to F#, illustrating some of the language features that should be particularly interesting for C# developers. We hope that at the end of this excursion, you will understand what F# brings to the table better, and whether it may be a good tool to add to your toolkit!