JavaScript: Flipping 9 Pages of 25 Icons in Groups of 5

I tried to make the title relevant to the general JavaScript programmer, but this is something that I recently had to do for RocketTux, so that will be the context of the post. But, what the heck does that title even mean? Well, have a look at this picture…

As you can see, I have highlighted 5 rows of 5 icons. Those are the 25 icons I needed to manage, conveniently stored in a PhaserJS sprite group so I can easily show/hide them with a single groupName.visible = true/false; and so on. Putting the icons into a single group is WAY easier to manage than declaring each icon as its own sprite, provided one can wrangle the logic involved. Let me tell ya, in this case, wranglin’ these bits was like wrestlin’ an angry bull in a well greased pan! In fact, I found it immensely helpful to break out the o’l pencil and lined paper to sort it all out!

The window is always on the screen, just hidden until the user clicks the button to “open” the window. This allows the initial sprites to be reused by positioning them one time and later simply flipping the “tile” they point to on the sprite sheet. So, when the user clicks the Next or Back buttons, the logic only needs to pull data from tables (arrays) and update some variables. In this case, here is the table of data for what icons are used per group of five icons,

You may notice that there are 45 groups of 4 numbers. That’s because the cost for these 45 different “Cubimals” always involves a certain amount of coins and then various values of 4 other items. That being the case, I don’t need to worry about changing the first icon in each row, so why bother wasting data by having an entry for it in the icon table.

Finally, to fit all 45 of the Cubimals on the screen, I needed to divide them into 9 “pages” that the user can flip through. What the user sees as “pages” are in reality a bunch of mental gymnastics that happen in the background, as you can see in the function below that fills in the data when the window is opened and the back/next buttons are pressed.

By a country mile, the hardest part of writing this function was the management of the //Cost Icons, which are the subject of this blog post. Having a look at how this part of the function works, it basically goes through each of the 25 icons and updates them, with the exception of the ones for the coins in positions 0, 5, 10, 15, and 20. It pulls the correct group icons per Cubimal based on the cubPos in RocketTux.cubCostIcons[cubPos][mod – 1] and individual icons based on mod – 1.

That’s all fine and dandy, but there are some “gotcha ya!”s in there, such as dealing with the fact that we need the 0 position in the RocketTux.cubCostIcons table as well as the rest of the positions. This meant that I couldn’t just do currentPage * cubPos, because the currentPage also starts at 0 – doing this would fill every Cubimal’s item icons on the first page with the ones from the first entry in the RocketTux.cubCostIcons table. That’s no good! Starting currentPage at 1 would complicate the matter of pulling data from the description and quantity tables, while also overshooting the RocketTux.cubCostIcons table length by 1, so I had to work with it as starting from 0.

To fix that problem, outside of the loop I had to put a condition “if the current page is 0, then cubPos should also be 0, otherwise cubPos should be currentPage * 5”, as you can see in the highlighted area below,

With that wrinkle ironed out, the for loop will pull and place the data correctly!

This is the kind of thing that probably seems very simple many programmers, but can trip up we hobbyists. It’s also the type of problem that is hard to find examples for, because it’s woefully difficult to describe and thus equally difficult to search for on the web. Hopefully this post will serve as at least one way a person can do this kind of thing!

Importantly, when you look at the code you can see that the functionality to which I am referring is written in plain JavaScript (as apposed to PhaserJS or another API/Framework), as it’s really just a matter of manipulating tabular data. This means the concepts are applicable to a general audience, which is nice.

Anyway, hope this was helpful!

Ps. Cubimals were part of a game called Glitch, created by Tiny Speck. When they shut down the game, Tiny Speck was kind enough to release all the artwork for the game into the public domain!

Computer Science is for Crazy People

I’m a firm believer that it’s the computers, not the human beings, that should be doing the computing. However, due to the very nature of computers themselves, that’s often not the case. So when I say that I enjoy programming, this is what I mean…

I grew up with Lego and Meccano sets. When I was an older child, my father taught me how to repair small appliances, like vacuums and toasters. Later I learned electrical theory and about electronics. Over the years I’ve noticed that all of these activities have something in common that appears to be unappreciated: They’re all based upon derivations of the natural laws of the universe!

Lego and Meccano sets are derivations of the physical world, which is quite accurately explained mathematically by Newton’s laws and other related observations that have helped humanity build most of the world around us. Both systems allow the user to combine components that have known functionality to create a larger system, component, or object that has functionality beyond the sum of its parts. In other words, while the plastic parts of Lego are clearly different than the metal bolts and plates of Meccano sets, both sets allow people to use their imaginations to build stuff using a set of well defined parts. Importantly though, all of these parts are based on the natural laws of physics that have been discovered, therefore the way the parts work “makes sense” and can be readily understood by most people.

“Things that go up, fall down! Well, unless they go up too fast and too far… then ya ain’t never getting that shit back!” – Fig Newton

Electricity and electronic components are essentially the same in this regard; All electronic components are based off the fundamental laws of physics and as a result, on some level they’re all forced to “make sense”. Sure, the theory and math is more complicated than Newtonian physics, but none of it is subject to interpretation or imagination, therefore anyone can understand it if given lessons that build upon themselves. Starting with, “What is an electron” all the way up to, “This is how you build an op-amp”, a person can learn the fundamental rules of electronics and how to apply those rules to achieve their goals.

None of this is true when it comes to Computer Science.

The work achieved by computer software and hardware is, at the lowest level, based upon the “on” or “off” state of an array of electrical switches (called transistors). Imagine an infinite wall of electrical switches. Now imagine that you have the complete freedom to organize those switches in any way you could possibly desire, with the results being anything you could possibly imagine. That, in a nut shell, is Computer Science.

The whole of computer software (and much of computer hardware) is an imaginary construct derived from many human minds, not from any law of nature. Consequently, computer software and hardware has been dramatically influenced by hubris and insanity, both of which have, at times, masqueraded as genius. Since even before the invention of the transistor in 1948, many people have made a name for themselves by inflicting the greatness of their intellect upon the world of Computer Science. Absolutely there have been thousands of amazing people who have created wonderful computer concepts, but the bottom line here is this: The human mind is as malleable and flawed as the behaviours of humans themselves, therefore anything a human creates on a computer will also be subject to those conditions. It’s only in the real world where imagination must comply with the limitations of the universe itself.

Building a system, device, or component out of nothing but on/off switches is an immensely complex task that really is beyond almost every human being ever born. This is why we have so many computer programming languages that simplify the process by moving the programmer many levels away from the on/off switches that ultimately do the work. And this is largely where the hubris and insanity that I mentioned earlier comes into play: many computer science concepts exist only because someone at some point wanted to pat them self on the back for being so clever! And other concepts exist only because they made sense in the mind of their creator, who objectively had a mind like no one else has and no one else ever will. The end result of this unfolding of history is that Computer Science is now the study of, and further creation of, a collection of systems and concepts that have no basis in reality and that are often poorly documented and difficult to operate, even when they are well documented.

If a person builds a car and the car does not work properly, at least they have the laws of physics on their side – eventually the problem can be solved, because the answer DOES exist. With Computer Science, that’s just not the case, because all of it is completely arbitrary. One could fight for days, if not months, trying to solve a bug in a piece of software, only to find that there there is some underlying issue with the hardware that just does not jibe with the software and no amount of poking at it will ever actually fix the problem.

So, Computer Science is for crazy people, for folks who don’t have a problem with stuff not making sense simply because some person 40 years ago thought of something and now that’s “just how it is, man!”. Good for those wacky individuals. Let them have their cake and eat it too!

Where “CompSci” benefits us all is, as you are probably aware, in the USE of computers. For instance, it would cost me a small fortune to build my own R2-D2 robot, but I could open up Blender on my computer and build a fully functional model of Artoo for only the cost my time and electricity. Similarly, one could spend $50 on Minecraft and get an unlimited supply of Lego-like functionality, which is considerably more than what they would have gotten had they spent the same dollar value on Lego pieces. Of course, this truly wonderful world we now live in would not have been possible had many intelligent people not put the time and effort into creating the imaginary construct that is Computer Science.

I think at this point it is important for me to emphasise that logical programming and content creation using a computer is awesome for almost any human being. The world is a better place thanks to what we can do using computers.

However, despite how much it has changed the world for the better, the “CompSci” that lurks beneath those layers of simplicity and usability are, in some ways obnoxious, inane, and down-right insane for all the wrong reasons. I feel like I should be able to instruct the computer do my bidding and it should find the most efficient way to utilize its hardware and software to achieve my goals – That’s the difference between “Programming” (or “Coding” as the kids say) and “Computer Science”!

Unfortunately, much of the time that’s just not how it works. Often when I am programming I’m forced into spastic routines of ridiculous mental gymnastics that piss me off and waste my time, simply because the people who created the software/hardware/language/etc (all of whom are way smarter than me!) couldn’t be bothered to make it less stupid; they understood it, they liked it, therefore everyone else should too! As annoying as these experiences are, the truly unfortunate part is that unlike what we have in the natural universe, Computer Science isn’t governed by a common set of rules; When the documentation runs short, there’s no external reference one can count on. Humanity can rediscover the laws of physics, but we have no hope in hell of rediscovering the laws of Bob’s post psychedelic musings, that’s just not possible. This why I sincerely appreciate the computer scientists who are bold enough to potentially think themselves out of a job by creating computers with “artificial intelligence”, computers which will be capable of doing exactly what I expect a computer should do – exactly what I want it to do!

I am amazed and enthralled by the wonders and intricacies of our incredible universe, from the quirky electron who can’t be captured, to the joy we feel when our children laugh, but I just don’t give a rats ass about someone else’s crazy ideas that they think are so smart. My limited time here on planet Earth is better spent trying to make the most of what is, rather than to whittle it away on what drifted onto paper from another’s mind.

BASICly Moving a Character with WASD

Today let’s have a look a program that moves a character around the screen using the W,A,S,D keyboard keys. The character moves around the screen and stays within the borders, as you would expect in a top-down style game.

Fortunately the program was short enough to fit into a single screen, because I still don’t have a storage device for my Commodore 64.

Keep in mind that this little program is something that I put together myself as part of my relearning of BASIC programming – it’s just an example of how something is done, not BASIC gospel!

The Program

1 P=1024+480:PRINT CHR$(147):POKE P,0
10 GET N$
20 IF N$="W" THEN GOSUB 100
30 IF N$="S" THEN GOSUB 200
40 IF N$="A" THEN GOSUB 300
50 IF N$="D" THEN GOSUB 400
60 GOTO 10
110 PRINT CHR$(147)
120 P=P-40: POKE P,0: RETURN
210 PRINT CHR$(147)
220 P=P+40: POKE P,0: RETURN
300 M=P-1024: IF M-INT(M/40)*40=0 THEN RETURN
310 PRINT CHR$(147)
320 P=P-1: POKE P,0: RETURN
400 M=P-1024: IF M-INT(M/40)*40=39 THEN RETURN
410 PRINT CHR$(147)
420 P=P+1: POKE P,0: RETURN

Line By Line Description

1 Initial screen position of @ character: clear screen: Draw @
10 Get keyboard input
20 IF Input = "W" THEN jump to line 100
30 IF Input = "S" THEN jump to line 200
40 IF Input = "A" THEN jump to line 300
50 IF Input = "D" THEN jump to line 400
60 GOTO 10 to loop through getting input approx 60 times/second
100 IF @ is already on top row, do nothing
110 clear screen
120 move @ up 1 line:Draw @: RETURN
200 IF @ is already on bottom row, do nothing
210 clear screen
220 move @ down 1 line: Draw @: RETURN
300 IF already on left edge, do nothing
310 clear screen
320 move @ up 1 line: Draw @: RETURN
400 IF already on right edge, do nothing
410 clear screen
420 move @ down 1 line: Draw @: RETURN


Due to the use of a subroutine (“function” in modern lingo) that jumps away from the GET statement using GOSUB, holding a movement key down does not repeat the movement of the character.

Lines 10 to 60 are the “game loop” that repeats roughly 60 times per second. Each time the player moves the @ character, the whole screen is erased and redrawn. This is similar to what happens in more modern game engines, just things are so fast and abstract in new game engines that redrawing the screen is taken for granted. Here with character graphics, one must manually redraw the screen, otherwise the old characters would still be there.

Lines 100, 200, 300, and 400 are used to keep the character from going off the top or bottom of the screen or from wrapping around to the next line on the screen. Lines 300 and 400 use the modulus principle (remainder after dividing) to determine the column that the character is in. In other languages it would be as simple as typing 5 % 2, which would equal 1, but BASIC 2.0 on the Commodore 64 does not have a modulus operator. I had to take the screen position and calculate it the modulus the long way, like so,

M = P-1024
M = Current Screen Memory Address – Screen Memory Start Address
M = Location in grid, a number between 0 and 999

The screen is laid out basically as a grid of 1000 sections, with 25 horizontal rows of 40 vertical columns, numbered 0 to 999. Knowing this, we can find what column the character is in using modulus like so,

Location in Grid – INT(Locaction in Grid / Length of Row)*Length of Row

Row = M – INT(M/40)*40

Where the INT() function drops any decimal places, such as 34.32 becomes just plain old 34. We know that the left most column is 0 and the right most is 39, so if the @ character is already there, then we don’t need to move it more in that direction.

This simple program can be extended by adding more functions to the game loop in a similar manner as those you see above: GOSUB to some line, do some stuff, return to line below where you GOSUB’d from. Is it perfect? No, but it’s essentially the starting point of games such as Pong and Snake.

Prototype: Programming and Electronics Computer for Kids

Or anyone with an imagination and a craving to tinker!

I have spent a lot time researching computers from the 1970s to the 1990s, as well as looking into what is available in modern hardware for tinkering with electronics and programming. Somewhere in there I was inspired to build a mock up of this,

Blender rendering of the SN0E electronics and programming hobby machine.

What you’re looking at here is a Blender rendering of the SN0E electronics and programming hobby machine, which is a self contained computer and electronics hobby kit. The system is based on the combination of a Raspberry Pi Zero W computer and an Arduino UNO micro-controller inside a retro-style chassis. It has a 4″ 800×600 LCD, a mechanical keyboard with a standard ANSI layout, a large storage box for electronic components, two full sized bread boards for making projects, 8 jewel style LEDs, and set of keys, buttons, and switches (with a slider for good measure!) that can be wired to do whatever the user would like.

The idea is basically, if this box was the only thing under the tree for a child at Christmas, they would be able to open it and spend the rest of their life creating countless fun projects! No batteries to buy, no mouse to lose, and only the power cord to worry about… just a complete kit of awesome and a manual to take you from scratching your head to revelling in how amazing you are.

SN0E stands for, “Semi-Nerdly Raspberry Pi Zero Enhanced”, but you can call it the “Snow” or if you’re a Brit, the “Snotty” (S not E). Funny story, I thought of the name while shovelling my drive way, but it wasn’t until I had nearly finished the model that I made the connection between S N 0 E and the snow I was shovelling hours before… πŸ™‚

I’ll be building the prototype and writing the manual this year, and down the road I will see about mass producing them. If nothing else, after refinement I will be able to hand make custom machines, though I bet that would make them expensive as hell (which is damned shame – every family should be able to afford one!!!).

Major Design Points
– Sturdy, high quality chassis/switches/buttons/keys that will stand the test of time while also being easy for the owner to repair.
– Capitalise on standards, so what kids learn is actually useful in the real world (such as repairing or upgrading their SN0E!).
– Standard keyboard layout.
– Standard Raspberry Pi OS and Arduino software.
– Well labeled pin headers.
– Super friendly manual that teaches kids electronics and programming in a practical, entertaining way that encourages emergent behaviour and creativity. This will include programming a game using PyGame, making a merry-go-round with motors, lights, and programming, and lots of other nifty stuff.

I’m one man who is building the SN0E as a “passion project”, so it’s going to take a good long while to complete. Creating the prototype will be expensive, making/testing/documenting the projects will take a long time, and writing/editing the manual is a full time job in itself, so we’re probably looking at a few years of development. Now, if someone provided me with all the resources and they locked me in a room with them, I could have it complete in less than a week. There’s a challenge for any bored rich people out there – I know I can do it, because that’s how I operate best, alone and until the job is done!

I really want to make the SN0E, because it’s something that I wish I had as a kid. Sure, one can accomplish the same effect using a Pi, an Adruino board, and a bunch of stuff on their desk, but that’s not half as inspiring and approachable as a system you can take out of the box and sit down at to use. A self contained command center of awesome, all yours, doing exactly what you programmed it to do!

Speaking of putting it on you’re desk…

A mockup of the SN0E electronics and programming hobby machine.

Here are some images of the SN0E,

And here are some images showing how I created the mockup using Blender!

Ultimately, I would love to see a SN0E lab in every elementary school in Canada – that would be totally awesome, for the kids and for the future they’d be inspired to create! Wish me luck and thanks for reading! πŸ™‚

Programming: The Importance of The Groove

Every good post starts with a deep breath and a long exhale, right?

Most people have their own workflow and accomplish their goals at a pace that is right for them. That seems to be the natural way of things. Personally, I am the kind of worker who excels at stepping onto the highway and driving nonstop to the destination, fuel be damned! This is especially true of my programming projects, for the simple reason that in order to make a complex piece of software, one essentially needs to load all those complexities into his brain and move them around, kind of like one of those jumbled up picture squares that the inevitable health conscious neighbour would give us on Halloween instead of candy. Manipulating all of that information and knowing the constructs and concepts inside and out is “The Groove” and, at least for me, it is the most important aspect of successful programming.

In May of this year I started working on a new project, RocketTux, with the idea that it would be a stepping stone toward creating HTML5/JavaScript games rather than slogging away at C++/Lua based MMO emulator mods or Python/Blender related projects. I put a fair amount of effort into creating a simple, yet effective workflow, using tools that “just work” in Linux Mint 17.3 and that I am already comfortable with. All was going well and I made quite a bit of progress until… Updates to my Legend of Hondo project and helping out with the Tarkin II project happened. Hello mental train wreck, how nice of you to obliterate my house of awesome!

Now, a couple months hence, I am sitting here picking through the rubble of my RocketTux groove, essentially relearning both the software framework and my workflow all over again. And, it sucks. And… it’s my fault.

Losing the groove due to dividing my time between multiple projects is 100% the result of poor discipline on my part. I am self aware, I know how I work, I know how I create, I know how I design… Most importantly, I know better. Truly, I do. For me to actually achieve a goal, I need to work at it exclusively until the damned thing is complete!

Now, this doesn’t mean that I must work on a project at the expense of everything else in my life. Rather, it simply means that I need to confine my thinking, pondering, dreaming, designing, and other cognitive processes used for hobbies to a single project at a time. Focusing on one project is a lot like reading a novel, where you can read a few chapters, put the book down and go to work, then read some more when you get home later, easily picking up from where you left off, because the story is fresh in your mind. Because… you were “in the groove”!

“Respect the groove, reward the world!” – words I need to live by! And you can quote me on that. πŸ™‚

Now with that said, as much as I would dearly like to hang up my SWG/SWGEmu modding hat for good, I started something with Bio-Engineering that I would like to finish. It’s something for me, by me, and one day I might have some fun using it! Unfortunately, in typical SWG/SWGEmu fashion, some of the work is super duper whooper tedious (14+ client/server files to add a single new BE pet…), which translates into “will take an ass load of time, while also being very, very boring in the process”, so I have been reluctant to continue on with it; I WANT to be working on RocketTux, but I lost that groove and replaced it with the SWGEmu modding groove again. *sigh* So, I may as well “go with it” and finish the Bio-Engineer mods that I started. Once they are finished though, I am hanging up my Legend of Hondo hat indefinitely and yes, that means I will not finish the project. Honestly, I would rather create HTML5/JavaScript side scroller games, because they are both more accessible to end users and astonishingly more enjoyable to develop.

Why I Program the Way I Do

I started a new project this year, RocketTux, with the intention of using it as a way to transition from making MMO emulator mods in C++/Lua and crazy stuff in Blender/Python, to facilitating the creation of my creative visions by way of HTML5/Javascript. “That’s overly wordy, isn’t it, Rob?”, you may say, but the truth is that I am not one of those pedantic nerds who argues about programming paradigms, stacks, pointers, “computer security”, or any of the other numerous non-subjects so many “coders” and old-timey “programmers” tend to fuss about. Nope, much like FrΓ©dΓ©ric Auguste Bartholdi probably didn’t know how to smelt the copper that clads the Statue of Liberty, I really don’t care about the details of how computers get to the end point of presenting my creations. I… just don’t care, at all. So when I say I wish to use HTML5/Javascript to “facilitate the creation of my creative visions”, what I am doing is clarifying that I am content to use nerdy tools to make cool stuff!

So with that in mind, here are some answers to questions that may cross one’s mind when studying the source code of one my open source projects.

Q: Why are you such a terrible programmer?
I learned procedural programming in the early 1990s on a Commodore 64, where rudimentary functions in the BASIC language could be achieved by using GOTO statements and then returning to the line below the entry point with another GOTO statement. Since then I have puttered with other programming languages and systems, having long since decided that I definitely did not want the stress, stupidly long hours, and other head-sploding annoyances that come with working as a professional programmer (I’d rather clean toilets and be poor as dirt, yet happy!). I enjoyed solving the logic puzzles involved in programming, essentially being able to “tell” the computer how to achieve my goals, and that remains the extent of my interest in “computer science”. Sure, I know a lot about some computer hardware, because I find some of it interesting, but I sincerely couldn’t care less about the finer points of computer programming languages. I loathe C++ and other such languages for the way they dump things that computers should be… computing! onto the human being. “Computer, show me a house. Great, add a window here. Now make it French provincial. No, smaller. Better.” – why the hell CAN’T we do that today, like they’ve been doing on Star Trek for 50 years??? The answer is simple, the folks who are smart enough to program such a device are a bunch of pedantic nerds who would rather pick nits and talk gibberish in a thinly veiled effort to prevent their own obsolescence; I am not one of them. I am an artist who is content to use the tools required to give form to his creative visions. As such, I LIKE TO program in such a way that a person can actually understand what my programs are doing by, you know, reading the code and the comments and junk…

Q: Why do you use if statements rather than the ternary operator syntax?
Simple: The intention of the if statement is immediately discernible to anyone who is familiar with logical flow in general. If statements “make literal sense” and therefore have the capability of being universally understood. Take the following for example,

IF bob falls down and cuts his knee
    clean and bandage bob's knee
    kill all humans

Clearly, the intent there is for our robot to kill all humans when it’s not occupied by healing bob’s wounded knee. And that would probably be clear to any literate human being, let alone people who are familiar with the syntax of a specific programming language.

Q: If that’s the case, then why do you use the short form syntax for objects and array’s in Javascript?
I do this because the shorthand method is also immediately clear to any reader.

var appleVarieties = [‘delicious’, ’empire’, ‘macintosh’];

It is immediately obvious that the variable “appleVarieties” is a container that holds a list of varieties of apples. The same goes for objects, which look pretty well the same as arrays, except that the entries also have names.

var profile1 = {
    name: 'John Smith',
    number: '555-555-5555',
    email: ''

Reading either of those declarations is not only easy, but they are both direct visual representations of structure of the objects. Furthermore, they clearly demonstrate the relationships between each element, as well as how the elements can be used by way of their parent variable.

var myAppleType = appleVarieties[0]; // myAppleType = ‘delicious’
var playerName =;

Q: Why don’t you use ____ library/syntax/etc.?
Different strokes for different folks! When it comes to libraries though, trust that I have tested a multitude of libraries, game engines, frameworks, and so on over the years. There will always be a variety of ways to achieve the same goal and I prefer to use the least complex, most readable way to achieve things. “Kids these days” seem to love their convoluted as hell programming structures and, well, good for them if that’s what they like. However, I am content to do my own thing in a logical, easy to follow way.

Q: In RocketTux, why didn’t you parse the XML files for the Tiled levels directly?
Performance and simplicity. Given that it took very little effort to convert the comma separated values for the tile maps created by Tiled into Javascript objects and the reality that they would never change, why create hundreds of disk reads when it could be done in a single disk read? Computers have far more RAM than what is required to run the program, so I may as well load as much into RAM as possible, as it’s orders of magnitude faster than even solid state drives. Also, by creating 40 tile wide level sections as JS objects, it was easy in Phaser to string them together randomly to form ever changing level layouts (whereas loading a Tiled map within the Phaser framework appears to be an all or nothing, one shot deal).

Q: Again in RocketTux, why did you duplicate data in your loot groups rather than keeping it separate and then combine the arrays as needed at run time?
Performance. Why force the program to continuously build something that is literally never going to change in its constructed form? Especially given how easy it was for me to copy and paste the data from the spread sheet. In this way, all the program has to do is reference the array and pick one entry at random.

Q: You do realize that you’ll always be a terrible coder, right?
It’s called programming, not “coding”, and that thing you call a “method” is literally referred to and declared as a function… A “method” in programming is how one goes about programming without getting Cheetos dust all over the keyboard… Now, get off my lawn! πŸ™‚

Essentially, I program the way I do to help clarify the intention of the program; Performance optimizations for an end-user version of the software can be compiled or configured in a build specifically for those people who will only ever use the software, provided that doing so will tangibly improve the performance of the software (aka, doing so is worth the time and effort).