I Never Pick the Easy Answer

I realize that’s an odd title, and it doesn’t apply to everything. It’s more for the technology stuff. Most programming environments (languages, libraries, etc) have an … expected … way to do something. It’s what the original developers of that environment (both the ones who created the environment and the initial users of it) built and were comfortable with. And they came up with the answers that worked for them. If you wanted to do something that was extremely different, you were probably going to have some issues.

This is where completely open environments shine. Probably one of the best modern examples is the C programming language (and, to a lesser extent, its direct successor, C++). One of the reasonably well known characteristics of C was how one of the standard data types was a “pointer-to-type-of-data”. So you could have an “int” which was a regular integer number, or you could have an “int *” which was a pointer to an integer. The value of the pointer was just a random address in your allocated internal data memory that contained … you guessed it! An integer value.

The idea was that more complex data types didn’t have to be broken down and passed around, piece-by-piece. Think of it as something put together out of, say, Lego(tm) bricks. Sure, you can rip apart the model and hand all of the bricks to someone else. Or, you can just have the model sitting on a display shelf and tell someone else “It’s over there”. And, when you move the model, the next time you can say, “Oh, it’s over there now.” Or you could have multiple models and point to different ones.

The problem that regularly arises is when you mess something up and your pointer-to-data no longer points to something valid. One of the common examples of this is the NULL value – which is always guaranteed to be 0 (zero). That location is also guaranteed to be outside of your available data memory area. NULL is / was commonly used as a way of saying “this pointer doesn’t point to anything useful”.

However, lots of programmers are lazy and tell themselves (and everyone who will maintain their code after them), “I’m never going to mess up with pointers”, and so their code doesn’t check if they’ve got a valid pointer or not. So, then, later, something tries to access data through a NULL pointer and … BAM … you toss a SIGSEGV (segment violation – trying to access memory you’re not allowed to) and the program, or system, or whatever crashes.

Lots of other languages (since the advent of C/C++) try to get around that by forcing a pointer (if they support that data type) to always point to a valid version of whatever it’s supposed to be pointing to. The problem with this, though, is that while it may make things “safer” for the programmers who are lazy and sloppy … it can make things more difficult for someone who’s trying to be creative and do something “weird”.

Needless to say, I was pretty much always one of the “weird” programmers. [On the other hand, I also generally wrote the cleanest code anyone had ever encountered, and rarely had bugs in anything I released for production, so I kinda knew what I was doing.]

Why is any of this relevant?

Well, it also means that when I need to work in one of those more constrictive / restrictive environments, the way I want to do something too often doesn’t work and isn’t supported.

One (semi-?)recent example was I was trying to re-create a solitaire card game I’d written from decades ago. The original version of the game was written (by me) in 8086 assembly language for a PC … running DOS. Note that this was before Windows was the universal environment for Intel / AMD-based computers. I wrote a .EXE (well, the .ASM that turned into a .EXE) that allowed a user to play a pretty cool game of solitaire (based on a standard 52-card deck). And this wasn’t Klondike or any of the “usual” games of solitaire.

About a year (or so?) ago, I decided I wanted to recreate the game for something a bit more modern. Since my main desktop computer runs Linux (Manjaro, if you cared), that was my primary target environment. I figured I would try doing it in Java with JavaFX.

[Note – Java is FAR from my preferred language or environment. There’s way too much reliance on IDEs and external support structures, etc. For how long I worked in C / C++, my main environment is an EMACS editor (with lots and lots of screens open), some sort of version control system (these days, a local / personal git repository – since I finally convince myself to move away from RCS/CVS), and a Makefile. To do anything effectively in Java, you pretty much are forced to work in an IDE.]

So… after spending a lot of time fighting with openJava JREs and JARs and such, I had a version that worked … well, sort of worked. Because of (apparently recent-ish?) insanity with how the JRE works with JAR libraries, there’s a WHOLE bunch of hoops that need to be jumped through to make an external JAR work with regular program stuff. Finally, after trying repeatedly (and failing) to get something that would run from a command line, I decided to migrate the whole thing over to C++ and something that was more native X-Windows-ish. Except … NOTHING allowed the level of configurability over the foreground / background colors of text labels and stuff that I wanted and needed. Or at least not without needing to research and add potentially hundreds of lines of extra code just to make the library “do what the hell I WANTED it to do“. So, I shelved the idea and it just sits there, giving me puppy-dog eyes, hoping I’ll come back and finish it some day.

Brings me to … here. This site, actually. One of the things I want to do here is to have a little “Where’s the Current Project?” status box on the home page. [Oh, for the record, I’ve sought out external assistance for making the site look nice(r), so the person I eventually hire for this may have a quick and easy solution and I’m making a mountain of a molehill.] This little box should have the ability for me to adjust a “Current Activity” text area, and a status indicator (of some sort) – possibly a configurable “progress bar” (# of # chapters updated, or “done/not-done”), and, potentially, also a word-count meter.

I can’t see ANYTHING that makes this an easy thing to do. And building something like that, where I can also easily update the information without rewriting the entire page, seems like it should be easy. Maybe it is and I just don’t know the right tricks? But … I’m gonna guess that it isn’t and I’ve, once again, decided I want to do something that isn’t normally in the “Yeah, this is what we do” list for an environment I’m working in.

Leave a Reply