Joseph

SQL Performance

        SQL performance is always a key issue that every DBA faces. This article introduces five ways for improving SQL performance. If subquery is a parameter, then use EXISTS instead IN If you use subquery as a parameter, it is better that you us EXISTS than IN even these two statements return same result, the […]

SQL Performance Read More »

C# Enum

Enum is a value type which can be byte, short, int and long. We can use enum to avoid the occurrence of magic number. For example:         var season = dateSeason == 1 ? “Spring” : “other season” you might notice that when the project grows bigger, there will be more magic numbers you generate.

C# Enum Read More »

C# Delegation

C# delegation works like C/C++ function pointer (type safe). We can use delegation as the parameter of a method and pass them between methods. This helps the programmer to follow one of SOLID principles – OCP. By using delegation, we don’t have to write long and tedious if-else or switch statements. The example of using

C# Delegation Read More »

SQL CASE

When you are familiar with CASE, you can make your SQL statement more flexible and reduce redundant semantics. CASE can be categorized into two cases. One is simple case CASE   WHEN condition THEN result   [WHEN···]   [ELSE result] END; and the other one is searched case CASE expression   WHEN value THEN result   [WHEN···]   [ELSE

SQL CASE Read More »

SOLID principle – DIP

This article will introduce one of solid principles DIP which is the abbreviation of Dependency Inversion Principle. High level modules should not depend upon low level modules. Both should depend upon abstractions. Abstractions should not depend upon details. Details should depend upon abstractions Interpretation: Use abstraction rather than concrete object  Example: Say you go to

SOLID principle – DIP Read More »