Welcome to MSDN Blogs Sign in | Join | Help

jaredpar's WebLog

Code, rants and ramblings of a programmer.

Syndication

News

Now Reading

Pragmatic Programmer

Pragmatic programming at it's best. The book is a light read and worth the time

Essential WPF

Thus far the best book I've read on WPF. Gets right down to working with WPF and the goals/history.

Purely Functional Data Structures

Reading this book makes me feel like I'm back in college. It will really get your mind going and is best read with a whiteboard handy.


Browse by Tags

All Tags » Patterns   (RSS)
RantPack Update 2.0.0.2
Version 2.0.0.2 released. Summary: RantPack is a utility library I maintain and actively use. The main themes of this library are functional programming, patterns, immutable/pressitent collections, future and other threading primitives. I've placed the Read More...

Posted Wednesday, July 23, 2008 8:00 AM by Jared Parsons | 1 Comments

Filed under: ,

Yet another rule for Equality
"If you implement equality in a child class, including operators, you must implement the equality operators in the base class." Unfortunately this is another case of learn the hard way but makes sense when you think about it. The below code snippet is Read More...

Posted Friday, July 11, 2008 8:00 AM by Jared Parsons | 6 Comments

Filed under: ,

Enums vs. Adapters
I like Enums and use them frequently for options and behavior.  To an extent I use Enum's to control behavior.  For example enum Kind { Kind1, Kind2, Kind3 } class Example { private Kind m_kind; public int SomeAction() { switch (m_kind1) { case Read More...

Posted Wednesday, June 18, 2008 8:00 AM by Jared Parsons | 9 Comments

Filed under: ,

Making Equality easier
Recently I've done a bit of posting about the difficulties of properly implementing equality in VB (and DotNet in general). While most of the problems can be fixed with a standard snippet the one really hard to implement issue is GetHashCode(). The rules Read More...

Posted Tuesday, June 03, 2008 8:00 AM by Jared Parsons | 2 Comments

Filed under: ,

RantPack Update
I released a new version of RantPack today.  Mostly this is a bug fix release with a couple of minor new features. https://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=RantPack&ReleaseId=1119 Features Added a way to shim Immutable Read More...

Posted Monday, June 02, 2008 8:26 PM by Jared Parsons | 0 Comments

Filed under: ,

do {} while(0) what?
A recent check in of mine raised a few eye brows during reviews. I checked in a few macros which ended with/contained a "do{}while(0)" and people were curious as to why. In my experience there are two main uses for it. Insert an empty statement with no Read More...

Posted Wednesday, May 21, 2008 8:00 AM by Jared Parsons | 3 Comments

Filed under: ,

Switching on Types
One action I find frustrating in C# is where a particular action needs to be taken based off of the type of a particular object. Ideally I would like to solve this with a switch statement but switch statements only support constant expressions in C# so Read More...

Posted Friday, May 16, 2008 8:00 AM by Jared Parsons | 8 Comments

IEquatable(Of T) and GetHashCode()
This is a bit of a follow up to a previous post we discussed how to properly implement equality in VB. Several users commented/asked that IEquatable(Of T) could be used in place of overriding Equals(). Since IEquatable(Of T) doesn't define a GetHashCode() Read More...

Posted Friday, May 09, 2008 8:00 AM by Jared Parsons | 0 Comments

Filed under: ,

Properly Implementing Equality in VB
Many developers want to implement equality functions for their objects.  DotNet made equality a deep part of the framework and added support all the way up to System.Object with Equals and GetHashCode .   In addition to the strongly enforced Read More...

Posted Monday, April 28, 2008 8:04 AM by Jared Parsons | 6 Comments

Filed under: ,

Design Guidelines: Provide type inference friendly Create function for generic objects
Really this guideline is a bit longer but putting it all in a blog title seemed a bit too much.  The full guideline should read: "If a generic class constructor arguments contain types of all generic parameters, provide a static method named Read More...

Posted Friday, April 11, 2008 8:24 AM by Jared Parsons | 3 Comments

Filed under: , , ,

Have an IComparer<T> but need an IComparable<T>?
Previously we discussed the opposite problem.  This is a lesser but often more frustrating problem because there is no, AFAIK, built in solution for the BCL.  However it's problem that can be solved once and reused with a generic solution. IComparable<T> Read More...

Posted Wednesday, April 09, 2008 8:20 AM by Jared Parsons | 0 Comments

Filed under: , ,

Have a IComparable(Of T) but need an IComparer(Of T)?
IComparable(Of T) is an interface saying "I can compare myself to other objects of the same type".  And IComparer(Of T) is an interface saying "I can compare two objects of this type.".  Often API's which need to perform Read More...

Posted Wednesday, April 02, 2008 9:33 PM by Jared Parsons | 0 Comments

Filed under: ,

Missing API: List(Of T).BinaryInsert
One API that seems to be missing from List(Of T) is a BinaryInsert method.  Especially since there is already a BinarySearch method. Binary insert is a method for inserting a value into an already sorted list.  Since the list is already sorted Read More...

Posted Monday, March 31, 2008 10:26 AM by Jared Parsons | 3 Comments

Filed under: ,

API Problems: CComObject::CreateInstance
CComObject::CreateInstance is a light weight method for creating instances of COM objects in your code. Unfortunately the design of the API makes it easy to introduce subtle errors into your code. The two problems are it encourages manually ref counting Read More...

Posted Friday, March 28, 2008 7:38 PM by Jared Parsons | 2 Comments

Filed under: , ,

SynchronizationContext and Higher Order Functions
It's often useful to ensure that actions occur on specific threads, in particular event handlers.  Take Windows Forms for instance where all operations on a Control must occur on the thread it was created on.  Typically this is not a problem Read More...

Posted Sunday, February 24, 2008 4:42 AM by Jared Parsons | 1 Comments

More Posts Next page »
Page view tracker