Hardware Verification with C++: A Practitioner's Handbook

Chapter 13: Coding OOP

Beauty is in the eye of the beholder.

Common paraphrasing of Plato

Coding is a personal endeavor. For many of us it s similar to creating art, and as with any art, there are many styles some loved, others detested. Why is this relevant to coding? Well, because unlike the case with art, our code cannot stand alone. We are in the interesting position of creating art that, by definition, must work in a community.

No engineer intends to create complicated, stand-alone code. This chapter shows techniques, tricks, and idioms that you can use to communicate your intent. When your code is clear and transparent, other engineers can more easily understand, and appreciate, your intent. Code that is appreciated is more likely to be used appropriately, adapted, and, most important, integrated well with the rest of the system.

Overview

This chapter shows some of the coding techniques we can use to create our art. This, the last of the OOP chapters, talks about the coding going on inside a class. Of course, what s going on in a class is related to the class structures and interconnects around the code, so we will not limit our discussions to the lines of code in a method. Rather, we focus in this chapter on coding.

Our first focus is on if tests, with a discussion on why this necessary coding construct complicates the code. We ll show some ways to minimize these if tests.

We then discuss ways to get your point across, using coding tricks...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Bar Code Cards
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.