Ckode.dk Just another developer's blog :-)

30Sep/120

SOLID principles – Part 4: Interface Segregation Principle

This is the fourth of a five part series, where I go over the 5 principles which make up the SOLID principles by Robert C. Martin.

The fourth one is I: Interface Segregation Principle (ISP)

This principle states that interfaces should only contain the absolutely required properties/methods needed.
If an interface contains properties/methods the client code does not need, it should be split into more smaller interfaces.

Tagged as: , No Comments
25Feb/122

SOLID principles – Part 3: Liskov’s Substitution Principle

This is the third of a five part series, where I go over the 5 principles which make up the SOLID principles by Robert C. Martin.

The third one is L: Liskov’s Substitution Principle (LSP)

This principle states that if S is a subtype of T, then objects of type T may be replaced with objects of type S without altering the desirable properties of the program (includes correctness, task performed, etc.)

Tagged as: , 2 Comments
12Feb/120

Staying DRY: Mind those switch statements

As a developer you probably know the DRY abbreviation already: Dont Repeat Yourself.
This is one of the better known principles, and it’s fairly easy to comprehend too: Don’t implement the same logic twice.

However one place where most people slip with DRY, is the switch statement.

Tagged as: , No Comments
25Oct/110

SOLID principles – Part 2: Open/Closed Principle

This is the second of a five part series, where I go over the 5 principles which make up the SOLID principles by Robert C. Martin.

The second one is O: Open/Closed Principle (OCP)

This principle states that classes should be open to extension, but closed to modification.

Tagged as: , No Comments
20Oct/110

SOLID principles – Part 1: Single Responsibility Principle

This is the first of a five part series, where I go over the 5 principles which make up the SOLID principles by Robert C. Martin.

The first one is S: Single Responsibility Principle (SRP)

This principle states that a class should only one have responsibility, which is usually interpreted as having a single “reason to change”.

Tagged as: , No Comments
5Oct/110

Transactions inside stored procedures causing mysterious deadlocks

I recently had an issue with a website timing out a ton of stored procedures because of deadlocks.
Looking back in the error log, I could see it all began when it failed inside the given SP with an arithmetic overflow.
This would normally be no big deal – however this time, it occurred inside an explicit transaction…

Tagged as: No Comments
3Oct/110

Thread signaling simplified

When using multiple threads in an application, you often want to be able to signal threads, to ensure a high level of responsiveness.

There are multiple ways to do this, but here’s what I feel is the best solution.

Tagged as: , No Comments
25Sep/110

Recommended reading

I often come across some good articles, so I decided to start sharing them.
This time I’ve got a great article about ASP.Net Webforms Viewstate, and a thorough article about dot.net 4.0 Code Contracts.

Tagged as: , No Comments
17Sep/110

Granting role based SP execute rights on MS SQL server

Most databases will eventually make use of stored procedures.
However out-of-the-box there’s no “execute SP” role to assign your SQL user.

Here’s how to create the role and grant it the proper access.

Tagged as: No Comments
21May/110

Lost intellisense for custom controls in Visual Studio

Visual Studio can lose intellisense support in HTML view for ASP.Net sites.

Here’s how to recover it.