什么时候面向对象不是正确的解决方案? [英] When is Object Oriented not the correct solution?

查看:13
本文介绍了什么时候面向对象不是正确的解决方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近遇到一些意见,说不应该总是使用面向对象的设计/编程.
您是否知道一些不会受益于也不应该使用面向对象设计的用例?

例如:有一些问题(关注点)会从 AOP 中受益.

I've encountered lately some opinions saying that Object Oriented design/programming should not always be used.
Do you know some use-cases that will not benefit from and should not use Object Oriented design?

For example: there are some problems (concerns) that will benefit from AOP.

推荐答案

有些问题最好使用其他范式来表达,例如函数式编程.此外,声明性范式允许对代码的正确性进行更健壮的正式推理.请参阅 Erlang 的一个很好的例子,该语言具有某些优势,由于 OO 语言无法真正匹配范式的基本性质.

Some problems are best expressed using other paradigms such as Functional Programming. Also, declarative paradigms allow more robust formal reasoning about the correctness of the code. See Erlang for a good example of a language with certain advantages that can't really be matched by OO languages due to the fundamental nature of the paradigm.

其他语言范式更适合的问题域示例是数据库查询 (SQL), 专家系统(Prolog、CLIPS 等)统计计算 (R).

Examples of problem domains where other language paradigms have a better fit are database queries (SQL), expert systems (Prolog, CLIPS etc.) or Statistical computing (R).

这篇关于什么时候面向对象不是正确的解决方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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