Smart pointers

I’m writing this today because I think it would be easier to type out my thoughts on smart pointers rather than scribbling them down, like I’ve been doing this afternoon.  I’m realizing that on the highest level of writing, I want to code in a way that’s as clear as possible.  I’m sure that you, the reader, also want this. It’s good to code clearly at all levels, but the clarity of code on the level where control is flowing has a good reason for exhibiting its clarity in a distinct way.  The needs and concerns of a user are different from yours, the programmer.

We all understand that a programmer leads a wonderfully blessed and varied life, full of unexpected detours and delights.  However! From our places of privilege we must not forget the lowly plight of the user! While we are shaping a system, they are plodding through the course we provide for them, obediently completing the tasks we don’t care to complete ourselves. But that is what makes those tasks so important! Because all that the user is doing, is what the user is uniquely capable of doing! Think not of the user as a faceless drone, or as a valueless source of revenue, but rather as a human being, with the neural network of a human beings brain at your disposal!

That brain is precious! please don’t corrupt it with trash along the path it walks!  I know you are now looking at me, wondering how i could make a request so outrageous. After all, how are we to regulate the sanitation of an immaterial construction?  Immaterial even to us: We, who have unique powers to grapple with the concrete ethereal.  For the flow of control is shaped specifically from where it is we aren’t coding.  Builders build walls, after all, never homes.  My response, of course, is that the simple fact that only we can understand the hidden beauty in a walls construction shouldn’t deter us from imagining ourselves living within the walls themselves!

Again, how are we to do this? For we build our walls not of stone, but of something far stronger: Syntax.  For us to imagine a space without words after all is to imagine the void. It is to rappel into the inky depths! To this I must respond that the void, unable to be filled with our voices, must be filled with our love.

I’ve entitled this post smart pointers.  I was planning on talking about smart pointers.  But in the time I’ve been writing, I’ve realized that this blog post is about much more than smart pointers.  It’s about promises.  It’s about promises and futures, which is what you should give to a user. I was going to write about how whenever you create some resource to be shown to the user, you should give that resource some kind of smart pointer. There’s no reason, after all, that a user should be able to access it other than through a pointer. But now I realize that trust needs to be built to treat a user with love, and we build trust through promises. I’m hoping that you’re beginning to realize that too.

All of us are growing, and my advice is to only use smart pointers when pointing to an implementation of some class in another translation unit (pImpl idiom). That is a place where it really makes sense to use it, given that it’s a good way of keeping headers separate, and using a smart pointer directly eliminates the need to write a custom destructor.  In fact, I believe that to give a user a pointer would show “unique”-ly bad taste. A bad joke. It is best to avoid evoking our brutal and materialistic world through instruments as crude as direction.

I love you,

Zak O.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s