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

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

问题描述

我在寻找撤销/重做算法,并发现了一些标记为重复,但重复的是一个撤消设计模式的请求。我真的很想算法这一点。我不认为我一定需要一个设计模式。

有设计模式和算法还是确定有人使用两个可以互换?

之间的根本区别

我先挂了,并把我的回答落了空。

好吧,原谅我的思维设计模式是算法只是抽象。下面是我的发现从哪个都觉得很不错的答案一张小桌子。

   设计模式|算法
----------------------------------------------
摘要|混凝土
控制结构|设为炬力
模板|
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天全站免登陆