Monday, April 15, 2019

C++ No Class

I've always worked with OOP patterns, even when I didn't know what I was doing. Honestly it makes sense to me, naturally. It is easy for me to wrap my head around how large problems can be broken down into manageable objects. I feels organic and natural to me. As many OOP explanations point out, it mirrors reality. I have a much harder time understanding functional paradigms. it just feels like the dreaded 'spaghetti code' to me.

However, as a high level language developer digging into C++, my feelings are a bit reversed. When I attempt to define and consume classes etc, I keep running into all sorts of issues - redeclared variables due to includes. However if I remove the offending includes I get 'cannot find X'. I feel as though I'm in a catch 22.

So for my first C++ project I've decided to avoid the headache altogether and code everything within functions. Sort of a noobie functional paradigm. Instead of classes I'll have header files containing that element's functions which are called in main and in turn can call other functions if needed.

So far I have sqlite hooked up and some basic string parsing - which is frustratingly difficult so far. I'm amazed at how difficult simply doing a string split is in C++. More on that in future articles.

No comments:

Post a Comment

From Shotcut to Kdenlive

So I've been using Shotcut for a while now, for my YouTube videos... and music videos. I love the application. Slicing clips, doing fade...