Software Development – Design Concepts

 

I was going though scott hanselman’s post on Interview Questions and found some concepts that are new/interesting for me. posting here for my reference

SOLID (in context of Object Oriented Design)

S: Single responsibility

every object should have single responsibility. Easier to change code with minimum side effects

O: Open/closed

open for extension, but closed for modification. provides backward compatibility when extending the functionality

L: Liskov substitution

objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program

I:Interface segregation

many client specific interfaces are better than one general purpose interface. No client should be forced to depend on methods it does not use. Easy to change code, faster deployment when interface for only one client is changed

D: Dependency inversion

High-level modules should not depend on low-level modules. Both should depend on abstractions. Abstractions should not depend upon details. Details should depend upon abstractions. advantage is loose coupling

Concurrency Control

Optimistic approach assumes that multiple transactions can complete without affecting each other and transactions  proceed without locking. Just before committing, each transaction verifies that no other transaction has modified its data. If the check reveals conflicting modifications, the committing transaction rolls back. Used in environments with low data contention.
In Pessimistic concurrency control, a transaction puts a lock before reading/writing and thus prevents other transactions to update the same data. suitable for high data contention scenarios

Posted in C#. Tags: . Leave a Comment »