Difference between interface and abstract class
- Class can inherit from multiple interfaces but only one abstract class.
- Interface cannot provide any code only the signatures.
- Abstract class can contain access modifiers.
- Interfaces cannot define fields.
Clustered vs Nonclustered Indexes
Nonclustered indexes (also called “indexes”) are the normal indexes that are created on your tables. SQL Server supports 999 nonclustered indexes per table.
Each nonclustered index can contain upto 1023 included columns. Columns of the TEXT, NTEXT and IMAGE data types can not be included either.
SQL Server only supports a single clustered index per each database table.
Clustered indexes do not support included columns. This is because clustered indexes contain all the columns which aren’t in the index as included columns already. There is no way to override this. Columns with the data type of TEXT, NTEXT and IMAGE are not included within the clustered index. As with the normal table these values are stored out of bounds and only the pointer to the physical location on disk is stored within the index.
Common design patterns
The Singleton pattern is a pattern that makes sure that a class only has a single instance, and provides a global access point to it. A class that implements this pattern is itself responsible for keeping track of it's only instance rather than relying on global variables. Many times this pattern is used to hold a part of a system where there can only be a single one. The file system of Windows is a piece like this.
This strategy for creating new object instances is known as a Factory pattern. Rather than invoking the object's constructor, you can ask the object factory to create the instance for you. That way, the factory class can hide the complexity of object creation (like how to parse a Double out of a string). If you wanted to change the details of creating the object, you'd only have to change the factory itself; you would not have to change every single place in the code where the constructor is called.