Practice 5. Nightly BuildsIn order for your team to ensure that your software is working, it should be completely rebuilt from scratch one or more times per day. The build should include as many automated tests as possible to catch integration problems early, and the result of the build should be an installable product image. Nighttime is a good time to do this because no one is working on the code, and there are plenty of idle computers available. However, if you can do it, there is a lot of benefit to building the product as many times per day as possible. If the build or tests fail, fix the problems first thing in the morning and don't let anyone integrate any additional work until after the build succeeds again, otherwise there is a risk of multiple bad changes accumulating that will jeopardize the quality of the product.
Pay Attention to Build TimesYou should always keep an eye on the product build times. The faster you can keep the build, the faster the feedback you'll get when you need to quickly generate a cut of the product. Long build times encourage developers to take potentially dangerous shortcuts and also to pay less attention to keeping the problem under control. Long build times are almost always an indicator that something is wrong with the structure of the product: too many interdependencies between modules, not enough modules, or worst of all, duplicated or unnecessary code. In languages like C or C++ there might also be "include file" bloat, with include files making unnecessary #include statements or declaring inline functions that should be moved to the .cpp file. Here's an example of the most common problem: // File: A.h // This class contains a member variable that is a pointer to an // instance of another class. // #include "B.h" class A { ... protected: class B *m_Bptr; ... } The problem with this seemingly innocent class is the #include of "B.h," which is the file that declares "class B." If this file that declares "class A" (A.h) is included in many places in your product, build time will suffer because the preprocessor is going to spend a great deal of time processing A.h AND B.h, when in fact B.h is not necessary because a forward declaration can be used in A.h and an include of B.h only added to the .cpp files that actually need to use "m_Bptr": // File: A.h // This class contains a member variable that is a pointer // to an instance of another class. // class B; // All class A needs is a forward declaration of // class B. class A { ... protected: class B *m_Bptr; ... } Tip: Timestamp the start and end of all builds A good practice to follow is to timestamp the start and end of all complete builds and keep a log. Then, write a simple script to catch large increases in build time. If possible, produce a simple chart that can then be put on a web page and quickly viewed. It's always easier to glance at a chart than to dig through a log file!
|