An idiom is an idea to work around the quirks of a language. Some examples that come to mind are any of the C++ idioms you linked in the original question. They solve a common problem in that language in a canned way.
A design pattern is similar, in that it solves a common problem. But the ideal design pattern is based on common language features, and thus is language agnostic.
There is a continuum between idioms and design patterns, though, just as there is from low-level to high-level languages.
The Visitor pattern is a good example; if there were only one language that only supported single dynamic-dispatch, then we might consider the Visitor pattern an idiom of that language. But there are whole hordes of languages that don't directly support multiple-dispatch. Hence, the Visitor pattern was born.
The Observer pattern also comes to mind - C# directly supports it, so it doesn't need the common work-around form of the pattern.
An example going the other direction is OO features (inheritance, polymorphism, etc). C doesn't directly support them. If more languages were like C, then we might develop design patterns to implement v-tables, type-safety, etc. Since plenty of languages support those feature, we'd call any common solution in C an idiom, rather than calling the generalized solution a design pattern.
Not entirely.
The primary purpose of the adapter pattern is to change the interface of class/library A to the expectations of client B. The typical implementation is a wrapper class or set of classes.
The purpose is not to facilitate future interface changes, but current interface incompatibilities.
The proxy pattern also uses wrapper classes, but for a different purpose. The purpose of the proxy pattern is to create a stand-in for a real resource. Reasons for using a proxy can be
- The real resource resides on a remote computer (the proxy facilitates the interaction with the remote resource)
- The real resource is expensive to create (the proxy ensures the cost is not incurred unless/until really needed)
The most important thing is that a proxy provides a drop-in replacement for the real resource it is a stand-in for, so it must provide the same interface.
Best Answer
A binary search is a design pattern. It's a problem that pops up all the time and the same pattern (binary search) solves it.
There is no difference between design patterns and algorithms from a mathematical level. Now if your talking to another human you should probably not say this because they are not capable of reducing ideas to their base components. Just like you shouldn't tell a math guy that all math is just basic addition (even though it's true).