Skip to main content

Design Patterns for better code - Null Object Design Pattern

Comments

Popular posts from this blog

Event-Engine Framework, Dynamics Code Better

Hallo, I am Naveen. A full-time solution designer & developer for Microsoft applications (SAS & Custom software development). This blog post is for Dynamics CRM solutions enthusiasts, to solve one of the biggest problems in their development life cycle (Code Management). Well the solution explained in this post solve back-end code management problem only for Plugins, but sooner, I will come up with something for front-end as well. Microsoft Dynamics CRM was originally developed for building applications that range from Sales, Marketing to Customer Service. But nowadays it's not just limited to these applications, It's being used to build a variety of applications, that include back-end system for small industry to highly scalable system of an Enterprise business.At first glance Dynamics CRM may looks a no-code solution to develop, but it's not. For developing enterprise grade solutions we have to rely on C# code to stuff all our business logic. So it's ...

Design Patterns for better code - Strategy Design Pattern C#

Strategy design pattern is the most easiest pattern out of all the design patterns and certainly the most useful one. There are high chances that you have written this type of code in your application but you wasn't aware if this thing have a name. But identifying certain types of code solutions with their name helps us to discuss those solutions with your team mates. It provides a common language to discuss these solutions. If you have identified some area in your code which can be simplified using Strategy design pattern and you want to ask your team mate to do so, It's easy to ask them to implement Strategy design pattern there instead of explaining them (Well you should create an Interface for this and than create two classes which implements this interface and than select the implementations at run time). Well you can guess which one was easier to convey :). I will not be using any of the complex UML diagrams explained by Gangs of Four to c...

Design Patterns for better code - Singleton Design Pattern C#

 Singleton Design pattern is also a good design pattern. Although in current world we use dependency injection heavily, so we rely on Dependency provider library (IOC container) for providing us the variable of Singleton scope. Let's just dig straight into what is Singleton. Sometimes there are requirements to have only single instance of a class through out the life-cycle of an application (Like if we are using a printer service and multiple users are using it. Than we want only one instance of that service through out the application life-cycle. So that it's only accessible to one thread at any point of time).  Here are few characteristics of Singleton Design Pattern: At any time only one or no instance of Singleton class will exist. Singleton classes are created without parameters. (Because it contains single, private, parameter-less constructor) Lazy instantiation is default in Singleton Design Pattern. Singleton cl...