Using the dynamic Keyword in C# to Improve Object Orientation – A Follow-up

Based on some feedback, some clarification is warranted with regard to my previous post titled “Using the dynamic Keyword in C# to Improve Object Orientation”. As Jarek Kowalski correctly pointed out, the example code that I provided could have used the Visitor pattern instead to get the same result.  My impetus for using the dynamic keyword the way I did was slightly different from how I described my example—which was meant to be easier to read. I think it’s worthwhile describing the Visitor Pattern.  The Visitor pattern is a pattern used to separate the responsibility of an algorithm from the … Continue reading Using the dynamic Keyword in C# to Improve Object Orientation – A Follow-up

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: private static void Draw(Circle circle) { //… } private static void Draw(Square square) { //… } These are usually referred to as method overloads or method overloading.  Which Draw method that gets invoked would be decided upon at compile-time based on the type of the parameter passed to it. This is great, there are many situations where this is useful; but what about … Continue reading Using the dynamic Keyword in C# to Improve Object-Orientation

Refactoring with Visual Studio 2010

While putting some finishing touches on the book, the publisher has put details about the book on their website. https://www.packtpub.com/refactoring-with-microsoft-visual-studio-2010/book From the overview: Changes to design are an everyday task for many people involved in a software project. Refactoring recognizes this reality and systematizes the distinct process of modifying design and structure without affecting the external behavior of the system. As you consider the benefits of refactoring, you will need this complete guide to steer you through the process of refactoring your code for optimum results. This book will show you how to make your code base more maintainable by … Continue reading Refactoring with Visual Studio 2010

Layers in Visual Studio 2010

Visual Studio 2010 has a new featured called Layer Diagrams.  In the Ultimate edition you can create layer diagrams that model the logical layers in your software system. What is a Layer? I’m glad you asked what a layer is.  A layer is a logical grouping of types with similar external assembly dependencies.  Dependencies between layers occur only in one direction from a higher-level layer to a lower-level layer.  I.e. a higher-level layer can use types in a lower-level layer, but not vice versa. A canonical example is the Data Access Layer (or DAL).  The DAL contains all the types … Continue reading Layers in Visual Studio 2010