Thinking in Object Oriented Terms

Its been quite a long time i had blogged. Infact was Caught up busy with My work.So now Blogging about what i have been learning for the past few Weeks.

We all started off with the training on Object Oriented Concepts.It all started off well with a neat intro about the concepts and How to proceed by By Manager ( Donno whether to mention his Name or not ) .
Well the Sessions were up to the Point and made sure that we are clear about our Foundations .

Then a assignment was Given and still the assignment is pending.Oops i thought,the Manager was somewhat angry on Us for not completing it on time

Well thats apart, I am clear of what was thought and now think i am Quite confident of How to start My career with. Now Coming to the Important part Object Oriented Programming and Design Patterns .
Wikipedia Notes on DesignPattern

In software engineering, a design pattern is a general reusable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Algorithms are not thought of as design patterns, since they solve computational problems rather than design problems.

The Design Patterns help in writing a Clear Code , Speeds up the Entire Software Development process, enable testing to be done properly.Effective application of the Design patterns with the Object Oriented Concepts will improve the Project/ Product overall.

The Design Patterns can be classified Abstract,Factory,Singleton etc… and the List Goes On.

A simple Singleton / Factory Pattern Looks Like the Code Below.

class CarSearch : Search
{
private CarSearch()
: base()
{
}
private static CarSearch Instance = null; // Static Field to Create the instance only once.
public static CarSearch GetInstance()
{
if(Instance==null)
Instance=new CarSearch();
return Instance;
}
}

Calling the Method
var sh= (Isearch)typeofControl.GetMethod(“GetInstance”).Invoke(“CarSearch”, UserParam); // Invoke the Method of Corresponding Class to create a instance only once. ISearch is a Interface ,”CarSearch” is a Class.Have Used Reflection to Call the Method

I Understand that these might not Look like a professional Written Code but these gives a Clear idea about the concept.

I will try to Update more as and when i learn about it.

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

1 Response

Leave a Reply