Archives
-
Much Ado About Monads – State Edition
Over the past year, I’ve had the opportunity to be a technical reviewer of a number of books including Chris Smith’s Programming F# book. During my recent trips, I had the chance to sit down and read through the book once again, and in particular Chapter 10 on Computation Expressions (aka Monads). A section worth noting in here is the use of the State Monad in order to create a library for web scripting. In the past, I’ve had a series on Much Ado About Monads where I look at the basic Monads such as Maybe and List, but this time, let’s look at what we can do with the State Monad.
-
Going Hybrid - Implementing a Shopping Cart in F#
One persistent question that keeps coming up to me is how to merge functional programming techniques with object oriented techniques that many are used to. My usual reply is to talk about how functional programming affects your code, programming in the big, programming in the medium and programming in the small. What I mean by those terms is:
-
Going Interactive with the Reactive Extensions
Lately in my series on the Reactive Extensions, you’ll have noticed I focused quite a bit on the IObservable<T> and IObserver interfaces as well as the extensions methods that are included. There is one thing, however, that might have been missed with the release of the Reactive Extensions is the inclusion of System.Interactive.dll. The idea behind this is to include many of the extension methods that are available to IObservable<T> and port them to work on the IEnumerable<T> interface.
-
Introduction to the Reactive Framework Part V
In the previous post of the Introduction to the Reactive Framework series, we covered how to create new IObservable<T> instances, either from scratch or from existing sequences. What this allowed us to do was turn an operation which was previously interactive, such as iterating over a collection, to a reactive, where I could have multiple listeners reacting to the same collection concurrently. This has nice implications for allowing us to scale our application in interesting ways. This time, let’s take another angle on making asynchronous programming easier.
-
Reactive Extensions for .NET (Rx) released on DevLabs
As you may have noticed, I’ve been blogging a bit about the Reactive Framework, now the Reactive Extensions for .NET (Rx) and how it will change the way we approach asynchronous and event-based programming. Just as LINQ to Objects changed the way we deal with collections, The Reactive Extensions will change the way we deal with asynchronous and event-based programming. Fast forward to today, Rx has been released on Microsoft DevLabs for not only .NET 4 Beta 2, but also .NET 3.5 SP1 and Silverlight 3 as well.
-
Introduction to the Reactive Framework Part IV
In the previous post in this series, we covered how to turn .NET events into first class values through IObservable instances. By doing so, we were able to do much more interesting things than just subscribe and unsubscribe, instead we were able to create a mouse drag event with little effort through composition. In this post, let’s look at going from push to pull by turning collections into IObservable<T> instances.
-
Introduction to the Reactive Framework Part III
In my previous post in the Introduction to the Reactive Framework series, I discussed the duality between the IEnumerable/IEnumerator and IObservable/IObserver and how that enables us to generalize the ideas from LINQ to Objects to LINQ to Observables/Events. After the last post, I was asked how we go from events to Observables, so let’s tackle that in this post.
-
[ANN] DC ALT.NET – 11/24/2009 “Stop Talking, Start Teaching” with Jeff Casimir
As a group, we’ve been focusing a lot on technology on such things as JavaScript, MongoDB and so on. This month, I’d like to take a step back as a group and instead focus on some soft skills. When I started this group back in 2007, I had the idea that this group would help others not only become better technologists in a wide array of technologies, but also better teachers as well. On November 24th, we have Jeff Casimir to help us understand how to become a better teacher with his presentation “Stop Talking, Start Teaching: 5 Rules for Successful Presentations and Demos”. Listed below are the details:
-
Introduction to the Reactive Framework Part II
In my previous post, I talked a little bit about the parts of the Reactive Framework that are coming to the .NET 4 BCL as well as their implementation in F# as part of F# First Class Events. This time, let’s come back to the Reactive Framework itself from which the IObservable<T> and IObserver<T> originated. As you may remember, you can play with the bits of the Reactive Framework from the Silverlight 3 Toolkit.
-
F# October 2009 CTP/Beta2 – F# + Rx Together At Last
Lately, I’ve been covering a lot of F# First Class Events as well as the Reactive Framework which has been leading up to a head as it were. It has been announced through Channel 9 that .NET 4 will include the two major interfaces from the Reactive Framework, the IObservable<T> and IObserver<T>. Today, as Don Syme announces with the release of the F# October 2009 CTP and F# for Visual Studio 2010 Beta 2, those two interfaces, the IObservable<T> and IObserver<T> have been integrated into F# First Class Events.
-
[ANN] DC ALT.NET 10/22/2009 – MongoDB with David James
This month DC ALT.NET will once again move into the not often covered subjects in the .NET world, in covering MongoDB with David James. Stay tuned to the mailing list for up to date details. There has been a bit of discussion around non relational databases lumped under the name of NoSQL, especially given the upcoming NoSQLEast conference. This meeting, we'll dive into MongoDB, one of the NoSQL solutions.
-
F# First Class Events – Composing Events Until Others
After a comment on my last post in regards to First Class Events in F#, I thought I’d revisit them briefly before going back to the Reactive Framework series. In particular, this comment was in regards to implementing the until combinator using F# First Class Events. As part of my hacking during this series, I came across a rather identical solution to the one that was posted, so I thought it’d be worth exploring.
-
Introducing the Reactive Framework Part I
During my series about first class events in F#, I made frequent mention of the LiveLabs Reactive Framework (Rx), without going into much detail as to what it is. Now that the series is complete and we understand both how F# first class events work, as well as their integration into F# async workflows, let’s take a look at the Reactive Framework in this multi-part series covering the history, implementation details and more.
-
Functional Programming Fundamentals Lectures
Earlier this year, I had the privilege to record a Channel 9 video session covering functional programming basics with Erik Meijer and Charles Torre. We covered some of the basics, but at some point you need to go back to the fundamentals in order to truly learn this paradigm. With that, Erik with the help of Charles, have kicked off the Channel 9 lecture series on Functional Programming Fundamentals. This series is meant to be a journey into some of the ideas behind functional programming, following along with Graham Hutton’s excellent Programming in Haskell book. Many of the concepts described in this series are in Haskell first, but many apply as well to F#, and even C# and VB.NET. What better way to talk about Haskell and functional programming than to learn from one of the authors of the Haskell 98 Report. I highly encourage everyone to check out this series!
-
Generically Constraining F# – Part III
In the previous post, we talked about some of the generic restrictions that you could do in F#. I showed some of the basics and how you might use them to your advantage. We covered the type constraint, null constraint and explicit member constraint. This time, we’ll cover the rest of them including:
-
Generically Constraining F# – Part II
In the previous post, we talked about the basic problems with C# generic restrictions. We covered how it was possible in fact in the CLR to do these restrictions and sure enough the F# language supports them. This time, we’ll go deeper into what kinds of generic restrictions are possible and how we might use them. But, before we begin, let’s revisit our previous example.
-
Pondering Axum + F#
It’s been a while since I’ve posted about Axum as I’ve been posting about other asynchronous and parallel programming models. After two releases of the Axum standalone language and lots of good user feedback, it’s time to ponder what could be with Axum. Overall, the goals of Axum to provide an agent-based concurrency oriented system is important as we consider the emerging hardware trends. Many of these ideas would in fact benefit most languages, whether mainstream or not. With all the success that it has had, there have also been some issues as well, which leads me to wonder, what else could we do here? Let step through some of those issues today and see where we could go.
-
Generically Constraining F# – Part I
Generic constraints inside .NET has always been a fun enterprise, especially given how C# handles them There has been some discussion on Jon Skeet’s blog about the fact that C# does not allow for generic constraints referring to a number of types. These include:
-
No:SQL (east) 2009
As you may have noticed, there has been a lot of talk around NOSQL “movement” lately. The name, NOSQL was created to describe non-traditional data storage engines and techniques to address concerns of data sets of horizontal scale. Innovations such as Google’s BigTable and Amazon’s Dynamo have led to a rise in a new wide variety of new technologies and ideas around pointed problems as data sets at scale, like CouchDB, Redis, MongoDB, Cassandra, Voldemort and many more. These NOSQL technologies have little unifying them together as they use such techniques as Column-Oriented, Key-Value Stores, CAP Theorem, and no one to rule them all, but underlying them is that they are different than the “traditional” RDBMS solutions of SQL Server, Oracle, MySQL and so on. These NOSQL solutions are starting to turn up in good numbers for specific use cases and not meant to be the end all solutions.
-
[ANN] DC ALT.NET 9/10/2009 – Webmachine with Kevin Smith
This month, DC ALT.NET is moving the meeting a little forward this month and teaming with NOVALANG and the Erlang Users of Arlington/DC to talk about the Webmachine REST Toolkit. We at DC ALT.NET continue to strive to push developers to look outside their normal surroundings and comfort zones and this month is no different. Details are below:
-
F# First Class Events – Async Workflows + Events Part III
So far in this series, I’ve covered a bit about what first class events are in F# and how you might use them. In the first post, we looked at what a first class events mean and some basic combinators in order to compose events together. In the second post, we looked at how we might create events and publish them to the world through classes. And in the third post I talked about how to manage the lifetime of a subscription. In the fourth installment, I corrected my usage of the old create function and instead to use the Event class to create, trigger and publish events. In the last part, we’ve been talking about asynchronous workflows and eventing together, and this time we’ll pick up on that discussion. Before we get started, let’s get caught up to where we are today.
-
F# First Class Events – Async Workflows + Events Part II
So far in this series, I’ve covered a bit about what first class events are in F# and how you might use them. In the first post, we looked at what a first class events mean and some basic combinators in order to compose events together. In the second post, we looked at how we might create events and publish them to the world through classes. And in the third post I talked about how to manage the lifetime of a subscription. In the fourth installment, I corrected my usage of the old create function and instead to use the Event class to create, trigger and publish events. Last time, we’ll look at how we can use first class events inside Async Workflows in order to do such items as tracking state. This time, let’s look at how we could use the Async Workflows together with events in order to draw on a WPF window. Before we get started, let’s get caught up to where we are today.
-
F# First Class Events – Async Workflows + Events Part I
So far in this series, I’ve covered a bit about what first class events are in F# and how you might use them. In the first post, we looked at what a first class events mean and some basic combinators in order to compose events together. In the second post, we looked at how we might create events and publish them to the world through classes. And in the third post I talked about how to manage the lifetime of a subscription. Last time, I corrected my usage of the old create function and instead to use the Event class to create, trigger and publish events. This time, we’ll look at how we can use first class events inside Async Workflows in order to do such items as tracking state.
-
F# First Class Events – Changes on Creating Events
So far in this series, I’ve covered a bit about what first class events are in F# and how you might use them. In the first post, we looked at what a first class events mean and some basic combinators in order to compose events together. In the second post, we looked at how we might create events and publish them to the world through classes. And in the previous post, I talked about how to manage the lifetime of a subscription. This time, I want to go over creating events again to show how it will be going forward in Visual Studio 2010 and beyond.
-
F# First Class Events – Creating and Disposing Handlers
So far in this series, I’ve covered a bit about what first class events are in F# and how you might use them. In the first post, we looked at what a first class events mean and some basic combinators in order to compose events together. In the second post, we looked at how we might create events and publish them to the world through classes. This time, let’s look at how we might manage the lifetime of a given event subscription. Before we begin, let’s get caught up to where we are today:
-
F# First Class Events – Creating Events
In the previous post on first class composable events in F#, we talked mostly about the underlying types and the basic composition that you can achieve through the Event module. By using the basic combinators of map, filter, partition, etc, we are able to create some rather rich scenarios for first class events. We’ve already shown what we can do with existing events off of such things as Windows Forms applications, but how about we create our own?
-
[ANN] DC ALT.NET 8/26/2009 – jQuery UI with Richard Worth
Following last month’s great presentation by Chris Williams on Naked JavaScript, we’re continuing our dive into JavaScript, and we continue this time with a look into jQuery UI. This month, we have Richard Worth, the Release Manager for jQuery UI, to talk with us about both jQuery UI and the jQuery UI CSS Framework. Below are the details:
-
First Class Composable Events in F#
If you’ve been following me on Twitter lately, I’ve been playing a lot lately with event based programming in both F# events as well as the Reactive Framework (RX). Today, I’m going to start a series in event processing, starting from the elementary concept of first class events in F#.
-
Spec# and Boogie Released on CodePlex
You may have noticed that in the past that I’ve talked extensively about Spec#, an object-oriented .NET language based upon C# with contract-first features as well as a non-null type system. This project has not only been covered by myself, but also my CodeBetter compatriot, Greg Young, and by the illustrious Tony Hoare at QCon London during his “Null References: The Billion Dollar Mistake” presentation. This project, after gaining momentum in the .NET world, has now been made part of .NET 4.0 as Code Contracts for .NET.
-
Dryad/DryadLINQ and Project Trident Released
There has been a lot of talk going around involving the Microsoft Worldwide Partner Conference 2009, but another event, largely overshadowed, was the 10th annual Microsoft Research Faculty Summit. During this summit, Tony Hey, the Microsoft External Research Vice President, announced the release of two tools to help transform research in the academic world, Project Trident and Dryad with DryadLINQ, which you can watch here. These tools are available freely to academic researchers and scientists and can be downloaded here. So, what are they and why should we care?
-
[ANN] DC ALT.NET 7/22/2009 – Naked JavaScript
After diving headlong into to our back to basics series on TDD, Refactoring, Pairing, and BDD, I thought we’d take a little break and dive into another area that I’m passionate about, JavaScript. Too many times does this language get dismissed as a toy language and that only script kiddies write it. In fact, some very interesting things are happening in the JS world that were highlighted at the recent JSConf 2009 here in the Washington, DC area. For the next two months at least, we’re going heads down JavaScript and then possibly more.
-
Modeling DSLs with F# and Units of Measure
Very recently on Lambda the Ultimate, they had a really good post describing Soccer-Fun, a way to teach functional programming (pdf). The premise is very simple and is described as the following:
-
The “Anti-For” Campaign
Recently, there has been an effort launched called the “Anti-If Campaign” in which they deride the use of if statements and instead, focus on Object Oriented Principles in order to create more flexible designs. Now certainly, I have a sympathetic ear to this cause as I’ve seen code that literally walks off the side of the screen due to nesting of if statements. Pattern matching to me, especially at the top level of the function is actually quite beautiful in a way, such as the implementations in Haskell:
-
Providing Safe Alternatives
When I was reading through Real World Haskell, I was struck several times by the mention of providing safe function alternatives. The idea is to provide a function that in all cases returns a value as well as the one which is meant to accept valid input and throw exceptions should that contract be violated. There is a real performance consideration to be taken into account as a function which repeatedly throws exceptions as logic will tend to overwhelm a system and slow it down significantly. Imagine if you will an application which reads a large directory to check each file for an X509 certificate, whether it has one or not, and it throws an exception if one is not present. The problem of course is there is no way to determine whether a file was signed at the time using the .NET class without resorting to P/Invoke (my favorite).
-
F# – Async Running with Continuation Scissors
As you may have noticed, I’ve been covering a bit about concurrency on this blog lately, and for good reason. Between Axum, Erlang, Scala and F#, there is a lot to explore with actor model concurrency, task based concurrency, data parallel applications and so on. In the next couple of months, I have some talks coming up on concurrency and in particular with F#. I’ve been covering a bit of that with F# and mailbox processing, but I wanted to step back a bit into the asynchronous workflows and hitting against a well known API.
-
Revisiting Memoization
After revisiting the Haskell Wiki recently, I wanted to look at memoization again for a brief second after talking about it a while ago. In particular, there were two competing ideas, one around using a generic dictionary/map for storing the memoized values, the other using a lazy list approach. I wanted to briefly look into those as possible solutions.
-
F# – Duck Typing and Structural Typing
As you may have noticed on this blog lately that I’ve been focusing on Asynchronous Workflows. In those adventures, I’ve been taking well known APIs such as Twitter, Bing, among others and seeing what I can do with them. In this instance, when using LINQ to XML, I’ve run into a slight syntax problem.
-
Axum – Ping Pong with Ordered Interaction Points
UPDATE: Removed code and explained that what I had was not intended behavior
-
[ANN] DC ALT.NET – 6/10/2009 – Evan Light on BDD
The June installment of DC ALT.NET will be on June 10th, 2009 from 7-9PM. Stay tuned to our mailing list to stay up to date with the happenings of the group. We’ve moved up the schedule just a little bit to accommodate our presenter, who will be attending Ruby Nation later that week.
-
When Side Effects and Laziness Collide
While working on a side project recently, I came to rediscover some of the consequences of one of my earlier posts on “Side Effects and Functional Programming”. It’s important that we realize that when we are creating our programs to beware of lazy evaluation and side effects.
-
Actors in F# – The Bounded Buffer Problem
In the previous post, I covered an example of an auction simulation using asynchronous message passing and a shared nothing approach using the MailboxProcessor class in F#. The auction example was a great piece to demonstrate scalability by adding additional clients to create a sort of bidding war between them. Once again, with this approach, we’ve eliminated the need for locks and other concurrency primitives.
-
[ANN] DC ALT.NET – 5/27/2009 – Introduction to Pair Programming
The DC ALT.NET group is continuing the back to basics approach with this month covering an introduction to pair programming. It’s part of our commitment to the community to encourage such practices as in our previous sessions on Test Driven Development and Refactoring. This month is no exception in pair programming and why two heads are better than one.
-
F# Actors Revisited
UPDATE: Removed ref cells to use two recursive loops
-
Axum – Ping Pong with Dataflow Networks
In the previous post, I gave the canonical Ping-Pong example in Axum and how it compared with Axum. I want to revisit this post because there are some areas in which we can rework it in addition to the other solutions we’ll visit. Some parts were needlessly chatty and instead we’ll work in some other language features to help clean up our solution.
-
Axum – Introduction and Ping Pong Example
As it was announced last week, Axum, a .NET Domain Specific Language around safe, scalable parallel programming through the actor model and message passing was released to the world as a CTP. It was noted, that although this is an initial release, that this is still an incubation project which may or may not lead to a final product. This post will serve as a kind of introduction to the language and some basic concepts.
-
Axum Hits CTP
As I relayed in an earlier post about the soon availability of Axum, well, today is the day. I noted before that Microsoft has still not decided whether to release this as a real project, and needs feedback from users like yourself. On the Axum site there is a great video on how to build your first Axum application. Over time, I hope to add a few to the picture myself as actor model concurrency to me is highly interesting for many problems in today’s environment. You can read more of the announcement at the Axum Team Blog.
-
Type Classes Are The Secret Sauce
I came across a recent post on adding Ruby and C# operators to F# that sparked a few thoughts in my head. The post was good, but yet there were operators that already existed for some of the operations mentioned such as the defaultArg and ( @ ). But what really got me was thinking about type classes again due to the fact that extension operators aren’t currently supported in the language whereas extension events, properties, methods and statics are. I covered this in the past in regards to implementing an approximate equality check for my Functional Programming Unit Testing series, but I want to dive further into that subject a little more in this post.
-
Functionally Implementing Intersperse
This week while seeming to put off finishing many other blog posts on type classes, Collective Intelligence, the war on foreach and so on, I found myself intrigued by solving a simple problem in F# and look at the tradeoffs. This post is meant to be a little dive into several ways to solve a problem and seeing where the pitfalls lie.
-
Axum, Reactive Framework and other Lang.net items
A few weeks ago, the 2009 Lang.NET symposium was came and went and there were a few talks that caught my eye. There were many great talks including those by some of the following luminaries:
-
Functional Composition and Partial Application
In the past couple of posts, I’ve been talking about functional composition in regards to explaining its relevance to C#. I thought I’d step back just a little though and explain more of the fundamentals in a more natural functional language such as Haskell or F#. C# has a tendency to be a bit unnatural when it comes to explaining such concepts that I hope this becomes clearer.
-
Functional C# – Reverse Functional Composition
In the previous post, I covered currying as well as left to right functional composition. I showed that with a few extensions methods to our functions, we can create rich, albeit verbose, solutions through functional composition. But, what about going from right to left in functional composition? Could that be done as well?
-
Functional C# – Forward Functional Composition
In the last post, we talked about partial application and currying with respect to functional composition. I showed the power of functional composition in regards to a real-world example of how to calculate a book price given the chain of potential discounts, taxes, shipping, etc. Through functional composition, we are able to add additional calculations with relative ease. In today’s example, let’s revisit some of those topics and explore some areas I haven’t touched yet.
-
Functional C# – Composing Through Partial Application
Earlier this week, I was challenged on Twitter to give a practical example of currying in C#. This was a great question, because outside of the normal add and multiply people tend to do, there isn’t much out there. This was also a question brought up as I spoke at the Philly.NET Code Camp this past weekend as well about good practical examples. In this post, I hope to use one example that I used during my talk on Functional Programming at the Continuous Improvement in Software Conference in Austin last October.
-
[ANN] DC ALT.NET (4/29/2009) – Refactoring with George Dinwiddie
Continuing with our back to basics series which started last month with an introduction to Test Driven Development, this month we are covering Refactoring. The discussion will be led by George Dinwiddie, a software development consultant, coach and a found of Agile Maryland and the Maryland Chapter of the APLN and we’re lucky to have him. As with before, these are quite interactive discussions, so participation is highly encouraged.
-
Functional Solution for the Shortest Path Problem
As part of my dive into the Collective Intelligence series, I’ve found myself many times taking code that was written in an imperative coding style and moving it towards a pure functional style with immutable data structures instead of ones, the application of functions instead of for loops (which is an upcoming post), and the elimination of state. This was also a major part of my talk this past weekend at the Philly.NET code camp on Functional Programming in .NET.
-
Haskell and Collective Intelligence
Tonight for the Real World Haskell Book Club, Paul Barry and I decided to dig through the Programming Collective Intelligence book as some good hack projects as we dive deep into the language features. As you may have noticed both here on my blog and on Twitter, I have been posting a lot of these samples in F# and refactoring along the way. By taking the Python code and rewriting it in Haskell gave me better insight into the Haskell way, but also refactoring opportunities for my existing F# code.
-
From Imperative to Functional – Transposing Maps
In my recent adventures around Collective Intelligence, I took many code samples that have been written in an imperative coding style and moved them to a more functional style. With this move sometimes brings some leaps in thinking in which you have to step back and break down the problem into smaller parts and come at it from a different direction. Today, I’ll go over two examples in which we’re going to transpose a map from an imperative style using mutable dictionaries to one that is written in a functional style with immutable maps. There is a lot of focus on this blog around immutability and functional composition as they are key to functional programming.
-
Functional Programming and Collective Intelligence - IV
In our last post in the series, we discussed a way to get which items I should check out next through the use of the our similarity algorithms which included the Pearson Coefficient, the Euclidean Distance and Manhattan Distance among others. This time, let’s take another approach through the use of the Slope One family of algorithms.
-
Functional Programming and Collective Intelligence - III
Previously, I went over some formulas on how we can calculate the similarity between our items using the Manhattan Distance, Chebyshev Distance and the Jaccard Coefficient. Then we were able to plug in our given similarity function to another function which then gets the top matches for our given preferences. This time, instead of determining which critic is more suited to my tastes, instead, we could instead rate which items should be viewed.
-
Functional Programming and Collective Intelligence - II
In the previous post covering Functional Programming and Collective Intelligence, I left off with the discussion of the two different algorithms for measuring similarity, the Euclidean Distance and the Pearson product-moment correlation coefficient. The Programming Collective Intelligence covers these two formulas in depth, yet they are not the only two that are capable of performing the task. Let’s briefly cover some more of those before moving onto ranking the critics and recommending items for a particular user.
-
Functional Programming and Collective Intelligence
During some of my talks about functional programming, and in turn, F#, many do ask “Why Functional Programming?” and “Why use F#?” and both are very good questions. Many of the people using F# today are in fields such as finance, insurance, science and academia. Today, I hope to dive into a subject for which it is well suited. If you’ve been following me on Twitter, I’ve been talking a bit and showing off a bit of code on today’s subject.
-
Talking Functional Programming with Erik Meijer
When I was last out in Redmond, I had the opportunity to sit down with Erik Meijer to speak about something for which I’m passionate, functional programming. After such recent appearances on Channel9 as Joe Duffy and Anders Hejlsberg, I was quite flattered to be asked to appear. I gave a short as possible introduction to start talking about any number of topics including my passion for functional programming, the Haskell and F# languages, and many other ideas.
-
DC ALT.NET 3/25 – Introduction to TDD
The March meeting for DC ALT.NET will be on March 25th from 7-9PM EDT. Check the our mailing list for continuing updates and future meetings. This month we have Jonathan Cogley providing an introduction to Test Driven Development. This session will walk through a real-world problem and how to identify and isolate the dependencies in the logic. This is in the series of getting back to the basics series that I hope to mix in with our regular meetings. This might also include Firestarter events, coding dojos and so on to help build the development community here in the Washington DC area.
-
Functional .NET – Lose the Magic Strings
In this current series that I’m running as a follow-up to my presentation last week on Applied Functional Programming, we’re talking about ways we can improve our code with functional techniques. The ideas presented here are things that are being used in applications today, and learning from them can help you write more concise and flexible code.
-
Functional .NET - Laziness Becomes You
In the previous post, I talked about some of the basic ideas you can learn from Functional Programming and apply to your code right now. The first topic that was tackled was extensibility through the use of closures. Today, I’ll cover laziness in your APIs, how it can help, and what pitfalls might arise.
-
Functional Programming in .NET – Adding Extensibility
Thanks for everyone who attended my session on applied functional programming earlier this week at RockNUG. This session was intended to reinforce the basics of thinking functionally and what techniques you can do right now to take advantage. It was more of a subset of my workshop I gave at the Continuous Improvement in Software Conference last year, with the addition of a few items. Of course I had to through in some Haskell as well and show off the Jolt Award winning book Real World Haskell.
-
Which Is More Beautiful Architecture - FP or OOP?
Recently, upon the recommendations of a few people, I picked up a copy of the book “Beautiful Architecture: Leading Thinkers Reveal the Hidden Beauty in Software”. This book is a great read and includes essays from some of the top minds in software today. Some of the topics covered are:
-
RockNUG – 3/11/2009 – Functional Programming in .NET
I will be appearing this upcoming Wednesday at the Rockville .NET User Group (RockNUG) to give a presentation on Functional Programming in .NET. This presentation will focus on the basics of functional programming, but also why you should care and how you can start applying these techniques today in your .NET Code. With the evolution of the C# language and the base class libraries to incorporate functional aspects such as closures, statement lambdas, expressions, lazy evaluation, we now have more tools to express our code in a very declarative style. Also, the incorporation of F# into Visual Studio as a first class language sends a signal that functional programming is gaining momentum. And who knows, we’ll probably talk some Haskell as well…
-
Exploring MapReduce with F#
With my exploration into mass concurrency and big data problems, I’m always finding challenges to give myself on how I might solve a given issue. Such examples that have intrigued me along the way as PLINQ, MPI/.NET, Data Parallel Haskell, but one in particular has intrigued me more – MapReduce. A challenge I gave myself is to fully understand this paradigm and implement a version using F#.
-
Introducing Maestro – A DSL for Actor Based Concurrency
As you may have noticed from my blog, there is a big interest in concurrency. Along with that, I’ve made my way into Actor model based concurrency including such forays into Erlang, the Haskell-Actor package, Mailbox Processing in F#, and even such things as Retlang in C#. The problem with some of the .NET solutions is that they don’t go far enough into memory isolation and channel contracts as to what can and cannot happen. In order to enforce such a behavior, we need some sort of static analysis to indicate that. Of course with static analysis, it could be ignored and might not be as type rich as, say a DSL. And that’s where Maestro comes in.
-
Code Cast #24 – On Functional Programming
A week or so ago, I had the opportunity to talk to David Starr and Jarrod Ferguson for the Elegant Code Cast. This time, the topic was functional programming in general, and not just one language in particular. It was a lot of fun to talk with those guys about a subject I’m quite passionate about. I also recently recorded a Channel9 interview with Erik Meijer on the same subject which should be posted soon.
-
Functional C# - Fun With Folds
UPDATE: Added SelectMany as alternative to Flatten
-
Adding Parallel Extensions to F#
In many of my presentations lately, I’ve been using the Parallel Extensions for .NET as part of my heavy computations in F#. By doing so, I’m able to speed up some of my heavier computations by several fold and take full advantage of my machine. Over time, with the help of others, I’ve translated many of the functions from the ParallelEnumerable class into those that can easily be consumed by F# in a meaningful way.
-
DC ALT.NET Meeting - 2/25/2009 - Advanced jQuery
The February meeting for DC ALT.NET will be on February 25th from 7-9PM. Check the our mailing list for continuing updates and future meetings. This month, Paolo del Mundo will be presenting "Advanced jQuery". With the inclusion of jQuery support from Microsoft, understanding this library is a must. Being the language enthusiast that I am, I'm always looking for deep dives into languages, and Javascript has been one of those languages that I have a passion for. Once again, I'd like to thank the Motley Fool for hosting us this month. We're always looking for sponsors, so if you'd like to sponsor us, please contact me via the mailing list.
-
Much Ado About Monads – List Edition
In the previous installment in my quest to make monads a little more approachable, I covered the maybe monad and how it can apply as a general design pattern for dealing with lookups that may or may not succeed. We covered how as a functional design pattern, we can use these monads to easily compose functions together in such a way that makes sense. This time, we’ll look at the list monad, and how you may already be using it without knowing it.
-
Fun with Folds
As I’ve announced earlier, and if you follow me on Twitter, I’ve been doing a bit of Haskell lately through the Real World Haskell book club that I started. Most recently, through our learnings, we have been covering the basic fundamentals of functional programming. The most fundamental piece to this is to understand how to apply the basic three higher-order functions, map, filter and fold. This time, we’re covering the fold function in a neat challenge to convert functions which use explicit recursion to use folds instead. So, what are folds anyways?
-
Resolved Language Debates?
As you may have noticed my emphasis on polyglot programming on this blog. I’ve been following the language design of Ola Bini’s Ioke with some intrigue as well as dipping my foot into languages such as Clojure. Just as well, with some lists as Michael Feathers about his “Wish List for the Next Mainstream Programming Language” has me enumerating what pieces I’d like as well. While doing some more investigation on the subject, I came across a post on Lambda the Ultimate entitled “What Are The Resolved Debates in General Purpose Language Design?”. That got me asking the same question to myself, so, what are they? The thread is a great read, especially if you’re a language enthusiast as I am.
-
Functional Programming Unit Testing – Part 7
In the previous installment in this series, I covered how you can use type classes to implement operators to allow you to do such things as approximate equals for floating point calculations, so that you could run QuickCheck property tests with relative ease. This post will get us back on track to our refactoring tales and what tools we can use to better understand the language.
-
Much Ado About Monads – Maybe Edition
In the past I’ve extensively talked about creating monads, but not as much more around them in terms of why you might use them and what problems they are trying to solve. Since that time, I’ve been challenged by others to actually prove not only that it can be understood by everyone, but they are very useful as well. It’s been a form of geekery among us software professionals to say, “Whoopee! I’ve learned how to implement a monad to do x” without really explaining the reason why people should care.
-
Functional Programming Unit Testing – Using Type Classes
I wanted to take a brief sidebar from the refactoring conversation that I’ve been having in the past couple of posts, and focus on QuickCheck again. In the next post, I’ll get back to refactoring with HLint. In this post, I want to talk about using type classes to implement operators to use for QuickChecks property-based tests.
-
[ANN] DC ALT.NET Meeting 1/28/2009 – Selenium + FitNesse
The January meeting of DC ALT.NET will be held on the 28th from 7-9PM. This month, we’re having Jay Flowers talk with us about web testing with Selenium and FitNesse. This is a great follow-on conversation to the conversation with John Morales on Selenium that we had back in November of last year. This is in part of the back to basics that this group will be following in the oncoming year. Taking cues from the Philly ALT.NET Foundation Series, and the TDD FireStarter in Tampa, I think there is a bit we can do in the Washington, DC area to shake things up a bit.
-
How would the CLR Be Different?
UPDATED: Added improved generics with higher-kinded polymorphism
-
Functional Programming Unit Testing - Part 6
In the last installment in this series, we talked about separating the side effecting code from the pure functions. I gave examples in both Haskell and F# to accomplish this goal, although with Haskell it’s more intuitive due to encapsulating the side effects within the IO monad. This time, let’s cover how we can abstract the monadic code through the use of type classes. Using the book, Real World Haskell, has opened up a lot of possibilities in this area.
-
2008 – The Year that Was
I know if I were to do a retrospective, it should have been last week, but now is as good a time as any. 2008 was a busy year for myself that I managed to challenge myself and push myself in many different ways. From joining CodeBetter to speaking at conferences, there has been a lot of things going on. I’ll focus on three areas, the personal, local and more global levels.
-
[ANN] The Real World Haskell Book Club Starts 1/5/2009
-
Functional Programming Unit Testing - Part 5
In the last installment in this series, we talked about code coverage, what they are, and how you should use them. I gave examples in both Haskell and F# to accomplish this goal. One thing we've touched briefly in this conversation is around refactoring and cleaning up our code, and it’s about time we come back to that subject.