So what can you expect here? In a word, code
. Lots of code! Why? A couple of reasons:
- I am a very visual person, I learned (and continue to learn) through example. When I see results I want to know how we got there. Understanding results is a small part of a long and convoluted battle in converting and handling data. My personal interest lies in that conversion.
Most of us may know of an interesting quote,
“Show me your flowchart and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won’t usually need your flowchart; it’ll be obvious.” – Fred Brooks, The Mythical Man-Month
A very similar quote was derived from this,
“Show me your code and conceal your data structures, and I shall continue to be mystified. Show me your data structures, and I won’t usually need your code; it’ll be obvious.”
- Eric S. Raymond, The Cathedral and The Bazaar
While I don’t necessarily disagree with latter quote, I don’t identify with it. Code, to me, is important. What’s more, good code is essential for the longevity of any project/product.
There’s one more aspect of the type of code I, personally, enjoy. I like using code that has a good and intuitive interface. If a library, for example, has a good interface you almost don’t find yourself going to the documentation to discover it’s secrets. The C++ standard library is a good example of code that is very self documenting. Most Windows API calls are an example a library that isn’t very self documenting. Just for kicks, let’s quickly take a look:
Example of the Windows Thread API:
And here’s how to use it:
So… this is… not pretty. In my personal opinion. Perhaps it’s not fair for me to pick on Win API because, after all, it’s old. Really old. In fact CreateThread
is still supported as far back as Windows XP. That makes this API at least 15 years old. Be that as it may, libraries like this exist, and are still being developed. C++ can do better!
So let’s do better. Here’s std::thread
:
And here’s how to use it:
It’s obvious to see why it might be preferable to use std::thread
over the direct CreateThread
. Abstracting complexity from the developer allows them to focus their efforts on a projects functionality over ramping up to the level of understanding required to use direct Win API calls.
This is what I like to do. Abstract. Efficiently. And sometimes make some fun things along the way.