Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!cwjcc!hal!nic.MR.NET!xanth!mcnc!thorin!coggins!coggins From: coggins@coggins.cs.unc.edu (Dr. James Coggins) Newsgroups: comp.lang.c++ Subject: Managing C++ Libraries: Problems Defined Message-ID: <4959@thorin.cs.unc.edu> Date: 31 Oct 88 19:34:42 GMT Sender: news@thorin.cs.unc.edu Lines: 68 At the Denver C++ Conference I presented some practical tips and organizational strategies for managing C++ libraries, including a strategy for keeping track of .h files with minimal programmer effort. This was the most enthusiastically received presentation I have ever given (thanks folks!). About 100 copies of the transparencies I used were made available at the conference (thanks to Austin Andres of U.S. West-Denver for making them), and they disappeared rapidly. Since there appears to be demand for practical tips and techniques of this sort, graduate student Greg Bollella and I will post to this newsgroup over the next few days a series of articles describing how we have organized and optimized my C++ library. (My library includes classes for 3-D computer graphics and image pattern recognition to support my research, but is of interest here only in that it is large - about 60 classes, with lots of dependencies, requiring solutions to library management problems.) We welcome comments by e-mail; if questions of general interest are raised we'll extend our series of articles to address them. E-mail to coggins@cs.unc.edu or uunet!mcnc!unc!coggins. We hope you find these suggestions useful; if you can improve on them, even better! ------------------------------------------------------------------------ Managing C++ Libraries Part 1: Problems in Library Management Libraries of C++ classes help users to exploit predefined encapsulations, so they are essential to achieving the goals of code reuse prominent as a justification for object-oriented design. We have encountered and solved several problems in using and managing a large and complex C++ class library. Since other C++ users are encountering similar difficulties, we will describe our solutions in a series of articles in this news group. This article is an introduction to briefly describe the problems we have encountered. Our solutions will be described in later postings. A problem we have encountered with AT&T cfront 1.2.1 is the production of excessively large executable files. This problem was solved, in part, by the use of CC command options that are documented in the cfront release notes. That documentation describes what the options do but not how to use them. We will describe how we use these options to obtain an order-of-magnitude decrease in the size of our library's .a file. (see Managing C++ Libraries: Using +e0 and +e1) An appropriate arrangement of subdirectories for a library can simplify the management of the library by its developers and understanding of the library by its users. We will describe our scheme for organizing the code of a library into subdirectories. Another issue in library management is whether to store member functions in separate .c files or to keep all member functions for a class in a single .c file. We will describe the tradeoffs we have discovered between these organizational strategies. (see Managing C++ Libraries: Subdirectories and .c Files) The management of dependencies and header files in a C++ library is an essential problem that, for many potential C++ developers, seriously limits the usefulness of the language. We have developed a scheme that ensures efficient inclusion of required header files while requiring minimal effort from the application developer. This scheme is not difficult to use, but it is rather intricate and takes some effort to establish. Once in place, however, maintenance and use of the library are greatly simplified. We will describe this organizational scheme in a later article. (see Managing C++ Libraries: Dependencies and Headers)