Concept of Refactoring

If you read the XP life cycle, one of the things after we implement the task is code refactoring. Refactoring is the process of changing the software in such a way that it does not change the behavior of the code but on the other hand improves the internal structure. No code can be perfect with architecture, coding conventions, and high reusability at the first level itself. Normally it improves over time. It helps developers to implement the necessary solutions today and improve / make the code better tomorrow. Refactoring is the process of changing the system to improve the … Click here to continue…..

Polymorphism

Polymorphism , the third pillar of object-oriented programming, is closely related to inheritance. The prefix poly means many; morph means form. Thus, polymorphism refers to the ability of a single type or class to take many forms. There are times that you will know you have a collection of a general type, for example a collection of Controls, but you do not know (or care) what the specific subtype each of your controls is (one may be a button, another a list box, etc.). The important thing is that you know they all inherit shared abilities (e.g., the draw method) … Click here to continue…..

Specialization

The second pillar, specialization, is implemented in C# by declaring that a new class derives from an existing class. When you do so, the specialized class inherits the characteristics of the more general class. The specialized class is called a derived class, while the more general class is known as a base class. The specialization relationship is referred to as the is-a relationship. A dog is a mammal, a car is a vehicle. (Dog would be derived from the base class Mammal and Car from the base class Vehicle.) Specialization allows you to create a family of objects. In Windows … Click here to continue…..

Encapsulation

The first pillar of object-oriented programming is encapsulation. The idea behind encapsulation is that you want to keep each type or class discreet and self-contained, so you can change the implementation of one class without affecting any other class. A class that provides a method that other classes can use is called a server. A class that uses that method is called a client. Encapsulation allows you to change the details of how a server does its work without breaking anything in the implementation of the client. This is accomplished by drawing a bright and shining line between the public … Click here to continue…..

The Three Pillars of Object-Oriented Programming

Object-oriented programming is built on three sturdy pillars: encapsulation, specialization, and polymorphism. Encapsulation: Each class should be fully encapsulated, that is, it should fully define the state and responsibilities of that type. For example, if you create an Employee object, that Employee object should fully define all there is to know, from the perspective of your program, about each Employee. You do not, typically, want to have one class that defines the Employee’s work information and a second, unrelated class that defines the Employee’s contact information. Instead, you want to encapsulate all this information inside the Employee class, perhaps by … Click here to continue…..