C Programming

A while ago, I had a problem. I wanted to do a little hobby programming project. So naturally, the biggest question was what language. Do I sharpen the saw on the tools I use at work or learn something new? Pretty simple, I kinda want to do something new and fresh. But what new thing do I want to learn?

After much indecision, I landed on C. I never really got much time to play around in C in school and what little I did do was under the combined banner of one class on C/C++. The 'main' line programming courses were Java focused. The general footnote on C from that class was along the lines of how awful things were before C++ came along and fixed it up, and even C++ was more or less positioned as Java plus memory management and no garbage collection, the main aim was basically to teach us at least a little bit about heaps and stacks and dynamic memory allocation.

In other classes too, it was set up as a necessary evil. A stepping stone on the path from assembly on the road to Java. But I have to confess, I must have been a bad student because in spite of it being set up to take the fall, I enjoyed programming in C.

My background in the industry is steeped in Object Oriented Programming as well, I have years and years of applying and vetting SOLID design principles and discussing Gang of Four patterns. I have even tuned the garbage collection in Java more than once. I will even leverage the language features to make Python and JavaScript feel more object oriented.

I also learned to enjoy functional programming. It's a lovely paradigm shift that, for me at least, encourages upfront understanding of the problem. I wish I could get more of it in use at work. I've kicked it around with some fellow developers, but I never really got any thing like this off the ground except one Elixir Phoenix project. But even that felt... misguided. I foresee the rotting husk of a once beautiful Haskell project or Elixir project or Erlang project lurking in a dreaded dark corner of the company repos that junior devs shudder to think about as the old timers make them draw straws to maintain it.

But procedural programming. It just feels nice. C is simple and clean. It just feels great. At least at the scale of hobby development I am doing. I feel like I can do what I need to do when I need to do it without having to fight the language. It gets out of my way and lets me solve problems in ways other languages are opinioniated on.

I have no real reason to enjoy it, but I do. There's just something about it that feels clean and powerful. Don't get me wrong, there's tons of messes that crop up, but they feel like my messes, not one the language foisted on me. It's probably psychological, most of my OOP is done professionally, so not only do I have the language insisting that I must nounify my verbs, there is also a mountain of code that I have never seen before that pushes me into a corner and requires me to do it in a specific way, from libraries, to frameworks, to legacy code. All these other folk working in this repo are making decisions outside my control, and perhaps that simply tweaks my ego and leaves a bad taste in my mouth. But regardless: C feels free.

Freedom, yes, but free for what?

The langauge feels very unobtrusive and unopinionated, leaving me to write code as beautiful or ugly as I want. It feels like it is mostly left to my opinion on what the computer ought to do, and I have all sorts of tools to bring about my vision. It's just nice after all the languages that are much, much more insistent about what I had ought to do.

That same freedom is probably why I would never actually want to use it professionally. With a small cohesive team, it would be fine. Good even. Get everyone on the same page, build things up, include sensible libraries and you can have a very readable, very understandable code base that ultimately has very few spots of the code base that are cordoned off. But successful small teams scale up and become departments and when the language isn't opinionated how you solve something you rely more on social convention for what is "understandable" or not. I'm reasonably confident in any given five professionals to come to an uneasy compromise. Ten developers there's a good chance you can at least get everyone justifiably upset but on the same page with only a little resentment. Even then, (and certainly beyond that) things start to break down with a multitude of 'Well we really need to get this out more than we need to fuss about this particular bit of ugliness'.

Ultimately, all of that is probably why successor languages came about that are much more opinionated and much more prescriptive: Lots of folk worked on lots of teams and were forced to endure pain around these various aspects and eventually someone got annoyed enough to sit down and say "Enough! Enough. Memory management is not to be debated and dabbled in by developers under pressure, I'm tired of being the watchdog. The language itself ought to be the one handling memory management, it's just too fiddly and too error prone", and on and on.

Flying Solo

But that same simplicity and open potential that would leave me endlessly debating and hopelessly trying to enforce my vision in a sea of competing shareholder needs on a large team seems fine for a personal project. So, I'm going to stress test myself here. I've done some simple toy projects in C and some modest scale hobby projects. I'm going to make a game from near about scratch in C. I'll use SDL, and maybe some other libraries along the way but for the most part, just me constructing what I need. Efficient? No. Am I going to wind up with a buggy terrible mess? Oh yes. But it's going to be fun for me to flail around a bit and be miserable, to refine my opinion as to what it is I like about the language and what has started to really grind my gears and perhaps that will help shape my next language choice for my next grandiose hobby project.

It is going to be an amusing journey and one I think I may document just to keep myself honest under the pseudo-threat of public scrutiny, for all that is worth anyways. I have the natural tendency to get bored once the going gets tough and decide that this other problem is clearly the more interesting one, and perhaps I had ought to start anew because, really, it would be faster and less miserable and isn't this just a hobby project anyways? Hopefully the pressure can keep me from buckling and moving on. I will admittedly probably cave anyways in spite of the shame of skipping off to the next project. After all, I have done Enterprise Java, clearly shame is a commodity I have long since sold.