Follow our illustrated blog on Embedded Software Architecture

How to build a hybrid solar/wind energy harvester?

Object-orientation in C – Part 4

We continue to build on the example in Part 3, but we go another step further. Even more abstraction and information hiding can be achieved by partially mimicking (part of) the COM manner of programming: strictly talking with interfaces. This style of coding is not for everybody, nor is it a fit for every project. […]

Share

Object-orientation in C — Part 3

For non-trivial class hierarchies the method proposed in Part2 is probably not optimal. The main reason is that there is only one C struct which is used by base and subclasses. Consequently, the hierarchical tree is only implicitly contained in the data structures and therefor, in this last part of the series, we introduce a […]

Share

Object-orientation in C — Part 2

In Part1 we have laid the foundation of how a class could look like in C. This simple class is good for creating an Abstract Data Type but it doesn’t support polymorphism and inheritance…yet. Here is an UML diagram (made with dia) of what we are trying to achieve in this post: Admitted, the example is not very original […]

Share

Object-orientation in C — Part 1

Object-orientation Object-orientation is about classes and objects. A class is an abstract data type: data type: because it defines a new type to work with by providing data and operations on this data, but also abstract: because it encapsulates this data and hides implementation details behind an hopefully nice and clean interface. An object then […]

Share

How procedural code evolves to object-oriented code

Introduction Most (real :-)) embedded software is written in C. Although C is a general-purpose procedural programming language, it is perfectly possible and useful to write object-oriented code in it. Object-orientation – well, GOOD object-orientation – allows for better code maintenance by managing code complexity. Actually, there are two ways to manage software complexity: abstractions, […]

Share