Why Choose C Language for Embedded Development?

Why Choose C Language for Embedded Development?

From the perspective of language characteristics

  • C language has excellent portability and can run on various soft/hard platforms with different architectures.

  • It is concise and compact, using a flexible syntax mechanism, and can directly access hardware. The languages that can directly access hardware include assembly and C language. Assembly is a low-level language that is difficult to accomplish some complex functions, but it is more efficient than C language in accessing hardware.Therefore, hardware initialization tasks are generally assigned to assembly, while more complex operations are handled by C language.

  • C language has a very high execution efficiency.

Low-level language in high-level languages: Procedure-Oriented vs Object-Oriented

Procedure-Oriented

“Procedure-Oriented” is a programming paradigm centered around processes. It can also be referred to as “record-oriented” programming, which does not support rich “object-oriented” features (such as inheritance and polymorphism) and does not allow mixing persistent state with domain logic. [Paid] STM32 Embedded Resource Package

Procedure-oriented programming involves analyzing the steps needed to solve a problem and implementing these steps sequentially using functions, which can be called one by one when needed. Procedure-oriented is actually the most practical way of thinking, even the object-oriented approach contains elements of procedure-oriented thinking.

It can be said that procedure-oriented is a fundamental method that considers practical implementation. Generally, procedure-oriented programming refines from top to bottom, so the most important aspect of procedure-oriented is the idea of modularization.

Object-Oriented

Object-oriented analysis decomposes the system based on the key abstract problem domain. Object-oriented design is a process of implementing an object-oriented system that provides symbolic design, constructing the system into “real-world” objects using terminology that closely resembles the actual domain.

Object-oriented programming can be seen as a thought process that includes various independent and mutually calling objects within the program, which is in stark contrast to traditional thinking: traditional programming advocates viewing a program as a collection of functions or simply a series of instructions given to the computer. Each object in object-oriented programming should be able to accept data, process data, and pass data to other objects, thus they can all be seen as small “machines,” i.e., objects.

Differences between Procedure-Oriented and Object-Oriented

For example, when a person travels from point A to point B, procedure-oriented requires planning the route, understanding the road conditions, and preparing a series of things by oneself.

In contrast, object-oriented is like getting into a taxi and telling the driver to take you to point B without worrying about anything else.

Finally, C language also has its own shortcomings, such as poor code reusability, poor maintainability, and very limited extensibility. When adding new code, it does not change the original code. Related articles recommended: If C and C++ are two kitchen knives.

Leave a Comment