|
|
Browse by Tags
All Tags » FP Tutorial (RSS)
-
In my first version of my functional programming tutorial , I discussed a ForEach extension method, but I removed the topic from the second version. This extension method iterates through a source collection and performs an action on each item in the collection. ForEach isn’t included in the .NET base class library (BCL), but its implementation is pretty simple: static class MyExtensions { static void ForEach<T>( this IEnumerable <T> source, Action <T> action) { foreach (T item Read More...
|
-
I believe that it is easier to maintain code that is written in the functional style. For one thing, this is the very reason for many of the characteristics of functional code. No state is maintained, so we don’t have to worry about corrupting any state. If a variable is in scope, then the variable has its value, and it will never have another value. And the idea of composability is all about being able to inject/surround/refactor code without making it brittle. In this post, I’m going to show the Read More...
|
-
About a week ago, I posted a very interesting guest post by Bob McClellan , where he discussed some code that allows you to more easily move/insert/delete paragraphs in Open XML documents. He is in the process of putting together a PowerShell cmdlet that demonstrates this functionality within the PowerTools for Open XML open source project. Having PowerShell cmdlets that enable us to slice and dice Open XML documents is super. However, it is only half the story, in the context of PowerShell. The Read More...
|
-
At TechReady8, I’ll be presenting a 400 level course “Developing Office Client Solutions using LINQ and Open XML”. TechReady8 is a Microsoft employee only event, but non-Microsoft folks in the Seattle area can come see the same talk at the .NET Developers Association of Redmond meeting on January 19 th . This talk will be at 7:00PM, in Microsoft Building 40, Steptoe Room #1450. You can find more information at www.dotnetda.com . Here is the abstract for the talk: Developing Office Client Solutions Read More...
|
-
Visual Basic 9.0 added many language features that allow us to write in the functional style in a natural and expressive way. The value of programming in the functional style has been apparent to me for some time, and VB developers can realize the same benefits as C# developers, so I’ve written a tutorial for VB developers: Query Composition using Functional Programming Techniques in VB 9.0 . This tutorial is a rewrite of a tutorial that I wrote in the early part of 2008, Query Composition using Read More...
|
-
Closures are one of the key components in C# 3.0 that makes functional programming easy, and results in clean syntax. Yet, they are not really necessary to understand in order to write queries in the functional style. Why? Because closures make the language ‘just work’ exactly in the way that you expect. I’ve made use of closures literally hundreds of times in the code that I’ve posted on my blog, yet I’ve never had to call attention to them. This blog post presents a quick and easy explanation of Read More...
|
-
When developing C# programs in the functional programming style, you often need to dump out a collection to the console. Object dumper is a great tool to use for this. It is a sample that far too few developers know about. A functional transform typically takes the form of successive transformations: transform collection a => collection b => collection c => final collection. This is one of the main points of this topic in my Functional Programming Tutorial . When I commence developing such Read More...
|
-
The response to my previous blog post has been very interesting to me. And it has, to a very large extent, matched my own experience. I have seen four basic scenarios where folks use LINQ: Using LINQ to Objects (and LINQ to XML, which is really just LINQ to Objects), primarily using the extension methods, and the so-called ‘method syntax’. This really is a great scenario. When I really understood it, it blew my mind. I believe it leads to the possibility of “speed-reading” code – see below. Using Read More...
|
-
I had an interesting conversation with my nephew the other day. He is a very bright CS student working as a summer intern at a software company (not Microsoft). He is programming in C# using Visual Studio 2008. I asked him if developers at his company were using LINQ, and he said, "No, that the folks in charge had basically forbidden it, because no one understands it." Visual Studio 2008 has been out for over a year, but I know that a fair number of competent developers have not devoted the time Read More...
|
-
In our family, we have a rule – on Mother's day, my wife basically gets to set the agenda for the entire weekend. And, as appropriate, she doesn't have to lift a finger around the house. And on Father's day, the same rule applies for me. But on all other weekends, normal rules apply. This year, because my wife was out of town on the actual Father's day, we shifted Father's day to this last weekend, and my choice for how to spend the weekend was to write the code that I'm presenting here, and to write Read More...
|
|
|
|