Archives for OOP Lessons Learnt
Abstract Factory Pattern vs. Dependency Injection
This is a frequent misunderstanding – Why use Dependency Injection when you can ask a factory for your object and have it returned to you? The answer is that DI…
Publish Subscribe Pattern in C# and some gotchas
The eventing mechanism built into the .NET runtime makes it a piece of cake to implement a simple publisher - subscriber pattern (C# code follows). public class EmployerPublisher { public…
Static classes versus regular classes
What is a static class? How is it different from an object? A class in which everything (all fields and methods) is static is equivalent to an object. It has…
Component based design versus Object oriented design
Object oriented design starts with either an inheritance hierarchy or an interface based design. Component based design also uses Object oriented concepts, but instead of inheritance (or interfaces), utilizes object…
A flexible service oriented architecture that handles multiple platforms (multiple devices, multiple databases…)
The Problem Statement Imagine that you have just built a sophisticated application to work against a SQL Server database. You followed a best-practices approach and separated out your presentation, business…
Refactoring Interfaces– separating concerns
Interfaces are the starting point for designing any service oriented architecture – whether they be externally facing web services or internally facing local services. Hence, the correct design of interfaces…
Architecture for multiple services differentiated by Feature and by Platform
Say you have a set of services that your application (the server side) exposes. These could be categorized by feature: Account Service – contains methods for Creation, Deletion, Updating of…
The most powerful pattern of all–The State Pattern (with C# source code)
If there was a pattern that could be used just about anywhere, in any situation – and still work, what would that pattern be? For me, the answer is the…
Command Pattern to the rescue
Recently, I was asked to take an existing library of methods (written in c#) that worked against a particular platform (say Oracle on the backend) and build an equivalent set…
Property Bags–A Life Saver for the practicing OO Developer
(Full Source Code Available at the end of this article) The basic idea is simple enough – you have a type (class) with certain properties that is being used by…