Thursday, December 22, 2016

How Default Constructor Works in C#

Whenever a class or struct is created, its constructor will be called. Constructors enables developer to set default values and limit initialization. 

If the constructor is not provided, C# will instantiate default constructor and will assign default values to the member variables. Since value types cannot be null, they will be assign with default values while, Since reference types are null by default they will be assigned with null (Note that regardless of been value or reference type, local variables are not automatically initialized). 

Here .ctor is the shorthand for constructor called in IL (Intermediate Language). As you can see from the above screenshot, you can use free disassembler like ILSpy to view disassembled code.  

If you provide a parameterized constructor, the empty constructor will not be generated.



The purpose of user defining a parameterized constructor is to add some logic when initializing the class, if the compiler automatically adds a empty constructor, users can bypass the some logic in parameterized constructor class. That's why empty constructor is not generated.

Constructor can use base keyword to call the constructor of the base class. (for further details, see Using constructors).

If you try to invoke base default constructor and haven't specified it in the base class you will get 'does not contain a constructor that takes 0 arguments' error.

Static classes can have static constructors to initialize static data. It does not have parameters, and the constructor cannot be called directly. It'll be called automatically. Basically user does not have any control over it. (DotnetPerls)
  
Structs can also have constructors (link2). 

Private constructor is a special type of constructor. It is generally used in classes which contain static members only. Static constructor is used to initialize any static data, or to perform any action which should be performed only once.

Wednesday, July 6, 2016

What is Lean

The core idea of lean is to maximize the value provided to customer while minimizing waste as possible (What is lean). With fewer resources as possible. Lean is mainly goes together if you have uncertaninty in what you're delivering where early feedback is important. 



1. Identify Value (End Goal)

Value is what customer gets in the end. Value should always comes from customer because that is what he'll be expecting end of the day. What is the price point. Why this is important. Identify value is important for better delivery to the customer.

2. Map the Value Stream

After values are identified next step is to map the steps of your work process. Value stream may not give a direct benefit to the customer but will help deliver the final product/service. 

A benefit of value stream mapping is identifying places where you can improve and eliminate and identifying places needs improvement (waste). This could be code, a performance issue etc.


3. Create flow

After eliminating waste next is to creating a flow to make sure things go smoothly

4. Respond to customer pull

With improved flow time to market can be drastically improved. This means customers can pull whenever they want to unlike before. 

5. Perfection

Steps 1 to 4 will not sustain if you don't perfect this approach radically. It is important to identify bottlenecks, improvements, learning from these and continue to perfect the model

Difference between Lean and Agile (by CA technologies)




Resources


Wednesday, May 4, 2016

Tuesday, February 2, 2016

Sri Lankan IT Industry Statistics and Trends

It is said that fourth largest exporter of services in Sri Lanka is the IT industry. But is it getting the place it deserves? Here's a quick look at GDP of few countries and How much Information Technology Industry earns for the respective countries. 

Sri Lanka GDP (2013) - $67.18 billion
Sri Lanka IT industry (2015) - $700 - $800 million

India GDP (2013) $1877 billion
India IT industry (2015) $147 billion (source)

USA GDP (2013) $16770 billion
USA IT industry (2011) $646 billion (source)

Sources
http://www.slasscom.lk/why-sri-lanka
http://www.slasscom.lk/sites/default/files/Sri%20Lankan%20IT-BPM%20Industry%20Review%202014.pdf

Powered by Blogger.


Software Architect at Surge Global/ Certified Scrum Master

Experienced in Product Design, Software Engineering, Team management and Practicing Agile methodologies.

Search This Blog

Facebook