Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do we have design patterns in C++ as we have in java?

As we have so many design patterns in java, like wise do we have any in c++.Or can we use the same sort of patterns in c++.

like image 859
GuruKulki Avatar asked Jan 31 '10 12:01

GuruKulki


People also ask

Are there any design patterns in C?

There are various patterns in the C language like star patterns, number patterns, and character patterns.

Are design patterns same in all languages?

Design patterns are not inherently language specific, although some patterns are more useful in some languages than others.

Which language is best for design patterns?

For learning design patterns, you probably want Java or C#. Those languages tend to be used by people that consider design patterns as idiomatic ways of writing the language. i.e. people consider using many design patterns in Java or C# to be the “correct” way of writing C# or Java.


1 Answers

The original book on Design patterns (Design Patterns: Elements of Reusable Object-Oriented Software by the Gang of Four) predates Java. The examples in there are in C++ and Smalltalk.

Design patterns are applicable to many object-oriented programming languages; maybe it's just that in Java they are usually so ubiquitous that you need them to solve anything non-trivial.

However, some design patterns are solved by language features (you don't need to explicitly implement an Observer Pattern in C#, for example). Others aren't even applicable to Java, as they need multiple class inheritance.

like image 189
Joey Avatar answered Oct 05 '22 10:10

Joey