Your thoughts on "Large Scale C++ Software Design" [closed]
Asked Answered
L

9

49

Reading the reviews at Amazon and ACCU suggests that John Lakos' book, Large-Scale C++ Software Design may be the Rosetta Stone for modularization.

At the same time, the book seems to be really rare: not many have ever read it, and no pirate electronic copies are floating around.

So, what do you think?

Latitudinarian answered 7/12, 2009 at 15:45 Comment(6)
Havn't read it, so I'll only comment.. but lots of us look at our projects and probably consider them "small-scale" rather than "large scale". People don't start thinking large scale until you hit something like a Firefox, Windows NT, or Linux Kernel.Chloromycetin
... and that's indeed the scale at which you should be reading Lakos. His large scale isn't todays large scale, thanks to Moore.Perpetua
CAD software often runs into millions of lines. While a large deskdop application like Excel is just as complex (if not more so) I don't think it's fair to belittle the scale of the code bases. His introduction mentions software with thousands of staff-years worth of development effort. The biggest system I ever worked on went into hundreds and was (at the time) the largest J2EE application that had been built in Australasia. Lakos was working on systems an order of magnitude bigger than that.Allard
@George Stocker: Thanks for editing (esp. for the Rosetta Stone metaphor).Latitudinarian
@George Stocker: hope the question's end does not read as "...So, where the *ell are the pirate electronic copies?" :)))Latitudinarian
What, closed again? Well, I guess just in time, lads -- it's time to open another one on Lakos' second edition of his book (and the first one is on my bookshelf now), so thanks, everyone!Latitudinarian
H
43

I've read it, and consider it a very useful book on some practical issues with large C++ projects. If you have already read a lot about C++, and know a bit about physical design and its implications, you may not find that much which is terribly "new" in this book.

On the other hand, if your build takes 4 hours, and you don't know how to whittle it down, get a copy, read it, and take it all in.

You'll start writing physically better code quite quickly.

[Edit] If you want to start somewhere, and can't immediately get a hold of the book, I found the Games From Within series on physical structure useful even after reading Large Scale C++ design.

Hedgepeth answered 7/12, 2009 at 15:45 Comment(0)
L
19

Interestingly, "More C++ Gems" contains a shortened (to 88(!) pages) version of Lakos' book, which can also be browsed (fully, I believe, as it belongs to the first half of the book) online at Google books.

So, enjoy everyone interested:)

Latitudinarian answered 7/12, 2009 at 15:45 Comment(0)
A
17

Lakos used to work for Mentor Graphics, who makes EDA software. He was involved in building EDA software in C++, where they wanted to use C++ efficiently ('no more than 5% overhead over C code') and sort out how to build software on early workstations that really would take a long time to compile a large C++ application.

The book is quite a good read - it discusses a wide variety of topics, and Lakos really did know his stuff. He really comes from a background of having to get efficient code out of a C++ compiler, as well as how to set up a C++ program so it is maintainable and compiles and links reasonably quickly.

I think that Lakos has a lot of insight, and I would recommend that you read it. However, it is 'trad' C++ from a time before features like templates were widely available. My copy is not for sale ;^)

Allard answered 7/12, 2009 at 15:45 Comment(3)
@"My copy is not for sale" I knew it! :)Latitudinarian
C++ is no longer flavour of the month so you can probably get a secondhand copy quite cheaply. Amazon Marketplace is your friend ;^)Allard
Here's some insider EDA opinion on Mentor's Falcon chipdesignmag.com/payne/2009/11/17/…Vagal
A
12

I thought the book was a good read back in the late 1990s. It was out of date back then, now about as relevant as telephone book from the 1950s.

I worked with Lakos for several years where he tried to implement these ideas. I also had my modern C++ project I built of about 2000 source files-- large scale enough, and I've built a few more since. Build times are easily reduced by parallel distributed builds, using programs like icecream. Every complier will cache opened headers-- only by doing something really outrageous any modern build tool like scons will scale to thousands of translation units without doing anything really special, with build times, including tests, takes a couple minutes from clean.

Limiting your libraries interface to a few "vocabulary types" (not the same sence as the OO concept, he means just use Int, float, string, char, and a couple of other I don't recall) is extremely poor advice to scale anything. Your build is going to be looking for a type mismatch, you don't want this at runtime just to make it easier to write a make file.

And that's largely the gist of the book-- how do I write C++ in order that it works with tools from 1993? Additionally, the Mentor Graphic project the book describes was a disaster from all accounts. Even the book itself alludes to that.

Large Scale C++ is delivered in source code form-- these are the "physical dependencies," not link libraries (and the book never mentions other more important dependencies like databases, sockets, processor architecture, etc.).

The book is full of ideas that sound good, but there are much better ways to scale up in practice. If you want to study large C++ libraries, take a look at Boost or Xerces and see what they did. They really are implementing large projects, not writing about them.

Anatomize answered 7/12, 2009 at 15:45 Comment(3)
Thank you very much for this insight (sometimes the stories of failing ideas have more value to them than anything else -- at least when the ideas themselves have definite merit; funnily this resembles me of the story David Parnas tells in his books about that avionics software he and his team were once trying to apply his ideas to -- as it was effectively a failure, which nonetheless deserved its honorable place in the textbooks) :)Latitudinarian
But (informit.com/articles/article.aspx?p=2088514): Large-Scale C++, Volume I: Process and Architecture by John Lakos (2014) ISBN-13: 9780201717068 So the new book was not a rumor :)Latitudinarian
I recall reading drafts of that book 10 years ago. If you read the BDE standards document on github, you'll still find redundant include guards, the notion that a "component" Is really just a .h/.cpp pair of files. And a LOT of verbiage about indentation and formatting of documentation. What I expect will be missing from the book, are two critical items in scaling software: deployment and integration testing..Anatomize
A
5

It's a little out of date (in fact it was out of date when it was written). If I recall correctly, a lot of it was about reducing dependencies which you would probably do now with templates.

Although that's probably one of the lessons to learn on large scale projects, you aren't usually using cutting-edge features and tools.

Apotropaic answered 7/12, 2009 at 15:45 Comment(1)
If there's one thing I would NOT do it's using templates to bring my physical dependencies down, or hoping that it would reduce build time. You really do not want heavy template use in large projects with current compilers - they slow things down a lot because every usage needs access to the full template. The pimpl idiom on the other hand is something that I believe should be used heavily in large-scale projects.Gav
Q
4

It is an excellent book and an important one from a historical point of view.

Note that to implement the practices described in the book, you need considerable discipline and agreement within the team. Here are a few things to note:

  1. Lakos has precise definitions for what he calls "components" and "packages". These are key for large scale design. However, they require adherence to conventions for how source and header files are named and the sequence in which they are included. It is a shame that most people (including those who quote Lakos) rarely follow these conventions.

  2. The book is all about C++ but the concepts are more widely applicable. However, because C++ is such a complex language, a large part of the book is teaching you how to use C++ effectively. If you can get past that, you can actually find it useful even if you use other languages.

  3. Some of the prescriptions such as on the use of "name spaces" maybe considered controversial now. Many believe that name spaces should be used in a limited way in C++.

Quade answered 7/12, 2009 at 15:45 Comment(0)
C
4

Is “Large-Scale C++ Software Design” by John Lakos a mind-provoking (but usually overlooked) gem?

Yes.

Cynthiacynthie answered 7/12, 2009 at 15:45 Comment(1)
Haven't they also got there an article on leading answers?:)Latitudinarian
S
4

Yes, in some ways, the book is a little dated and some of it is C++ specific. Nonetheless, it offers a lot of useful advice about dealing with complexity and coupling in large programs, and most of his advice applies to any object-oriented language. I also found it very readable.

If you can track down a copy, I'm sure you'll find it worth reading. It's in my top ten list of programming books.

Supination answered 7/12, 2009 at 15:45 Comment(0)
B
3

I read it a long time ago, but I remember getting quite a lot from it; though as MadKeithV points out, that may just have been that I knew less then ;)

Certainly from a "how do I reduce how long this takes to build" perspective it's has lots of useful stuff, especially around reducing compile time dependencies, though possibly some of it is no longer relevant, or even possible, given how much templates are used these days.

And no, you can't have my copy either :)

Blume answered 7/12, 2009 at 15:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.