Object Oriented Programming vs Procedural Programming

自闭症网瘾萝莉.ら 提交于 2019-12-13 08:38:05

问题


Can we use Procedural Programming to solve any problem that can be solved using Object Oriented Programming Concepts? My problem is are there some particular problems which can only be solved using OOP concepts.

Please help me understand this.


回答1:


Yes. Anything that can be solved using OOP can be solved using procedural programming. In the end the compiler just turns your OOP code into assembly, which is procedural.

It all comes down to what the combination of the CPU/RAM etc in your computer can do. Since your computer is Turing Complete it can solve any problem that be solved by any other language or machine that is also Turing Complete.




回答2:


Nearly all programming languages are "Turing complete". That means programs written in one paradigm (say the functional one) can always be converted to another one (say the logical one). A compiler is just a tool that translates code from one language/paradigm to another. Thus the moment a language is Turing complete, you can solve anything in that language you can in any other, although the performance and elegance of the code might vary.

Currently on the hardware level, the only implemented paradigm is the procedural one (there have been some experiments with the functional and logical one and even OO has already been implemented on a CPU).



来源:https://stackoverflow.com/questions/24432321/object-oriented-programming-vs-procedural-programming

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!