Sunday, May 7, 2017

constant and read only difference in C#

constant needs to be initialized when it is declared.

read only variable can be assigned dynamically but need to be done before constructor exists as the the value is not changeable later.


Choosing between  read only or constant depends on our requirement. When we are confident that our constant value does not change we can use "const". The issue with constant is when we define a constant "a" variable with value 20 in an assembly X and use this assembly in another assembly Y, any update of variable "a" is not reflected until we recompile it.

But when we use a read only value here it is a reference to memory location and when we have new "a" value and on building assembly "X" all the assemblies using this X assembly the value of "a" is updated without being building them again.

Saturday, May 6, 2017

Software Testing

Verification and Validation of a software can be considered as Software Testing.

Tuesday, May 2, 2017

object literals in Javascript

A JavaScript object literal is like a comma separated name value pairs .

 Ex: var myObject={name:"narendra",height:180};

We can access the properties as myObject.name which gives "narendra"

Monday, May 1, 2017

Truthy and falsy values

Truthy Values:

"0"
"false"
empty functions
empty arrays
empty objects
typeof(null)

these above listed items are considered true in javascript


Falsy values:

false
0
""
null
undefined
NaN(Not a number)

These are considered false.

When dealing with these truthy and falsy values we should be careful and always try to use "===" or "!==" when we need to compare .

Call a function in child component from parent component in React

Consider the following parent component class Parent extends React.Component { constructor(props) { super(props);         thi...