Chace's Tech Blog

Reflections on my Programming Adventure

First Post! Udacity C++ Nanodegree

01 Apr 2020

I graduated from the Udacity C++ Nanodegree program this week and I feel very good about what I accomplished over the past four months. Prior to this class my programming experience was mainly python and at the intermediate level. I had a firm grasp on computer science fundamentals and understood the main principles behind object oriented programming. However I still did not know much about the difference between dynamically scripted languages such as python and compiled languages like C++. I also did not know much about algorithms and how they are structured to produce useful output stemming from basic data input.

This program required me to really put my existing programming knowledge (python) to work and extend it to the vast capabilities that C++ has to offer. The program was divided into 4 primary courses that seemed to fall into two categories of fundamentals and advanced topics.

The fundamentals covered in the first two sections include general C++ syntax, procedural programming components such as methods, objects, and data structures, and finally an extensive coverage of object oriented programming. I learned a lot about what C++ had to offer during these sections in addition to learning about the A* search algorithm which is super cool. This was my biggest takeaway from the first half of this course because it was my first encounter with an extensive depth first search algorithm. My only previous experience with something similar to this is the application of sorting lists and evaluating the different associated compute costs for different methods of sorting. Udacity taught this information in a very linear constructive way that allowed me to put the building blocks together at my own pace and enabled me to really understand the content. The result of this work, yielding the shortest traversable path from point A to B within open street maps is shown below:

OSM A* Search Route Planning Project

The second part of the course was my favorite because of how much it challenged me to learn about advanced programming concepts such memory management and concurrency. The Udacity instructor did a great job covering how C++ evolved memory management over the past several decades into what is now known as “Modern C++ (C++ 17)”. They covered the importance of memory allocation and deallocation on the heap in addition to “the rule of 5” and how these rules ensure appropriate handling of resources. Lastly they wrapped up the memory management section with a lesson on smart pointers and all the associated built in features they include which allow the programmer to focus more on what they want the code to do and lessen the burden of memory leaks and other memory related bugs. The knowledge I gained from this section was put to the test in the Memory Management Chatbot project where I had to take an existing, working application and modify it to become more efficient through the use of responsible resource allocation on the heap. Mainly focusing on transforming raw pointers into smart pointers and utilizing move semantics where ownership needed to be transfered.

All concepts so far throughout this course converged in the final lesson on concurrency which was by far my favorite because of all the “moving pieces”, literally. The biggest motivation for my interest in programming is due to the dynamics of it and concurrency makes this work multidimensional, which fascinates me. We started this lesson learning about the creation and handling of single threads and then expanded this into multithreaded applications while comparing the increase in cpu utilization for each example. Next was a transition to learning about tasks, promises, and futures and how these extend the concept of threads very much like how smart pointers extend the handling of regular raw pointers. I feel that the content in this section was my best takeaway from the whole course and will be sure to exercise it throughout my future endeavors. Multithreaded applications are extremely powerful and dangerous at the same time which makes them so much fun to work with.

The lesson on concurrency concluded with a project that involved the simultaneous simulation of multiple vehicle objects each with their own thread. Udacity made this project extremely fun because they integrated a great visual front end that really helps visualize the state of each thread (shown below). All of my efforts were involved in the creation and management of all threads and making that functionality accessible in the main loop.

Concurrent Traffic Simulator

In conclusion my biggest takeaway from this course was learning and practice of the C++ advanced concepts - memory management and concurrency. I enjoyed the concurrency portion so much that I decided to make it the focal point of my final project which extended the snake game to make it multithreaded through the addition of a dynamic obstacle running in it’s own thread. I am extremely excited to apply what I learned in this course to my personal projects and create very intelligent robots. My biggest motivation currently is to create my own object detection in avoidance pipeline for my personal robot (it will definitely include threads!).

Below is a summary of all the projects I worked on throughout the Nanodegree course along with a link to the source code in my GitHub repo. Enjoy!