Sign in
|
Join
|
Help
Peter Ritchie's MVP Blog
This is not a life-saving device.
This Blog
Home
Contact
Tags
.NET 2.0
.NET 3.5
.NET 4.0
.NET 4.5
.NET Development
AntiPattern
C#
C# 3.0
Design/Coding Guidance
DevCenterPost
DevTeach
General
Interesting Find
Microsoft
Non-development
OOD
Patterns
Pontification
Resharper
Software Development
Software Development Guidance
Software Development Practices
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Syndication
RSS for Posts
Atom
RSS for Comments
Go
News
Follow @peterritchie
Search
Go
Email Notifications
Go
Archives
March 2013 (3)
February 2013 (1)
January 2013 (2)
November 2012 (4)
September 2012 (4)
August 2012 (1)
May 2012 (1)
April 2012 (1)
February 2012 (3)
January 2012 (3)
December 2011 (1)
November 2011 (5)
October 2011 (2)
September 2011 (2)
August 2011 (1)
July 2011 (1)
June 2011 (1)
May 2011 (3)
April 2011 (1)
March 2011 (2)
February 2011 (1)
December 2010 (4)
November 2010 (2)
October 2010 (2)
August 2010 (1)
June 2010 (2)
May 2010 (4)
April 2010 (6)
March 2010 (1)
February 2010 (6)
December 2009 (1)
August 2009 (1)
July 2009 (1)
May 2009 (1)
April 2009 (1)
March 2009 (3)
January 2009 (3)
November 2008 (6)
October 2008 (2)
September 2008 (2)
August 2008 (8)
July 2008 (8)
June 2008 (5)
May 2008 (8)
April 2008 (1)
March 2008 (4)
February 2008 (6)
January 2008 (4)
December 2007 (4)
November 2007 (1)
October 2007 (4)
September 2007 (2)
August 2007 (3)
July 2007 (2)
June 2007 (4)
May 2007 (5)
April 2007 (2)
March 2007 (4)
February 2007 (3)
January 2007 (1)
November 2006 (2)
October 2006 (5)
September 2006 (6)
August 2006 (2)
July 2006 (7)
March 2006 (2)
Nuggets
.NET 2.0 Breaking Changes
Visual Studio and .NET Framework Feedback
Microsoft Developer Network Forums
Interesting Blogs
Visual Studio Code Analysis Blog
Sara Ford's Blog
Me
Technorati Profile
Browse by Tags
All Tags
»
Design/Coding Guidance
»
.NET Development
»
C#
(
RSS
)
.NET 2.0
.NET 3.5
.NET 3.x
.NET 4.0
.NET 4.5
AntiPattern
Asynchronous Programming Model (APM)
C# 3.0
C# 4
C# 4.0
Code Contracts
Code Smells
Concurrency
DbC
DDD
DevCenterPost
DevTeach
ITSWITCH
ITSWITCH Answer
Microsoft
Multithreaded
OOD
Patterns
Pop Quiz
Refactoring
Software Development
Software Development Guidance
Software Development Practices
Software Development Principles
TCP
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Visual Studio 2012
Fri, Mar 8 2013 9:14
Dependency Injection
Dependency Injection (DI) is a form of Inversion of Control where the instances that one class need are instantiated outside of the class an “injected” into it. The most common injection is constructor injection. This is called inversion of...
Posted by
PeterRitchie
|
5 comment(s)
Filed under:
C#
,
.NET Development
,
Software Development
,
Design/Coding Guidance
,
Patterns
Mon, Jan 21 2013 11:11
IDisposable and Class Hierarchies
In my previous post , I showed how the Dispose Pattern is effectively obsolete. But, there’s one area that I didn’t really cover. What do you do when you want to create a class that implements IDisposable , doesn’t implement the Dispose...
Posted by
PeterRitchie
|
4 comment(s)
Filed under:
C#
,
.NET Development
,
Design/Coding Guidance
,
Patterns
,
DevCenterPost
,
Software Development Guidance
Sun, Jan 20 2013 16:16
The Dispose Pattern as an anti-pattern
When .NET first came out, the framework only had abstractions for what seemed like a handful of Windows features. Developers were required to write their own abstractions around the Windows features that did not have abstractions. Working with these features...
Posted by
PeterRitchie
|
3 comment(s)
Filed under:
C#
,
.NET Development
,
Design/Coding Guidance
,
DevCenterPost
,
AntiPattern
,
Software Development Guidance
Tue, Sep 11 2012 14:04
Thread synchronization of non-atomic invariants in .NET 4.5
Now that we’ve seen how a singular x86-x64 focus might affect how we can synchronize atomic invariants , let’s look at non-atomic invariants. While an atomic invariant really doesn’t need much in the way of guarding , non-atomic invariants often do. ...
Posted by
PeterRitchie
|
2 comment(s)
Filed under:
C#
,
.NET Development
,
Design/Coding Guidance
,
DevCenterPost
,
Software Development Guidance
,
Multithreaded
,
.NET 4.5
,
Concurrency
,
Visual Studio 2012
Thu, Nov 24 2011 8:50
If You’re Using “#if DEBUG”, You’re Doing it Wrong
I was going through some legacy code the other day, refactoring it all over the place and I ran into many blocks of code wrapped in “#if DEBUG”. Of course, after a bit of refactoring in a RELEASE configuration these blocks of code were quickly out...
Posted by
PeterRitchie
|
13 comment(s)
Filed under:
C#
,
.NET Development
,
Design/Coding Guidance
,
DevCenterPost
,
Software Development Guidance
,
Software Development Principles
,
DbC
,
Code Contracts
Wed, Nov 3 2010 8:23
Deep Dive on Closure Pitfalls
I've blogged about closures in C# and their pitfalls before. I keep seeing problems with closures--more now that lambdas expressions and statements ("lambdas") are becoming more widespread--even with experienced developers. So, I'd thought...
Posted by
PeterRitchie
|
5 comment(s)
Filed under:
C#
,
.NET Development
,
.NET 2.0
,
Design/Coding Guidance
,
.NET 3.x
,
C# 3.0
,
.NET 3.5
,
DevCenterPost
,
C# 4
,
Software Development Guidance
,
.NET 4.0
Mon, May 24 2010 11:18
Using the dynamic Keyword in C# to Improve Object-Orientation
With polymorphism, object-oriented languages allow "...different data types to be handled using a uniform interface". Ad-hoc polymorphism is when you declare multiple methods of the same name but differ by the type of an argument. For example...
Posted by
PeterRitchie
|
5 comment(s)
Filed under:
C#
,
.NET Development
,
Software Development
,
Design/Coding Guidance
,
DevCenterPost
,
OOD
,
Visual Studio 2010
,
.NET 4.0
,
C# 4.0
,
Refactoring
,
Code Smells
Mon, Mar 30 2009 23:02
Evolving code over time
Given economics, time constraints, resource limitations, etc.; you can't write all the functionality for a given solution for a single release. Even if you weren't limited by these constraints, you're likely to get changing requirements as...
Posted by
PeterRitchie
|
1 comment(s)
Filed under:
C#
,
.NET Development
,
Software Development
,
Design/Coding Guidance
,
Software Development Practices
,
Software Development Guidance
Thu, Mar 26 2009 11:33
DevTeach 2009 Vancouver
The schedule for DevTeach 2009 Vancouver has been announced ( http://www.devteach.com/ ). There’s lots of great software development sessions from some of the leaders in our industry. If you’re planning on improving yourself, this is the conference...
Posted by
PeterRitchie
|
1 comment(s)
Filed under:
C#
,
.NET Development
,
Software Development
,
Visual Studio 2005
,
.NET 2.0
,
Design/Coding Guidance
,
.NET 3.x
,
Visual Studio 2008
,
C# 3.0
,
.NET 3.5
,
DevTeach
,
DDD
,
Software Development Practices
,
Software Development Guidance
Tue, Sep 2 2008 13:49
Becoming a Visual Studio Jedi Part 1
Becoming a Visual Studio 2008 (and often Visual Studio 2005) Jedi In much the same grain as James' Resharper Jedi posts, I'm beginning a series of posts on becoming a Visual Studio Jedi. It involves getting the most out of Visual Studio off-the...
Posted by
PeterRitchie
|
8 comment(s)
Filed under:
C#
,
.NET Development
,
Software Development
,
Design/Coding Guidance
,
Visual Studio 2008
,
DevCenterPost
Mon, Aug 11 2008 17:34
DataGridViewColumn.Frozen
DataGridViewColumn.Frozen is documented as "When a column is frozen, all the columns to its left (or to its right in right-to-left languages) are frozen as well." Which is nice until you think of the consequences. The consequences being that...
Posted by
PeterRitchie
|
1 comment(s)
Filed under:
C#
,
.NET Development
,
Software Development
,
Design/Coding Guidance
Mon, Jul 28 2008 14:00
ITSWITCH #1: Answer
Last post I detailed some code that may or may not have something wrong in it. If you thought InitializeOne and IntializeTwo are semantically identical (e.g. they differ only by performance), you'd be wrong. If you simply ran the code, you'd...
Posted by
PeterRitchie
|
1 comment(s)
Filed under:
C#
,
.NET Development
,
Software Development
,
.NET 2.0
,
Design/Coding Guidance
,
Pop Quiz
,
ITSWITCH Answer
Fri, Jul 25 2008 13:58
ITSWITCH: #1
A short pop quiz on design/coding in C#...
Posted by
PeterRitchie
|
5 comment(s)
Filed under:
C#
,
.NET Development
,
Software Development
,
.NET 2.0
,
Design/Coding Guidance
,
Pop Quiz
,
ITSWITCH
Tue, Jul 15 2008 9:47
Nested Types
Recently Michael Features blogged about nested types . The title was almost "nested types considered harmful". I don't agree. I don't agree that they're any more harmful than any other C# construct (except goto...). Nested types...
Posted by
PeterRitchie
|
2 comment(s)
Filed under:
C#
,
.NET Development
,
Software Development
,
Design/Coding Guidance
,
Visual Studio 2008
,
C# 3.0
,
.NET 3.5
,
TCP
,
Asynchronous Programming Model (APM)
Wed, Jun 25 2008 12:21
Entity Framework Petition of Vote of Non Confidence
I had intended to be happy simply being a signatory of ADO .NET Entity Framework Vote of No Confidence. But, there's people suggesting signatories of this petition are wackos or on the fringe. Do yourself a favour and read the petition . Read what...
Posted by
PeterRitchie
|
2 comment(s)
Filed under:
C#
,
.NET Development
,
Software Development
,
Design/Coding Guidance
,
Microsoft
Mon, May 26 2008 9:25
Spaces or Tabs?
In this day and age it seems silly to get into a discussion about whether your companies coding guidelines should have a section mandating either spaces or tabs for indents. Tabs are clearly more flexible, but I really don't think it matters at all;...
Posted by
PeterRitchie
|
6 comment(s)
Filed under:
C#
,
.NET Development
,
Design/Coding Guidance
,
Microsoft
Fri, Mar 7 2008 8:48
Single-Entry, Single-Exit, Should It Still Be Applicable In Object-oriented Languages?
Before the modern high-level languages Edsger Dijkstra came up with "Structured Programming". This programming methodology relied on the programmer to form and enforce most of the structure of the program--manually keeping sub-structures and...
Posted by
PeterRitchie
|
36 comment(s)
Filed under:
C#
,
.NET Development
,
Software Development
,
Design/Coding Guidance
Thu, Jul 12 2007 21:30
Performance Implications of try/catch/finally, Part Two
In a previous blog entry Performance Implications of try/catch/finally I outlined that the conventional wisdom that there are no performance implications to try blocks unless an exception is thrown is false. I have some clarifications and details to add...
Posted by
PeterRitchie
|
6 comment(s)
Filed under:
C#
,
.NET Development
,
.NET 2.0
,
Design/Coding Guidance
Fri, Jun 22 2007 12:38
Performance Implications of try/catch/finally
The accepted wisdom regarding performance of try / catch | finally in C# has normally been: try has no performance side-effects unless an exception is thrown. A discussion I was involved in recently caused me to discover some performance implications...
Posted by
PeterRitchie
|
30 comment(s)
Filed under:
C#
,
.NET Development
,
.NET 2.0
,
Design/Coding Guidance
Fri, May 18 2007 11:02
Accumulative Construction
A while back someone asked for guidance on what order should polymorphic construction occur in C# classes. I guess I had never really put much thought into it before and have never seen other guidance on the topic; but, I can see where this can become...
Posted by
PeterRitchie
|
7 comment(s)
Filed under:
C#
,
.NET Development
,
Software Development
,
Design/Coding Guidance