August 15, 2011

The Dangers of Mutable Data

I recently came across a bug in some C# code that would never have been a problem if the data structures being used were immutable. The data consisted of a .NET dictionary with an integer key and a list as a value. The details below have been changed to protect the guilty. The offending method takes customer and product objects as parameters and retrieves a list of available pricing for the customer from a dictionary using the product ID as the key. Read more

July 28, 2011

Best Practices for Creating and Consuming Modal Dialogs in WinForms

This is an article I wrote a few years ago after seeing some bad coding practices around modal dialogs in WinForms. Bad habits like explicitly closing the dialog form and using custom OK/Cancel flags irked me, so I came up with some best practices. I hope you find them useful. Tip 1: Set the AcceptButton and CancelButton properties Windows Forms have two properties, AcceptButton and CancelButton, for determining what should be done when the user presses the Enter or Escape keys. Read more

July 18, 2011

F# Functions: Tuple Syntax

I’m relatively new to F# and functional programming and recently worked through an issue that had me perplexed. The issue was with creating functions with the “tuple syntax” versus the normal syntax of separating arguments by spaces. Consider the simple functions below that adds numeric arguments together. They are constructed in two ways. The first is by using a tuple to group the two arguments together. It looks very similar to the syntax from other languages such as C#. Read more

July 16, 2011

My First Blog Post

I’ve always told myself that I needed to start blogging and get my thoughts out there. Well, after years of putting it off, I finally got started. I decided to write about what I love (besides my family of course): writing software using .NET. I’ll start out focusing on C# and F# language features. I’m proficient in C# but just starting out with F#. Functional programming is very different from what I’m used to; however, I’m liking it more and more. Read more

© Joe Buschmann 2020