Home > Articles > Programming > C/C++

Going Large-Scale with C++, Part 1: Successful Small Projects Will Often Grow

  • Print
  • + Share This
A single-purpose application with efficient, error-free code is a beautiful dream. In the real world, however, software is typically created by groups working with nearly impossible challenges against tight deadlines. Must successful small programs inevitably become unwieldy behemoths? In this two-part series, John Lakos, author of Large-Scale C++ LiveLessons (Workshop): Applied Hierarchical Reuse Using Bloomberg's Foundation Libraries, explains why large development efforts are fundamentally different from small ones, and explores methodologies for meeting this scalability challenge.

Read Part 2.

Like this article? We recommend

Introduction

Developing software on any scale can be challenging, but developing software on a large scale is qualitatively different. As in the construction industry, many processes and techniques work handily for a small team creating a simple product (such as a single-family home or a single-purpose app) over a few months' time. The same processes and techniques would fall short if applied to substantially larger development efforts (like a fifty-story skyscraper or complex organization-wide software).

Software development of any kind requires intelligence. Successful large-scale software development, however, also demands engineering and discipline. Unlike the creation of small ad hoc programs, large-scale software development is an engineering discipline unto itself—independent of the subject domains to which it is applied.

Large-scale projects often encompass a variety of dimensions, including

  • Size and scope of the code base
  • Time horizon
  • Development team
  • Client requirements

This two-part series explores how the essential nature of successful software development changes as we progress toward larger, longer-term, and more widely distributed development efforts. This article examines how small software projects can take advantage of large-scale methodologies to produce better individual results today, as well as preparing for the prodigious growth that many successful software products experience. Part 2 of this series examines how scale affects the individual (application) programs, the hierarchically reusable libraries, and the ultimate service-oriented systems that result from using these techniques.

Separate Physical Components

A very small development effort that results in a single executable program is a pure application of both the language and whatever libraries are available. Development of such software typically addresses a current need, without regard for the needs of other programs, and (perhaps) even potential changes to that same program in the future.

When the amount of application software we need to develop exceeds what will reasonably fit within a single file that also holds main, we are no longer solving only the domain-specific problem we initially set out to address, but are now also obliged to structure that solution physically in a way that makes the code easy to understand, test, and maintain. That is, we must consider how to partition our logical application code into separate physical units. We refer to these fundamental physical units as components, which, in C++, take the form of .h/.cpp pairs.

In all programming languages, components satisfy certain critical properties that avoid established physical design flaws:

  • Cyclic (physical) dependencies among components
  • Private access across component boundaries (such as long-distance "friendship" in C++)

Intra-Application Reuse

Once a body of software exceeds what will reasonably fit within a single directory or Unit of Release (UOR), we must decide what aspects to keep close to the application main (and leave malleable) and what we will segregate physically into separate library UORs (and keep stable).

At this juncture we leave the realm of pure domain-specific problem solving and confront the discipline of software engineering full on. Writing stable software is inherently more costly in the short term, but it can pay dividends, through reuse, in the form of reduced code size and improved maintainability. After determining what functionality we can make stable, we must decide how to factor and package it into discrete UORs. During development, these UORs can be used independently when unit-testing disparate parts of the application.

Multiple Development Groups

Intensifying development effort over a fixed period of time necessarily requires more developers—each with his or her own view on how software should be written and packaged. (Remember that your existing development staff will also have to hire additional competent software engineers and then train them in the established software-development methodology.)

A handful of programmers collaborating on a single application could probably produce something viable through ad hoc methods. When the number of people working on a project exceeds that threshold, an informal approach becomes increasingly less likely to produce acceptable results. A small, locally situated development team might take simple design interactions for granted, but that advantage will evaporate if teams are dispersed geographically—especially across disparate time zones.

When working separately, no group should "fiddle" with foundational code in a way that breaks assumptions made by other groups. For example, one development team's modifying the program-wide "locale" could potentially break code that is not prepared to handle a character other than a period (.) as the decimal sign. The need for additional levels of management, including project managers, soon becomes inevitable.

Source Control/Versioning

Even the smallest project can benefit from a source-code control system, but source control is indispensable when a project is expected to grow to more than one developer or a few file directories. A source control system must be able to diagnose conflicting changes or regressions; coordinate contributions from multiple developers; and facilitate, across its internally maintained branches, the separation of production code from new-feature development.

Effective Build Systems

A small project might be built with a single command-line invocation of the compiler, whereas a large project with multiple UORs requires a more sophisticated build system. At minimum, a set of hierarchical makefiles would be needed to build the entire system out of its sub-parts. Many projects benefit from a tool (such as Waf) that understands the dependencies among components, along with those of physical aggregates such as packages and package groups. Such tools can automatically build and install libraries and header files for multiple/different target platforms.

Other Useful Support Tools

Several commonly available development tools become increasingly enticing as project and team sizes expand. For example, code-review tools (such as Phabricator) allow geographically dispersed teams to perform code reviews without needing to meet in a single room or even at the same time. Tools that maintain a database of every use of each class, function, or variable can provide an invaluable service for refactoring a code base, helping to mitigate cries of "We did it wrong two years ago and now we can't ever fix it." Some of these support tools are part of IDEs or are available as plug-ins, making the tools easier to use in projects based on those IDEs.

Coherent, Nominally Cohesive Packaging

With increasing numbers of cooperating developers, it becomes important to establish a coherent, nominally cohesive, uniform logical and physical structure for the software under development:

  • Coherent: The definition of the logical content that performs some subset of functionality resides in a well-defined, contiguous sub-region of the physical architecture (while still permitting dependencies on more general, lower-level components).
  • Nominally cohesive: Just by looking at how the software is used in a program, we can identify its location (definition, documentation, and tests) in the enterprise-wide physical hierarchy. In C++, we can employ the namespace construct to achieve both nominal cohesion and unique naming, so long as we avoid using directives and declarations.

Admitting Third-Party and Open-Source Libraries

The internally consistent structure I have described may well differ from that of software developed elsewhere. However, given the vast quantities of third-party and open-source libraries available today, this homogeneous structure must accommodate the use of such foreign software. The industry has standardized on a small number of systems and platforms for storing open-source software, and for packaging programs and libraries for installation. For open-source software distributions to be well received—internally and externally—they must fit smoothly into this ecosystem.

Terse, Unique, and Distributed Names

One simple way to encourage retaining namespaces for qualification purposes only is to limit such use to a single level and keep the names blissfully short (for example, std). For this approach to work, the enterprise (as a whole) has to make some very deliberate decisions, such as requiring every component to belong to exactly one package, and qualify all architecturally significant names—logical and physical—by a unique package name. Packages can be assembled into groups that share the same envelope of physical dependencies on other UORs.

A centralized registrar could dispense very short package-group names of uniform length (perhaps three characters, such as bdl for "BDE Development Library"). This design allows for the decentralized minting of short enterprise-wide unique package names (e.g., 4–6 characters, such as bdlma for "BDE Development Library Memory Allocators"). These short (package) names contain and display the (even shorter) package-group name prefix, bdl, without necessitating any further global interaction or superfluous syntax.

Conclusion

The takeaway message here is that large development efforts are fundamentally different from small ones, and lessons learned in larger efforts inform smaller ones, but not vice versa. Successful small efforts almost inevitably become larger. When working on tiny projects, employ the same techniques you would use on larger projects that naturally scale.

Use a consistent scalable methodology across all projects in your enterprise. This practice ensures that successful projects can grow, and facilitates developer mobility away from less successful ones. Always think big, and plan for the long term up front (or at least repair any "cut corners" immediately after meeting a critical short-term deadline) in order to avoid immensely debilitating long-term technical debt.

Part 2 of this series explores additional opportunities for improving our effectiveness as software development efforts continue to grow. In particular, we'll see how, by keeping our individual components small and focused, and adhering to a small set of canonical class categories, we can realize truly profound efficiencies through hierarchical reuse.

  • + Share This
  • 🔖 Save To Your Account

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020