Thursday, April 29, 2010

Let's know 'Design Patterns' in C++

Good evening all! Hope you are doing fine.

Now a days, everyone in object-oriented software community talks about design patterns, which was not known very well just a few years back. So, what's so special about it and why everyone started discussing about it?



Well, let's start, then we'll  know what this is all about. We all have heard and known he term "object-oriented", haven't we? This whole discussion will go around well if we already know the concepts of  object-oriented technology or how to design a software using  this. But please, don't loose your heart, if you don't rate yourself very high in that. We'll discuss everything here if we need to know them.

Ok guys! Let's start design pattern... They say, "Design Pattern is to solve the common problems in software design.". So what's this common or general problem that occurs while designing a software?

Let's try to understand it in this way, assume we are using a non object-oriented language e.g. 'C', and we have been told to implement 'Inheritance' or 'Polymorphism'. As, we all know it can't be done easily in 'C ', because there is no built in feature in this language to implement them, however, these are the basic features in object-oriented feature supported languages such as C++ or Java. So, using a procedural language, implementation of  object-oriented feature is a common or general design problem and needs some design patterns like 'Inheritance' or 'Polymorphism' to solve it.

So, one thing that we knew is; how design patterns can be implemented in one language and can't be in others easily. So, in similar way, even for C++ there are so many things that can't be done easily need object- oriented design patterns to solve them. We'll learn them one by one. For now, have a look at the patterns in the image and think, isn't it better to store this complex pattern and reuse it quickly whenever needed?

Thanks for the reading!

No comments: