Reading Assignment

what we are going to do in this class

for the first 1/3 of this class we are going to cover programming in c++
In order to implement the algorithms and data structures for the remaining 2/3 of the class you will need some basic c++ skills that may not have been covered in depth in cmps2010.

this will focus on pass by reference and pass by pointer functions, dynamic memory allocation and pointers and finally classes and data encapsulation. 

We are going to start today with logging, why start with this.. why not seems as good as a time as any. You may not find it that useful at first but it will be vital in getting the more complicated assignments done later in the class. 

C and C++ is not an easy language to master and finding bugs can be quite difficult. If your car does not run properly and you take it to the mechanic and explain they symptom you are having they will likely tell you there are several things that could be wrong and generally the first step is to spend some time diagnosing the issue. They then will give you an estimate for the parts and labor costs that will be required to attempt to solve the problem. The more accurate the diagnosis the greater the likelihood is that the repair can be done in the shortest time with the least cost. A poor diagnosis will lead to lots of parts being replaced that were unnecessary and time wasted. 

Do not make the mistake of thinking that learning good diagnostic skills is a waste of time, in reality it is quite the opposite.

There is a logging library provided for you, learn to use it and learn when and where to add logging to your code so that you can see via the log file(s) what is going on behind the scenes.

why c and c++ ?

That is what we use here at csub, some places teach in java , Python or something else but here we use c and c++. As computer science students it is important that you understand in depth how computers operate so that you can design or work with software efficiently.

Pretty much every single computer on the planet uses code written in C or C++. A micro processor can only understand machine language and C and C++ are compiled down into assembly language. It was developed to create assembly language executable programs to run on the hardware system. Python, Java, Perl, PHP, C# and a multitude of high level languages can not run on a microprocessor. Since a microprocessor cannot operate with any language other than machine language it is not possible. All the higher level languages must have and interpreter running that assists them and does the work behind the scenes and these are written in C or C++ and compiled into assembly language. 

Higher level languages certainly have their place and are the preferred choice in many specific instances but C and C++ are such a vital piece of the equation they will be the base language used in this class.


In this class we will use the logging library to essentially take notes for us as our program runs. If you don't need to look at the notes great, no harm no foul but when the time comes where you need these notes and you don't have them then you are going to be in a really bad place. 

Windows has an event viewer that is basically a logging system built into the operating system. Programs will write information there when a program experiences a failure or has a warning condition that it deems may need some attention. Who decides what and when it writes to the logs.. the developers and the engineers.

Linux , Unix and BSD (mac os is BSD based)  all have a portion of the file system dedicated to writing log files like we do in this class.

It is common practice if not absolutely mandatory in a real world environment.