- Extreme C
- Kamran Amini
- 358字
- 2021-03-26 16:15:44
C is not object-oriented, but why?
C is not object-oriented, but not because of its age. If age was a reason, we could have found a way to make it object-oriented by now. But, as you will see in Chapter 12, The Most Recent C, the latest standard of the C programming language, C18, doesn't try to make C an object-oriented language.
On the other hand, we have C++, which is the result of all efforts to have an OOP language based on C. If the fate of C was for it to be replaced by an object-oriented language, then there wouldn't be any demand for C today, mainly because of C++ – but the current demand for C engineers shows that this is not the case.
A human thinks in an object-oriented way, but a CPU executes machine-level instructions which are procedural. A CPU just executes a set of instructions one by one, and from time to time, it has to jump, fetch, and execute other instructions from a different address in memory; quite similar to function calls in a program written using a procedural programming language like C.
C cannot be object-oriented because it is located on the barrier between object orientation and procedural programming. Object orientation is the human understanding of a problem and procedural execution is what a CPU can do. Therefore, we need something to be in this position and make this barrier. Otherwise high-level programs, which are usually written in an object-oriented way, cannot be translated directly into procedural instructions to be fed into the CPU.
If you look at high-level programming languages like Java, JavaScript, Python, Ruby, and so on, they have a component or layer within their architecture which bridges between their environment and the actual C library found inside the operating system (the Standard C Library in Unix-like systems and Win32 API in Windows systems). For instance, Java Virtual Machine (JVM) does that in a Java platform. While not all these environments are necessarily object-oriented (for example JavaScript or Python can be both procedural and object-oriented), they need this layer to translate their high-level logic to low-level procedural instructions.
- Python量化投資指南:基礎、數據與實戰
- PHP+MySQL網站開發技術項目式教程(第2版)
- Microsoft Dynamics GP 2013 Reporting, Second Edition
- Effective Python Penetration Testing
- 用Python實現深度學習框架
- Programming with CodeIgniterMVC
- Android傳感器開發與智能設備案例實戰
- Serverless Web Applications with React and Firebase
- SQL Server 2008中文版項目教程(第3版)
- Python Programming for Arduino
- PHP 8從入門到精通(視頻教學版)
- C#網絡編程高級篇之網頁游戲輔助程序設計
- Hands-On ROS for Robotics Programming
- 循序漸進Vue.js 3前端開發實戰
- Java EE 程序設計