算法和设计模式有什么区别? [英] What's the difference between an Algorithm and a Design Pattern

查看:181
本文介绍了算法和设计模式有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在搜索撤消/重做算法,并发现标记为重复的东西,但重复的是撤消设计模式的请求。我真的很喜欢这样的算法。我不认为我一定需要一个设计模式。



设计模式和算法之间是否存在根本区别?有人可以互换使用两者吗?



我会挂断电话,把我的答复放在空中。好的,原谅我的思维设计模式只是算法的抽象。以下是我的调查结果的一个小表,都是非常好的答案。

 
设计模式|算法
--------------------------------------------- -
摘要|混凝土
控制结构|操作集
模板|
OOP |结构化/ OO编程
灵活|确定性
架构(蓝图)|配方


解决方案

一个算法就像一个食谱:执行一些活动的分步过程。



设计模式就像一个蓝图:结构化的对象和关联集合以及完成某些目标的操作。


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               |
OOP                    |Structured / OO Programming
Flexible               |Deterministic 
Architecture(blueprint)|Recipe

解决方案

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.

这篇关于算法和设计模式有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆