TrueJournals

Tag: letlanguageworkforyou

Let the Language Work for You – Part 1: C++ Destructors

by on Oct.10, 2013, under programming

I recently came across a programming design pattern I hadn’t thought of, and that inspired me to write at least one blog post.  So, I introduce this post which may or may not start a series of posts, entitled “Letting the Language Work for You”.

The idea behind this series is this: programming languages have become very advanced, possibly more than most people realize.  There are many things you may be doing now in your programs that are simply extra work that you don’t really need to do.  Instead, you should let the language do the work for you.  These posts will (hopefully) help you take full advantage of your programming language to avoid extra work, and hopefully keep out some bugs.

For part 1, let’s look at destructors in C++.  Before we get started, I’ll note that this post is very much inspired by Boost’s ScopedLock pattern.  If you know where this is headed just by reading that, I’ll understand if you decide you don’t need to read what I have to say.  Otherwise, if you use an object oriented language, I’d encourage you to keep going.

(continue reading…)

Leave a Comment :, , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...