A recent security bulletin from Microsoft highlights the dangers of certain constructs in C++. These constructs constitute a set of code smells for C++. In this post, I’ll describe what I consider to be C++ code smells and how to deal with them.
The Direct3D API covers quite a bit of ground, particularly if you include D3DX. A question that arises fairly often in discussion forums is “where can I find an example of
xxx?” for some particular API function or method named
The Utah .Net User Group meets the 2nd Thursday of every month at 6:00 PM. Meetings are held at Neumont University in the South Jordan area about 20 minutes from downtown Salt Lake City. If you are traveling on I-15: exit on 106th south, head west, and they are right on the left hand side of the road in the grey 4-story buildings right there on the 3rd floor.
Utah .NET User Group meetings are free and open to everyone. Pizza and soda is usually provided free!
You have a C module containing variables and functions that implement two different responsibilities.
Split the two responsibilities into two modules.
Eugene Druy has written a nice blog post about refactoring template classes to reduce code bloat.
I was a guest instructor at Zhon Johansen’s Test-Driven Development and Refactoring course at the recent Agile Roots Conference in Salt Lake City. Zhon and I did a dry-run rehearsal of this course for the Utah .NET User Group meeting in June. The streaming video for this tutorial is now available.
Build systems are a pain, particularly if you have cross-platform builds to manage. Where I work we support both Mac and PC versions of our products and coordinating the builds is a challenge. I haven’t used Boost.Build myself, but I know that the Boost folks have had to deal with all sorts of platforms and C++ compilers. They use advanced features of the compiler and have had to work around a number of painful situations. If you are investigating a new build system, Boost.Build is worth a look.
Have you ever been tasked with doing classic “Fagan” style code reviews? They’re boring. They’re tedious. They take up lots of time and yield little, if any, results. At a previous employer, we did these kinds of code reviews. It consisted of printing out the source code to be reviewed, one copy per reviewer. Each of us reviewed the code alone, making notes to the printout. Then we’d gather in a conference room and discuss our findings while one person combined all our notes into a list of items to rework. That person would rework the code alone and then report back to the group the results. Whew! This is what the agile development world would call a “high ceremony process”. It has lots of formal steps and the associated paperwork. Is there a better way? In this post, I’ll discuss what we do at my current employer that makes code reviews a fun team activity.
Brad Appleton has posted a great article on technical debt with lots of links to further resources on the subject. If you’re struggling with an aging code base and your managers just don’t understand why you can’t produce features as fast as you used to or at the same quality as before, then direct them to specific resources after reading this blog post. Using ‘debt’ as a metaphor is perfect for the cruft that inevitably finds its way into our code when talking to non-technical types.
Refactor early and often to avoid accumulating technical debt to the point that it cripples you!
You have a boolean variable that represents a negative condition and you want the variable to represent a positive condition.
Replace all assignments to the variable with their logical inverse and replace all uses of the variable with its logical inverse.
In Direct3D 10, a number of device render states were aggregated into immutable objects. These immutable objects simplify state management on the device for the runtime and the driver, making it quicker to switch between state configurations on the device. These immutable state objects are created by filling in a description structure and creating the object. This mechanism is present in Direct3D 10.1 and Direct3D 11 as well. In this post, I will discuss some helper classes for constructing these state objects in a manner that more clearly reveals your intention.
In Direct3D9, direct CPU access to a resource is obtained by obtaining a lock on the resource. Every time you obtain the lock, you must make sure that you release it. In Direct3D10 and Direct3D11, a similar situation is faced with resources, but the terminology has changed to mapping the resource. Using a helper class to handle the lock and unlock operations on a resource helps you create exception safe code in C++.
Over the past few years, I’ve been using a number of refactoring add-ons for Visual Studio. The three refactoring add-ins I have tried are: Refactor! Pro from DevExpress, Visual Assist X from Whole Tomato and ReSharper from JetBrains. In this post, I’ll review and compare these refactoring add-ons.
In Part 2 of this series, I discussed the assertion facilities of Boost.Test and how to get the first passing test on Bob Martin’s Prime Factors Kata. In this part, I will continue with test-driven development to complete the functionality of the
In Part 1 of this series, I discussed how to setup a basic C++ unit test project that executed the unit tests when you built your code. In this part, I will discuss the assertion framework provided by Boost.Test in the context of a simple programming exercise that demonstrates test-driven development.
In this post, I will describe how to start making unit tests in C++ with Boost.Test.