OOP和设计模式如何相关? [英] How is OOP and Design Patterns related?

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

问题描述

设计模式不是OOP原理的扩展吗?为什么这两个概念分开处理?我们可以相信,如果知道设计模式的人肯定会是一个OOP专家?

Aren't Design Patterns an extension to OOP principles? Why are these two concepts treated separately? Can we believe that if someone who knows Design Patterns would definitely be an OOP expert?

推荐答案

A 设计模式是一个经过验证的解决方案到一个常见的编程问题。它不一定是一个面向对象的编程问题,但是这几天最常见。

A Design Pattern is a tried and tested solution to a common programming problem. It doesn't necessarily have to be an Object Oriented programming problem, but that is most common these days.

学习编程对许多人来说并不困难。这就像玩乐乐斯(Legos):有一些不同的部分,你可以一起抓住你想要的。有时你会做一些很酷的事情,但是大多数时候你会做出回报=)。通常,玩的时间越长越好。

Learning to program is not hard for many people. It's like playing with Legos: there's a handful of different pieces you get to snap together however you want. Sometimes you make something cool, but most of the time you make crap =). Usually, the longer you play, the better you get.

学习设计模式是学习构建程序的好方法。你本质上是在已经建造了几十年的人们的建议。他们将他们最常见的解决方案提炼成简单,可消化的知识与难忘的名字。这就像数字时代的学徒:你的老人们给你最好的建议。你可以采取它,并在比赛之前,或忽略它,并重复所有的错误。

Studying Design Patterns is learning good ways to build your programs. You're essentially reading advice from people that have been building things for decades. They've distilled their most common solutions into simple, digestible tidbits of knowledge with memorable names. It's like an apprenticeship for the digital-age: your elders are giving you their best advice. You can take it and be ahead of the game, or ignore it and repeat all of their mistakes.

为什么设计模式和OOP分开处理?强>因为他们是不同的科目。一般来说,您学习编程,然后您将学习如何考虑编程。我希望这是另一回事,但我没有呼吸。

Why are design patterns and OOP treated separately? Because they are different subjects. In general, you learn to program, then you learn how to think about programming. I wish it were the other way around, but I'm not holding my breath.

有人知道设计模式一定是OOP专家吗?否。

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

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