Silicon Valley Code Camp : October 6th and 7th, 2012
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.
Sometime in 2010, after years of C# development, I discovered F#, and found programming in a functional style both tricky and fun. Inspired by an article on Artificial Bee Colony algorithms, an optimization algorithm based on the intelligent foraging behaviour of honey bee swarms, I decided as a learning project to convert it from C# into a F# library, Bumblebee, which is available open-source at http://bumblebee.codeplex.com.
In this talk, I want to do 4 things:
1) cover the basics of Artificial Bee Colony algorithms, and illustrate what problems it can help solve,
2) solve a problem together with Bumblebee, and use it as a F# primer,
3) open the hood and discuss some of the design aspects (making the API both F# and C# friendly, using the Task Parallel Library for parallelism, using OO and functional styles together, unit testing...)
4) share my learning experience transitioning from a C#-mindset to thinking F#.
This talk is particularly relevant for C# developers who are F#-curious! Knowing F# beforehand is not required, but a certain comfort with functional concepts (e.g. LINQ in C#) will help.
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.