Software! Math! Data! The blog of R. Sean Bowman
The blog of R. Sean Bowman

Posts with tag “C++”

June 04 2016

Resource “ownership” in software is tricky. Poorly thought out ownership can lead to issues with memory management, lifetime management, and other problems that make you want to bang your head on the desk. In a language like C or C++, you were traditionally on our own, responsible for keeping track of ownership and lifetimes without help from the compiler or language itself. But these days, things are changing for the better.

Read more...

April 02 2016

This post my self-flagellation for spending quite a bit of time tracking down a problem with some code I was writing. The error was tricky, but I should have known better, and afterward I made the connection with some other tricky bits I knew about in different languages. Let’s look at the problem, which involves environments and closures (and probably other stuff, too!)

Read more...

March 04 2016

The C++ standard says that vector::push_back should run in amortized constant time. With a simple implementation where the vector is stored as an array which doubles in size when needed and each element is copied on every doubling, does this satisfy the time complexity requirement?

Read more...

January 14 2016

In the last post we learned about the bridge pattern and its pedigree from the envelope/letter pattern of Coplien (and probably other sources, I’m just not an expert enough to know about them all!) Now let’s compare it to some other patterns and examine the differences and similarities. It often turns out that the rationale behind implementing some pattern is crucial, even when the different patterns themselves might look substantially the same in code.

Read more...

November 21 2015

Unless you’ve been living under a rock, you know how important and influential the GoF Design Patterns book book has been. If you have been living among the rocks, do yourself a favor and get a copy of the book. It’s considered prerequisite reading for software developers these days. Interviewers love to hear you mention one or two of these patterns by name (in the appropriate context, of course), and just thinking about design in this way will make you a better programmer.

Read more...

November 08 2015

Software design patterns have gone from something of a phenomenon to requisite knowledge for any competent programmer. Their history is fascinating, though, and rooted in abstractions people noticed after writing and looking at lots and lots of code. Smart people figured out common elements, and then were able to describe them eloquently to the rest of us. Let’s have a look at a few important patterns, including some history.

Read more...