Ricardo Delfín
Ricardo Delfín

Week 3: 11/9 - 17/9

Downtown Austin as seen from the Colorado River.

Time to get the blog post for week 3 out! This will be a bit shorter than last time, since there won't be any type erasure or other similar crazy tricks going on, but I hope you still find the read enjoyable. Let's jump right in!

What did you do this past week?

I spent this past week catching up on homework and working on a side project I've had for a while. On the homework side I basically just finished the first software engineering project, where I had to calculate the length of the Collatz sequence of a range of numbers and print out the length of the longest chain. It was definitely an interesting problem since there are plenty of optimizations you have to make to make this problem tractable.

I now want to talk about the side project I worked on though. I've been trying to get more experience with OpenGL and C++, so I've been creating a program that, eventually, should show and simulate boids. Basically, it's a group of bird-like entities (hence the name) that, with very simple rules, exhibit complex flock-like behaviour.

I spent most of this week getting my code to work on my desktop computer, and adding a skymap. Fortunately, I managed to get both working. The first was a series of bugs caused by differences in the Nvidia implementation of OpenGL, while another was caused by me not realizing that the window I was creating was in fact too big for my monitor (and this took longer to debug than I'll ever admit to).

The second issue was a bit more interesting. OpenGL is one of those interfaces with a lot of legacy and external influence that went into its design. This has resulted in an interface with a lot of potential pitfalls. This is compounded by the fact that it's designed as a hidden state machine, where you call functions to change said state, as well as very uninformative error reporting. Essentially, it caused an issue where I had created too many of a certain kind of object (VAO's), which caused it to never load in the skybox. Suffice it to say, after much fiddling and testing, I got it to work.

What's in your way?

School-wise, I don't have too many roadblocks. There is one thing worrying me lately. Specifically, it's graduation. I am still unsure what my life after graduation will look like. My biggest roadblock in defining that is finishing interviews and waiting for companies to get back to me. It's been a source of nervousness lately, and I hope to be done with it as soon as possible.

What will you do next week?

I'll spend my next week catching up with my Artificial Intelligence class (homework will be due soon, and the homework is short enough to finish in one day). I'll also catch up on my reading for my World Literature class. I've found the readings really compelling and interesting, but I'm not used to reading with deadlines, and I think it'll be to my benefit to get used to it. Otherwise, I'll see where I can take my boids program in the next week. I'll add, the app I recommended two weeks ago, namely, Timeline, has served me well to finish homework on time these first two weeks. I hope to keep that up.

What's my experience of the class?

This week we talked in depth about bad tests, exceptions, and the python type system. In particular, I found the last topic very interesting. In that class, I was able to gain insight on how other programming languages deal with types and getting information on them. Particularly, I was not aware that every class in Java has an instance of a class called class to access information about said class. I definitely gained a lot of interesting knowledge.

What's my pick-of-the-week or tip-of-the-week?

My tip for this week is, once more, for C++ projects. Specifically, I'll recommend that for your next project (and also previous projects if you can be bothered retrofitting them) that you use CMake. This might sound like a tough sell, but trust me on this.

You might be wondering, why bother with such a complex build systems for your simple project? And you're not entirely wrong, if all you're doing is writing a single .cpp file with no dependencies, CMake isn't worth the hassle. On the other hand, as soon as you start taking on dependencies, CMake is worth the hassle. A common issue with build systems in C++ is that it's extremely hard to add dependencies. This issue tends to be platform specific and requires you to figure out what files to include, from what directory, and ends up being a hassle.

CMake helps you out on this problem by making a powerful, cross-platform system that lets you include a wide range of libraries easily, and do it in a cross-platform way. The way this works is you take on scripts and CMake files created by contributors, that link in and include a library. You can also contribute back by writing build scripts for other libraries. It's become widely used in the C++ community and essentially every library has a CMake build option attached to the source, so go ahead and take advantage of this great resource!