Single Responsibility Principle in C-Sharp: Simplified

Let us start with understanding what is SRP? Single Responsibility Principle says every class should have single responsibility and all the responsibility should be encapsulated in the class. To explain it further assume you are creating a creating class to Calculate Salary. Now if you have two methods in class like below. Usually we can … Continue reading Single Responsibility Principle in C-Sharp: Simplified

Variable Scoping and Hoisting in JavaScript

Variable Scoping in JavaScript is quite different than other programming languages like C. In this post we will learn variable scoping in JavaScript. Simply putting, Scope of a JavaScript variable is within region of the program it is defined. So a variable defined inside function will have scope inside that function. Consider following code snippet, … Continue reading Variable Scoping and Hoisting in JavaScript

Invocation patterns in JavaScript

In JavaScript you can invoke a function in four different ways. In this post we will take a look on various invocation patterns. There are four ways a function can be invoked in JavaScript. Four invocation patterns in JavaScript are as follows, Function Invocation Pattern Method Invocation Pattern Constructor Invocation Pattern Indirect Invocation Pattern Function … Continue reading Invocation patterns in JavaScript