23.12. Portable classes

When you develop a general-purpose class like cRandomizer, cVector, cRealBox, cRealPixelConverter, or cMemoryDC, it’s a good idea to try and keep the class as portable as possible. By ‘portable,’ we mean not having many dependencies upon other classes. A class that you develop as a programmer is like a tool that you build to help yourself do things. If you plan to keep programming for a number of years, you don’t want to have to redesign your tools any more often than necessary. And, after all, C++ is a language meant to run on all kinds of machines, from Windows to Mac to Linux, so it would be nice to be able to take your tools with you if you happen to migrate.

One way to judge how independent a class is by looking ...

Get Software Engineering and Computer Games now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.