49: C++ Preprocessor. This Is Old Magic.
The preprocessor is old, primitive, and strong. But you need to understand its strengths to use it effectively. It adds capabilities that the C++ compiler cannot come close to duplicating on its own.

The preprocessor is old, primitive, and strong. But you need to understand its strengths to use it effectively. It adds capabilities that the C++ compiler cannot come close to duplicating on its own.
Chaining is a common term that has several different meanings. This episode explains how you can use chaining in your programs and how it works.
Programming languages have a lot of operators. More than most calculators anyway. Do you know what they are? Did you know there is an order to them? This episode explains precedence, associativity, and evaluation order.
What types of programmers are there?
Iterators give you the ability to navigate from one item to another in a collection and track a specific position within a collection. This episode is part two and continues describing even more advanced iterator topics.
Iterators give you the ability to navigate from one item to another in a collection. Why is this so special? Now that you know how to work with various collections, you know that they are structured very differently. An array just needs to move a pointer to the next item. A list needs to follow wherever the next pointer leads. A binary tree needs to go up and down the tree. Iterators give you a common way to navigate no matter what kind of collection you are using.
You will need to be able to work with groups or collections of items. You have choices and this episode continues more than a week long exploration of collection types available. Up today is the dictionary. I will explain what dictionaries are and then give you some guidance on when to use them.
You will need to be able to work with groups or collections of items. You have choices and this episode continues more than a week long exploration of collection types available. Up today is the hash table. I will explain what hash tables are and then give you some guidance on when to use them.
What can you expect your job to be like as a new programmer?
A game that only has one character with one quest and with one shop that sells one item is not going to be very fun. That is why you need to be able to work with collections of items. You have choices and this episode continues more than a week long exploration of collection types available. Up today is the left-child right-sibling tree. I will explain what these trees are and then give you some guidance on when to use them.
A game that only has one character with one quest and with one shop that sells one item is not going to be very fun. You have choices for storing collections of items and this episode continues more than a week long exploration of collection types available. Up today is the binary tree. I will explain what binary trees are and then give you some guidance on when to use them.
You will need to be able to work with groups or collections of items. A game that only has one character with one action and with one opponent is not going to be very fun. Up today is the list. I will explain what lists are and then give you some guidance on when to use them.
You will need to be able to work with groups or collections of items. A game that only has one character with one action and with one opponent is not going to win any awards. First up today is the array. I will explain what arrays are and then give you some guidance on when to use them.
How can you prevent denial of service attacks? Most of the techniques you will use to prevent a DOS attack are network related. This podcast is about programming so I will explain some things you can do that will make your software more resistant to attack.
There are some common Big-O notations that you should become familiar with as well as what kind of code leads to them. This episode continues the discussion of Big-O notation so make sure to listen to episode 37 first. Knowing the signs of these will help you write more efficient code and for some of them could actually mean the difference between your program working vs. never completing at all.
Big-O notation gives you the ability to describe how fast your code will run if given a large problem. It does not base anything on how fast or slow your computer actually is. It just looks at the steps needed to solve the problem and how they scale as the problem gets bigger.
Have you ever thought about why you cannot see stars during the day? How about why car headlights are so much brighter at night? Or why you can only hear a pin drop in a silent room? All of our body senses are like this. Our body is logarithmic.
Programming involves giving specific instructions but sometimes you want the ability to introduce random behavior. Maybe you want to simulate how a human character sometimes does things in a different order or takes a different path. Or maybe you want the computer to select various items from a collection. Or maybe you want to simulate the randomness of rolling dice. This episode explains how to do this.
What are denial of service attacks? The datacenter that hosts the Take Up Code podcast was put under so much stress due to a coordinated attack that the the entire datacenter had to be taken offline for several days while measures were taken to combat the attack. What happened? And what was done to make it better? That is what I am going to begin explaining today.
C# also supports both implicit and explicit casts and gives you some different choices when you need to switch types. Plus you have a runtime that is ready to throw an InvalidCastException. But even if you do not hit an exception, there are some things you should be aware of. This is still casting.
Can you change an int into a float? And because an int occupies multiple bytes in memory, can you get access to the individual bytes by themselves? Or what if you have a derived class and you want to refer to it as if it was a base class? And can you go the other way, from base class to derived class? These are the topics I will be explaining today.
Declaring methods inside classes is great but what do you do when you want a method you can call anytime? If you are using C++, then just write a method. But if you still want your method in a class or if you are using C# where all methods need to be in classes, then you will need to make your method static. And you can declare static data too. What does that do?
Your classes will likely have data members so how do you work with these data members? Should they be public? Private? Do you let other code access them directly? And what is the difference between a field and a property? This episode will help you get and set your data members.
How are namespaces and include files related and why do we need both?
Interfaces give you the ability to define behavior without actually implementing it. Why would you want to do that? Your classes can then declare support for interfaces which means that they promise to support that behavior. How your classes do this is up to them. Declaring support for an interface signals that they do this. You can have what might be completely unrelated classes all supporting the same interface which then allows you to work with them in the same way.
What if you were writing a class that you wanted to be a base class? A class designed from the very beginning to bring together other classes with common behavior. What if you also wanted to guarantee that this class could never be created by itself? That it must always exist as a base class for some other class? All you have to do is make your class abstract. Then it can only be instantiated as part of another class that derives from your class. This episode will explain why you might want to d...
Composition allows you to specify very different kinds of relationships between classes. This is sometimes also called containment. If you are building a racing game and have a car class and a wheel class, you would not want to say that cars are wheels but instead that cars have wheels. Proper use of composition will even allow you to substitute what kind of wheels your cars have. This can not only simplify your designs but make your code easier to test.
C++ gives you the power to do great things and multiple inheritance is one of the most powerful tools you will have. This does not mean that you should always use it. Use it when it is the right tool for the job just like any other tool. I will show you in this episode how to use multiple inheritance properly.
How do you test changes in a large project? This question was asked during a recent live weekend class by Rushton W. In the class, I was explaining the benefits of compiling and testing changes often and Rushton wanted to know how this worked in a large application like might be found in a major software company.
This is an advanced C++ topic so do not get worried if it is difficult right now. You will rarely need to use private inheritance. And protected inheritance is probably even more rare. Some of my programming books just say that this whole topic is: beyond the scope of this book. I will do my best to explain this concept because that is what this podcast is all about. You get to learn from my experience.