views:

174

answers:

9

Most of people say that design patterns only relate with software engineering.

Patterns makes us to focus on reusing of existing modules or freeing us from onerous work caused by changing in the future.

Does patterns makes the program run more efficiently?

+7  A: 

I think wiki says it the best.

A design pattern in architecture and computer science is a formal way of documenting a solution to a design problem in a particular field of expertise.

It can make a program run more efficiently, it can make it take less space in memory, it can make extend easier. etc etc.

It's all about what pattern you are talking about and what software problem you are applying it to.

Ólafur Waage
+1 but "It can make a program run more efficiently, it can make it take less space in memory" - implementing a design pattern can also do the opposite.
SnOrfus
Aye very true :) that's why I said it can, not that it will.
Ólafur Waage
A: 

There are literally hundreds of design patterns out there. Some of them are for ease of maintenance, some of them are for proper object access, I am sure that some of them can even be considered to be "performance" enhancing patterns as well.

THe key is that they are proven ways of solving a problem, by nature then they might improve performance or many other aspects.

Mitchel Sellers
A: 

In simple words I can say that design pattern actually a way to solve problem. If you know the problem and design pattern exist, then design pattern will solve your problem in best manner.

Syed Tayyab Ali
+3  A: 

Do not reinvent the wheel.

It is the main goal. Design patterns have been designed to solve repeated problems.

So they help you to have a clearer code, usable (and re-usable) (as far as they are used right)

Boris Guéry
A: 

The patterns make your programm more maintainable, thus your programming may be more efficent. This doesn't necessarily affect runtime efficiency (the programm may be even slower due to runtime polymorphism).

Dario
A: 

"Does patterns makes the program run more efficiently?"

Only if you've found some good patterns for efficiency.

The design pattern for a Mapping is a way to eliminate searching. You'll see that the amount of time spent doing searches will be less (one kind of efficiency), but it may use more memory (another kind of efficiency).

The Tree Map design pattern (Python folks would call it an ordered dictionary) is one variation of this design pattern.

The Hash Map design pattern (Python folks would call it a dictionary) is another variation of this design pattern.

They're more time-efficient, but less space-efficient.

S.Lott
Hash (or Tree) Map isn't a "design" "pattern", it's an algorithm.
alamar
You're referring to datastructures, not to design patterns!
Dario
Data structures are implementations of design patterns. The pattern is the "reusable idea" behind the implementation. There's no boundary around what's an "idea" -- all ideas are potential design patterns. The very notion of design patterns comes from buildings (not software).
S.Lott
A: 

Design patterns are a solution to a well defined problem. The solution consists of different parts that relate to one other. The solution belongs to specific context with advantages/disadvantages depending on the tools used, and what aspect of problem is emphasized. Design patterns are also a great way to communicate the design.

It's not just a software thing, on the contrary, the idea was heavily borrowed from an architect named Christopher Alexander.

egaga
A: 

Design Patterns are to objects as algorithms are to procedural programming. A design pattern tells you how to create one or more objects to perform some useful task. Just like a algorithm tells you how combine statements to perform some useful task.

RS Conley
+1  A: 

Design Patterns are generally used to help facilitate the loose coupling of different components, so that the objects themselves can be reused again and again in different applications without the need for major modifications. The re-usability of code is a major factor in development.

Another thing to consider is that by making your code loosely coupled, it will take far less time to implement changes through the usage of design patterns due to the fact that a major change in one area won't mean massive changes all around to facilitate. This means if you want to do constant updates and feature upgrades, you may only have to modify small and isolated portions of the code without having to worry about the entire project coming down in a big ball of flames all around you.

TheTXI

related questions