Archive

Posts Tagged ‘BjarneStroustrup’

Two Peas In A Pod

It’s funny how I never know which, if any, of my bogus posts will have the potential to generate an above average number of hits on this blog. The posts that I thought may have triggered a rise above the average daily hit count (approximately 50) never have. The posts that have indeed appreciably crossed the threshold, I never thought would. In four years of blogging, not a single one of my a-priori guesses has come true.

When I stitched together “The Point Of No Return” post, I thought “meh“; it’s just another average, unenlightening BD00 post. However, somehow, somewhere, some kind soul on the blog staff at the official ISO C++ org web site decided otherwise. He/she thought it useful enough to post a link to it right smack on the site’s home page:

BD00 And ISOCPP

W00T! Me and my man Bjarne Stroustrup on the same page – like two peas in a pod. Do ya think Bjarne would appreciate the BD00 connection?

peas in a pod

The dashboard below shows the spike in traffic experienced by BD00’s blog as a result of the generous plug from the blog staff at isocpp.org. I surely hope that the wordpress.com server farm didn’t crash from the sudden surge in traffic!

Nine Hundred Hits

Categories: C++ Tags: , , ,

The Importance Of Locality

Since I love the programming language he created and I’m a fan of his personal philosophy, I’m always on the lookout for interviews of Bjarne Stroustrup. As far as I can tell, the most recent one is captured here:  “An Interview with Bjarne Stroustrup | | InformIT“. Of course, since the new C++11 version of his classic TC++PL book is now available, the interview focuses on the major benefits of the new set of C++11 language features.

TCPPPL4

For your viewing pleasure and retention in my archives, I’ve clipped some juicy tidbits from the interview and placed them here:

Adding move semantics is a game changer for resource (memory, locks, file handles, threads, and sockets) management. It completes what was started with constructor/destructor pairs. The importance of move semantics is that we can basically eliminate complicated and error-prone explicit use of pointers and new/delete in most code.

TC++PL4 is not simply a list of features. I try hard to show how to use the new features in combination. C++11 is a synthesis that supports more elegant and efficient programming styles.

I do not consider it the job of a programming language to be “secure.” Security is a systems property and a language that is – among other things – a systems programming language cannot provide that by itself.

The repeated failures of languages that did promise security (e.g. Java), demonstrates that C++’s more modest promises are reasonable. 
Trying to address security problems by having every programmer in every language insert the right run-times checks in the code is expensive and doomed to failure.

Basically, C is not the best subset of C++ to learn first. The “C first” approach forces students to focus on workarounds to compensate for weaknesses and a basic level of language that is too low for much programming.

Every powerful new feature will be overused until programmers settle on a set of effective techniques and find which uses impede maintenance and performance.

I consider Garbage Collection (GC) the last alternative after cleaner, more general, and better localized alternatives to resource management have been exhausted. GC is fundamentally a global memory management scheme. Clever implementations can compensate, but some of us remember too well when 63 processors of a top-end machine were idle when 1 processor cleaned up the garbage for them all. With clusters, multi-cores, NUMA memories, and multi-level caches, systems are getting more distributed and locality is more important than ever.

Last Resort

Categories: C++11 Tags: , ,

Rule-Based Safety

May 20, 2013 1 comment

In this interesting 2006 slide deck, “C++ in safety-critical applications: the JSF++ coding standard“, Bjarne Stroustrup and Kevin Carroll provide the rationale for selecting C++ as the programming language for the JSF (Joint Strike Fighter) jet project:

First, on the language selection:

  • Did not want to translate OO design into language that does not support OO capabilities“.
  • Prospective engineers expressed very little interest in Ada. Ada tool chains were in decline.
  • C++ satisfied language selection criteria as well as staffing concerns.

They also articulated the design philosophy behind the set of rules as:

  • “Provide “safer” alternatives to known “unsafe” facilities.”
  • “Craft rule-set to specifically address undefined behavior.”
  • “Ban features with behaviors that are not 100% predictable (from a performance perspective).”

Note that because of the last bullet, post-initialization dynamic memory allocation (using new/delete) and exception handling (using throw/try/catch) were verboten.

Interestingly, Bjarne and Kevin also flipped the coin and exposed the weaknesses of language subsetting:

lang subsetting

What they didn’t discuss in the slide deck was whether the strengths of imposing a large coding standard on a development team outweigh the nasty weaknesses above. I suspect it was because the decision to impose a coding standard was already a done deal.

S and W

Much as we don’t want to admit it, it all comes down to economics. How much is the lowering of the risk of loss of life worth? No rule set can ever guarantee 100% safety. Like trying to move from 8 nines of availability to 9 nines, the financial and schedule costs in trying to achieve a Utopian “certainty” of safety start exploding exponentially. To add insult to injury, there is always tremendous business pressure to deliver ASAP and, thus,  unconsciously cut corners like jettisoning corner-case system-level testing and fixing hundreds of  “annoying” rules violations.

Does anyone have any data on whether imposing a strict coding standard actually increases the safety of a system? Better yet, is there any data that indicates imposing a standard actually decreases the safety of a system? I doubt that either of these questions can be answered with any unbiased data. We’ll just continue on auto-believing that the answer to the first question is yes because it’s supposed to be self-evident.

%d bloggers like this: