James Michael Hare

...hare-brained ideas from the realm of software development...
posts - 160 , comments - 1338 , trackbacks - 0

My Links

News

Welcome to my blog! I'm a Sr. Software Development Engineer in the Seattle area, who has been performing C++/C#/Java development for over 20 years, but have definitely learned that there is always more to learn!

All thoughts and opinions expressed in my blog and my comments are my own and do not represent the thoughts of my employer.

Blogs I Read

Follow BlkRabbitCoder on Twitter

Tag Cloud

Archives

Post Categories

.NET

CSharp

Little Wonders

Little Wonders

vNext

Fundamentals

A collection of thoughts on the fundamentals of development.
C#/.NET Little Wonders: Extension Methods Demystified
Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can help improve your code by making it easier to write and maintain. The index of all my past little wonders posts can be found here. I have had the pleasure to program in a variety of programming languages throughout the years including the trifecta of C++, Java, and C#. It's often interesting how these three languages are so similar and yet have such key differences as well. Each of them has ......

Posted On Friday, March 8, 2013 12:47 AM | Comments (8) | Filed Under [ My Blog C# Software .NET Fundamentals Little Wonders ]

C#/.NET Little Wonders: The St. Louis Days of .NET Presentations
Here are the slides for my three presentations this year for the St. Louis Days of .NET 2012. Enjoy them and feel free to share them as you see fit! If you enjoy these presentations, please check out the entire index of my C# Little Wonders, Little Pitfalls, and Fundamentals blog posts which can be found here. Update: Source has been updated to include Saturday’s presentations as well, also added more comments. Also, each of the presentations will have a small pool ball in the lower right hand corner ......

Posted On Friday, August 3, 2012 12:19 AM | Comments (0) | Filed Under [ My Blog C# Software .NET Fundamentals Little Wonders ]

St. Louis Days of .NET Begins Today!
Today is the kickoff for the St. Louis Days of .NET! Today begins the pre-compiler sessions for those who are interested followed by the kick-off gathering at the Bottleneck Blues Bar at the St. Charles Ameristar Casino.This is the 5th year for this conference, and the 3rd year I've been fortunate enough to speak at it. I'll be giving my three talks at the following times (yes, the More Little Wonders is repeated):Friday @ 10:30 - "Little Wonders of .NET"Friday @ 2:50 - "More Little Wonders of .NET"Saturday ......

Posted On Thursday, August 2, 2012 8:45 AM | Comments (2) | Filed Under [ My Blog C# Software .NET Fundamentals Little Wonders ]

C#/.NET Little Pitfalls: Implicit Zero To Enum Conversion
C# is a wonderful language for modern programming. While everything in C# has a reason and a place, occasionally there are things that can be confusing for a developer who isn’t aware of what is happening behind the scenes. This is another post in the Little Pitfalls series where I explore these issues; an index of the Little Wonders and Little Pitfalls posts is here. Many times, we create overloaded methods or constructors to allow them to accept different kinds of data. Further, there are times ......

Posted On Thursday, January 26, 2012 6:31 PM | Comments (8) | Filed Under [ My Blog C# Software .NET Fundamentals Little Pitfalls ]

C#/.NET Fundamentals: Unit Testing with Func<TResult> Generators
The C#/.NET Fundamentals series is geared towards examining fundamental concepts in using C# (and .NET in general) to produce effective solutions. I wanted to attempt a brief post before the holidays, so I decided to quickly revisit part a post I wrote a few weeks back on The Generic Func Delegates, and in particular, the sidebar on using Func as a generator for unit testing. At the time, I did not give that short sidebar the attention I really wanted, including showing the setup of the unit tests ......

Posted On Thursday, December 22, 2011 5:33 PM | Comments (12) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C#/.NET Fundamentals: Returning Zero or One Item As IEnumerable<T>
The C#/.NET Fundamentals series is geared towards examining fundamental concepts in using C# (and .NET in general) to produce effective solutions. There are times when we are writing a method that returns a sequence of items, that it occasionally becomes necessary in base-class, interface implementation, error, or default conditions to return a sequence of only one or even zero items. There are many ways to do this, of course, which begs the question of which way is best, in terms of readability, ......

Posted On Thursday, December 8, 2011 6:32 PM | Comments (9) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C#/.NET Fundamentals: Safely and Efficiently Raising Events
The C#/.NET Fundamentals series is geared towards examining fundamental concepts in using C# (and .NET in general) to produce effective solutions. A couple of posts ago, I discussed the EventHandler<TEventArgs> and EventHandler delegates, and in particular at one point mentioned in a sidebar that you need to watch out for thread-safety in order to safely raise events in a multi-threaded environment. There was an interesting discussion in the comments about different ways that people achieve ......

Posted On Thursday, December 1, 2011 8:10 PM | Comments (15) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C#/.NET Little Wonders: The Predicate, Comparison, and Converter Generic Delegates
Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can help improve your code by making it easier to write and maintain. The index of all my past little wonders posts can be found here. In the last three weeks, we examined the Action family of delegates (and delegates in general), the Func family of delegates, and the EventHandler family of delegates and how they can be used to support generic, reusable algorithms and classes. This week I will ......

Posted On Thursday, November 24, 2011 9:03 PM | Comments (3) | Filed Under [ My Blog C# Software .NET Fundamentals Little Wonders ]

C#/.NET Fundamentals: Choosing the Right Collection Class
The .NET Base Class Library (BCL) has a wide array of collection classes at your disposal which make it easy to manage collections of objects. While it's great to have so many classes available, it can be daunting to choose the right collection to use for any given situation. As hard as it may be, choosing the right collection can be absolutely key to the performance and maintainability of your application! This post will look at breaking down any confusion between each collection and the situations ......

Posted On Thursday, June 16, 2011 7:11 PM | Comments (58) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C# Fundamentals - What is the Difference Between Const and Readonly?
Once again we delve into the world of C# Fundamentals. Those hints and gotchas that tend to bite folks newer to the language. Today I take another look about the differences between const and readonly and the uses for each. For the purposes of this entry, whenever I say constant i mean a const or readonly. Const – Compile-Time Constant Values First of all, for those of you who came from the C++ and C# world, const in C# is not the same as const in that language. A const in C# can be closest considered ......

Posted On Thursday, July 1, 2010 5:28 PM | Comments (8) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C# Fundamentals: Beware Of Implicit Hiding
C# Fundamentals Genesis I’ve decided to begin a line of back-to-basics blogs that I hope to post regularly. I used to teach C++ Programming, Algorithms, and Data Structures courses at Webster University in the evenings here locally, and have missed those teaching and mentoring moments when I had to stop teaching after the birth of my twins (no more free time for me!). While some of these fundamentals will be obvious to those who know the languages well (I hope to post C# and C++ tidbits), I’m hoping ......

Posted On Thursday, June 24, 2010 6:11 PM | Comments (4) | Filed Under [ My Blog C# Software .NET Fundamentals Little Pitfalls ]

C# Fundamentals: Optional Parameters - Pros and Pitfalls
When Microsoft rolled out Visual Studio 2010 with C# 4, I was very excited to learn how I could apply all the new features and enhancements to help make me and my team more productive developers. Default parameters have been around forever in C++, and were intentionally omitted in Java in favor of using overloading to satisfy that need as it was though that having too many default parameters could introduce code safety issues. To some extent I can understand that move, as I’ve been bitten by default ......

Posted On Thursday, June 17, 2010 6:11 PM | Comments (5) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C#: The Curious ConcurrentDictionary
Update: I revised some of my initial thoughts after taking bit of my own advice and thinking about the less-tangible benefits of a ConcurrentDictionary. This leads me to believe that ay time you use a Dictionary in a read/write manner in a multi-threaded environment, you should use ConcurrentDictionary instead for the simplicity and safety. It's easier to read and more maintainable, and even if you are write-heavy, it's not orders-of-magnitude slower so I think it's worth it for the safety and maintainability ......

Posted On Wednesday, June 9, 2010 5:45 PM | Comments (24) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C#: System.Lazy<T> and the Singleton Design Pattern
So we've all coded a Singleton at one time or another. It's a really simple pattern and can be a slightly more elegant alternative to global variables. Make no mistake, Singletons can be abused and are often over-used -- but occasionally you find a Singleton is the most elegant solution. For those of you not familiar with a Singleton, the basic Design Pattern is that a Singleton class is one where there is only ever one instance of the class created. This means that constructors must be private to ......

Posted On Wednesday, May 19, 2010 6:41 PM | Comments (33) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C# Fundamentals: String Concat() vs. Format() vs. StringBuilder
I was looking through my groups’ C# coding standards the other day and there were a couple of legacy items in there that caught my eye. They had been passed down from committee to committee so many times that no one even thought to second guess and try them for a long time. It’s yet another example of how micro-optimizations can often get the best of us and cause us to write code that is not as maintainable as it could be for the sake of squeezing an extra ounce of performance out of our software. ......

Posted On Monday, May 10, 2010 9:59 PM | Comments (6) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C# Extension Methods - To Extend or Not To Extend...
I've been thinking a lot about extension methods lately, and I must admit I both love them and hate them. They are a lot like sugar, they taste so nice and sweet, but they'll rot your teeth if you eat them too much. I can't deny that they are useful and handy. After all, one of the major components of the Shared Component library where I work is a set of useful extension methods to help simplify common repetitive tasks. But, I also can't deny that they tend to be overused and abused to willy-nilly ......

Posted On Monday, April 26, 2010 10:44 PM | Comments (20) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C#: LINQ vs foreach - Round 1.
So I was reading Peter Kellner's blog entry on Resharper 5.0 and its LINQ refactoring and thought that was very cool. But that raised a point I had always been curious about in my head -- which is a better choice: manual foreach loops or LINQ? The answer is not really clear-cut. There are two sides to any code cost arguments: performance and maintainability. The first of these is obvious and quantifiable. Given any two pieces of code that perform the same function, you can run them side-by-side and ......

Posted On Friday, April 23, 2010 6:54 AM | Comments (30) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C#/.NET Fundamentals: Of Lambdas and LINQ
This is a quick presentation I threw together for a group of developers who requested a quick primer on using lambda expressions and the more common LINQ extension methods. It seemed like a good general knowledge presentation so I decided to upload it to slideshare and reference it here as well. This is not meant to be a comprehensive discussion of everything that lambda expressions and LINQ have to offer, but is just sort of a very basic introduction to help those less familiar with reading and ......

Posted On Tuesday, May 17, 2011 12:27 PM | Comments (9) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C#/.NET Fundamentals: Finding an Item’s Index in IEnumerable<T>
Sorry for the long blogging hiatus. First it was, of course, the holidays hustle and bustle, then my brother and his wife gave birth to their son, so I’ve been away from my blogging for two weeks. Background: Finding an item’s index in List<T> is easy… Many times in our day to day programming activities, we want to find the index of an item in a collection. Now, if we have a List<T> and we’re looking for the item itself this is trivial: 1: // assume have a list of ints: 2: var list = ......

Posted On Thursday, January 6, 2011 7:29 PM | Comments (3) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C#/.NET Little Wonders: DateTime is Packed with Goodies
Once again lets dive into the Little Wonders of .NET, those small things in the .NET languages and BCL classes that make development easier by increasing readability, maintainability, or performance. Today I’m going to focus a bit on the System.DateTime. This nice little value type (struct) has been in the BCL since the beginning, and while being broadly used to represent an instance of a date and time, there are many great properties, methods, and operators in this class that perhaps folks are less ......

Posted On Thursday, November 18, 2010 6:45 PM | Comments (8) | Filed Under [ My Blog C# Software .NET Fundamentals Little Wonders ]

Full Fundamentals Archive

Powered by: