I was searching for "Undo/Redo algorithms" and found something marked as a duplicate, but the duplicate was a request for a "Undo Design Pattern". I'd really like an algorithm for this. I don't think I necessarily need a design pattern.
Is there a fundamental difference between "Design Pattern" and "Algorithm" or is it OK that someone uses the two interchangeably?
I'll hang up and take my answer off the air.
Ok, forgive me for thinking design patterns were just abstractions of algorithms. Here's a little table of my findings from the answers which were all very good.
Design Pattern | Algorithm ------------------|---------------- Abstract | Concrete Control Structure | Set of Actions Template | Implementation Flexible | Deterministic Blueprint | Recipe
A design pattern is a relatively vague description of how to solve a problem at an architectural level, with emphasis on flexibility and maintainability. An algorithm is a precise description of how to compute something specific, with an emphasis on correctness and efficiency.
Design patterns:
Algorithm:
An algorithm is a specific set of steps to perform a task. Decoding an audio or video file would use an algorithm.
A design pattern is more of a template for designing a system with certain characteristics.
When I studied design pattern concept for the first time, I was also surprised why design patterns were introduced in the presence of algorithm. As my knowledge has been increasing with design patterns, I am reaching at this point that algorithm is entirely different approach to solve the problems and design pattern is different.
Design pattern is basically a recurring solution of same problem for a software application in a particular context which is somehow not related with algo, because algorithm is the step by step instructions to solve the problem.
An algorithm is like a recipe: a step-by-step process for performing some activity.
A design pattern is like a blueprint: an structured collection of objects and associations and actions to accomplish some goal.
A design pattern would determine how you design an algorithm (or may have nothing to do with algorithms, but let's say we're dealing with one that does), whereas an algorithm will be a set of solid, repeatable, implementable, steps to doing something. So no, I wouldn't call them interchangable.