The meaning of Numbers, Bitwise, and Everything… to do with Color

I dug this article that I wrote a long time ago out of the trash.  I hate reading my own writing, even more so if it’s old.  So considering how old this one is, it was pretty painful.  So I edited it to the point of rewrite.  I’m certainly not suggesting I am now a masterful spinner of lyrical prose, just by comparison I think I am now less worse. ;)

So this article is really meant as an introductory to both ARGB color representation and bitwise operators.  Although as I tend to tangent my way across multiple topics, it’s also an explanation of numbering systems.  If you are used to seeing RGB instead of ARGB and wondering what the A is for, it is the alpha channel.  The title is also a bit of an exaggeration, there is plenty more to write about colors and their theory. Continue reading

Class Design

“The single most important reason to create a class is to reduce a programs complexity.”
Steve McConnell – Code Complete 2

“Always write code like the person who will maintain it is a serial killer and knows where you live”
Unknown

I’m going to assume you know what a class is and how to write one, so if this is not true, I suggest you look that up before reading this article.

So why or when should we create a class?  This is one of those great theoretical questions, but has many real world consequences.  There are many specific reasons to create a class.  McConnell goes into detail identifying many reasons and elaborating on them.  Since I have no desire to transcribe his wonderful book or write a book length article, I’ll point you in his direction after you’ve read this more entry point article.

For a lot of beginning programmers, classes are seen as real world objects.  A button, a menu, or a gallery.  While these are valid to be represented in their own classes, it isn’t the right reason to have put them in a class.  For me a class is everything needed to contain a single responsibility.  So while managing the display and control of a menu is a responsibility, so is parsing an xml file or grouping and representing the data that constitutes an employee.  So creating classes strictly to represent real world objects doesn’t go nearly far enough. Continue reading

Vectors – Part 1

Vectors are a mathematical construct to represent direction and length (magnitude is the actual term).  They are absolutely important for doing any kind of mathematical movement, so don’t be surprised to find them in every aspect of physics.  I’ve read many articles about vectors which largely did more to confuse me with esoteric language and convoluted examples than teach me about this very simple and incredibly powerful mathematical tool.  So this is my motivation for writing this article.  If I’m successful, by the time you finish reading this, you too will find this topic simple.  I’ll also be dropping little bits of other topics along the way to show where you can go from here.  Continue reading