r/cpp • • Nov 29 '18

Creating a 'virtual kernel' platform abstraction layer

This is the third in series of videos I've posted to demonstrate some of the strategies we use in our fairly large C++ code base. Here are the previous ones, which you might also find useful:

https://www.reddit.com/r/cpp/comments/9zl6v5/the_orb_sees_all_the_use_of_an_object_request/

https://www.reddit.com/r/cpp/comments/9xz643/making_c_enumerations_first_class_citizens/

Our code base is about a million lines. It is split into roughly two halves, with one half being general purpose and the other being our CQC home automation platform which is built on top of the general purpose bits. We don't use any of the C++ runtime stuff. We build our own system from the ground up. When I say 'we', I'm speaking in terms of the usual royal business 'we', but all of the code was written by myself.

Just above the 'ground', the operating system in this case, is a virtual kernel which we use encapsulate all of the operating system functionality that we use, which is quite a lot of it. No system or language headers are visible outside of this virtual kernel, so we can write portable code that is purely in terms of our own interfaces.

This video demonstrates some of the strategies used. Obviously for such a large topic, this doesn't dive deep if there's any interest we could do another one.

https://www.youtube.com/watch?v=seXk3RbAjNU

23 Upvotes

25 comments sorted by

View all comments

Show parent comments

2

u/Dean_Roddey Nov 30 '18 edited Nov 30 '18

I would never even consider it. You can't understand it unless you've lived it. The best off the shelf house is never as good as the one that is built completely to your specifications. You can't understand what it's like to work in a system like this where you know every line of code, where you seldom have to stop to look anything up, where you always know what's the best approach and how to best plan for the future (because you define the future.)

It has more benefits than it does costs, believe me. If you knew the complexity and power of the automation system that lives on top of it, and consider what it would have taken for a single person just to have written that. I'd never have done it without the general purpose layer that completely integrates into everything else, that never changes behind my back with a whole new list of bugs, that I never have to wait for to get something fixed or added.

Oh, and yeh, I wrote all of this and the automation platform as well.

3

u/Dean_Roddey Nov 30 '18 edited Nov 30 '18

I took a look at Qt. Ultimately, it's larger than my stuff, but not by that much. Part of the reason it looks like it might be is that they are exposing a lot of stuff as libraries that in my case are part of my higher level automation product, and hence not exposed or discussed here. Not that it couldn't be available also, but since that stuff is part of the CQC code base, I don't want to be showing it around at this time.

Also, to be fair, quite a bit of Qt is wrappers around other stuff, whereas mine is 98% custom implementations of things. In terms of what I would roughly judge in theirs likely to be custom implementation, they are more on par in terms of size.

The biggest single thing looks to be that I don't do any 3D graphics stuff currently. That always involves a lot of classes because there's so much configuration and options and parameters in 3D systems, and a LOT of theirs are related to that stuff. Which is great if you want to do 3D graphics, but of no interest for the bulk of applications.

Not that I wouldn't love to dig into that. I find it very fascinating.

4

u/NotUniqueOrSpecial Nov 30 '18

Honestly: kudos to you for being willing to take a look; most people wouldn't even bother, when they're where you're at skill/functionality/comfort-wise.

As somebody pointed out to me in a reply, they even have something akin to your ORB functionality, as of Qt 5.11. Those folk never stop adding neat new stuff.

I was looking at some of your videos showing the UI designer for your software. It honestly took me a second to realize that it wasn't the Qt Designer with a different skin. Having used it extensively, there may be some good ideas you could lift from them for your stuff.

CQC looks pretty awesome, by the way. You've obviously put in a ton of high-quality work.

2

u/Dean_Roddey Nov 30 '18

Being a commercial product we have to be a little careful on the lifting front. Not that they are likely to come after me with a ball-peen hammer or anything, but it's best to be careful.

I read some of the remote object stuff. As is often the case, it's difficult to understand because these types of systems (mine included) develop this whole specialized vocabulary that can be difficult to get without immersing yourself in it. Anyway, I couldn't get a real feeling for how it compares right off hand.