Pages

Thursday, 2 November 2023

Chapter 27 // Exercise 16 - Principles & Practice Using C++

In this exercise I'm using Visual Studio 2022 and ISO C11 Standard.

Chapter 27 // Exercise 16

Use macros to obscure (simplify the notation for) the implementation in the previous exercise.


Of course the final exercise had to be creating some disgusting macros. And with that


I can't believe that was the final exercise. It's been 7 years. I bought this book back in January 2016 with no knowledge of programming (apart from some brief HTML back in '98) and now I've been programming in C++ for 7 years, 4 and half of them professionally; I get paid to make video games, it's crazy.

I'm going to spend a bit of time collecting my thoughts and then come back with a full review of the book. I think my title is going to be "Why you should learn C++ as your first language". I honestly don't think I would've wanted to learn C++ any other way now.

I've been feeling a bit nostalgic lately and going back over books I bought way back in 2016 and 2017 as well as reading my green text on the early exercises of P&P posted on here. I read a chapter 4 post and the memories of that night came flooding back to me. It took me 6 hours to write a function comparing the size of two ints. It was 3am and I was so frustrated I started crying. I developed a fear of bools. Its absolutely hilarious to me now as I sit here reading a random book, silently ripping apart the authors code because they stored an pointer to an enum.

My mantra at work is "git gud". I can relax a bit when I've "gitten gud", then I can "git gudder". I honestly believed I hadn't really changed at all but lately I've started to realise that I can "just do stuff now". 6 years ago I bought Programming Game AI by Example by Mat Buckland. I tried to read it and follow along with the code but it went completely over my head as I had no experience with inheritance and I was convinced OOP was evil (because I didn't want to understand it). Recently, I picked the book back up and not only implemented the code from snippets with no problem but changed it as I was going along, grumbling about the authors use of singletons and lack of interfaces.

2 years ago I read the online book Ray Tracing in one Weekend and attempted to multi-thread it. It was a disaster and no matter how many times I read MSDN or StackOverflow I just couldn't get my attempts to work. Earlier this year I had another go and got a hacky version working in an afternoon. It's not perfect but it worked and I just "knew" how to do it.

3 months after starting as an intern at Rare, I asked a senior in a catch-up "when do you stop feeling like shit?" and his response was "you don't, but over time it won't be as bad". I pressed him for an actual time for "over time" and he just laughed and said "3 years". It's been 4 years since I asked him that.

It took me a very long time to stop feeling like a waitress/receptionist and start thinking of myself as a programmer. 

Thank you Bjarne for giving me the tools to change my life. 

1 comment:

  1. Hello LP! Congratulations on completing such a gargantuan book. I know this is a belated bravo, and you've moved onto the harder one. Still, I just discovered your blog as I've recently picked up my dusty copy of PPP and was looking for online resources. Like you, I got this book in 2016 and timidly attempted it several times, each time getting just a few chapters deeper. I believe I stopped after exhaustingly getting FLTK to work correctly. Many years have passed and now I'm transferring to my upper division classes for computer science. I've had a lot of false starts with my self-teaching journey and my college journey. For those reasons, I want to really solidify the learning I've done this past decade. I'm glad and appreciative that you've documented your journey so thoroughly.

    ReplyDelete