Go: Fooled Me Twice, Shame on Me

Published at 09:32 on 21 June 2024

I just can’t seem to learn. I so much want there to be a better alternative (i.e. a good, modern programming language that compiles down to machine code) to C/C++ out there. And I just can’t stop thinking that Go might be it. Then I keep running into problems. Go (and its libraries) continually keep making it very difficult to do clever things.

My obstacle this time is how Go parses command-line arguments. Most modern languages do this by building a collection of objects to describe the allowed command-line syntax, making a parse call, and receiving in return a collection of objects describing the options and arguments found.

Go is different, probably because it was written by individuals skeptical of object-oriented programming. Instead, it is all based on passing pointers into an argument-parsing subsystem. When one initiates a parse, the pointed-to variables get set in ways reflecting what the user typed on the command line.

That might work well enough in the simple case, but my case is not so simple. I am trying to write a family of related commands, each with a set of standard arguments, and most with some custom, command-specific arguments as well. Moreover, there is a configuration file, and it is possible to get values from there if they are not specified on the command line with options.

In Java, I have done that by using the Apache Commons CLI library, subclassing the main class that holds the syntax description, and having it auto-populate itself with the standard arguments. Then my subcommands all use that class, and automagically get the standard options they need. No fuss, no muss, no repeated code, and all the options are in a single place.

Then I pull those parsed option values into the class representing a parsed configuration file, so that a command-line option will overwrite the in-memory copy of an in-file option. Presto! All the configurable values I need are now all in one place. And not only that, it was simple and easy to accomplish.

Go’s pointer-based argument parsing makes this basically impossible. Oh, there’s an alternate argument parsing library out there, but it is likewise broken by design, because it is pointer-based as well. Wait! There is a “value interface” that might offer an out? Nope, sorry, no escape: it only seems to support string values (even Boolean flags are unsupported!), and it is incompletely documented.

I keep running into this sort of crap with Go. And only with Go. Other modern languages just don’t seem to have this degree of pervasive brokenness. The Python standard library, for example, parses arguments much in the same way that Apache library does in Java. Even the hoary old cruft-fest of a programming language that is C++ has a popular third-party library that does the right thing.

It’s not just argument parsing. Previously, I struggled with how Go’s character set support can’t signal an explicit error condition when it encounters invalid input. Java, Python, Ruby, C++: all can do this if requested. Not Go, at least not out of the box and not without a lot of extra effort.

It’s bad enough to make me seriously question if there’s any problem space out there for which Go is the most appropriate solution. I know there are large, successful software systems written in Go, but my own personal experiences make me suspect strongly that those projects were much harder to get to their current state of completeness than if they had been written in some other, less limiting, less pervasively crippled by bad design, environment.

Perhaps it’s all just me, and others don’t feel the suck so much. Frankly, I don’t think so. But that’s just one more person. More damning, I think, is the verdict of Go’s original sponsor, Google. If Go really was the way to fill the need for a more modern language that compiles to machine code, then Google would not be sponsoring the Carbon project.

It’s all a shame, because to reiterate I really want there to be a better alternative to C/C++ out there. Alas, Go does not seem to be it.

What Would Give Me Hope

Published at 13:09 on 20 June 2024

What would give me hope, in the event of a Trump win, that a transition to fascist rule in the USA is unlikely? I think the answer is best found where I recently wrote that who ultimately prevails will mostly be “a question of which side manages to best triumph over its own internal incompetence.” The answer is, in other words, a question of how the opposition to Trump might manage to best triumph over its own internal incompetence, and how many signs of this appear.

I think the most promising such sign would be the appearance on the scene of what I will term, for lack of a better phrase, a “none of the above” opposition that quickly attracts a large degree of popular support. By “none of the above,” I mean that it won’t be associated (at least not explicitly) with either the Democratic Party establishment, or with the radical Left subculture. Many, perhaps most, involved in it won’t even personally identify as either Democrats or leftists, and neither will most of its initial leadership and/or public figures.

The necessary factors for such a movement appearing will exist, namely:

  1. Trump’s extremism.
  2. The self-evident incompetence of existing oppositional actors.

The first will motivate people to oppose Trump, and the second will make them realize that they can’t rely on existing organizations to do the opposing and must therefore create something new and more effective. The question is whether or not the motives will bear the desired fruit.

This also means that the best contingency plan would be to start laying the groundwork for facilitating the appearance of such a movement now.

What If Trump Wins?

Published at 10:10 on 19 June 2024

He Probably Will

Biden has been very consistently underwater in the polls for some time now. I don’t think that can be simply waved off. Trumpers were waving off how Trump had been consistently underwater by this stage in 2020, and we all know how that election ended up.

But He Might Not

I said probably in the above section, and I meant it. Polls are not infallible. The polls were saying that Hillary would probably win in 2016, and again we all know how that one ended up. Probably more pertinently, the Democrats have overperformed compared to polling for every election since and including 2018. This is probably due to several reasons. Speculating on what those reasons probably are is outside the scope of this post, but suffice to say the most likely reasons still all exist.

At any rate, a Trump win in November is likely enough that it is worth speculating on.

There Will Be Chaos

That is the one and only certainty. Trump is an agent of chaos.

It won’t be as much of a global shock as Trump’s 2016 win, because pretty much everyone knows that a Trump win is not just an idle hypothetical but is very much in the realm of possibility. But there will still be chaos nonetheless.

For openers, there is Trump’s (and Trumpers’) ego-driven “own the libs” mentality at work. “Owning” the other side by rubbing their noses in their defeat might feel good, but it is seldom good political strategy. The best strategy is to make the other side feel somewhere on the spectrum from bored to reassured, because that robs them of the motive to oppose you. “Owning the libs” accomplishes exactly the opposite.

So expect the new Trump era to begin with something like the 2016 Womxn’s Marches, i.e. historically big protests. This is particularly likely if Trump once again wins in the electoral vote despite losing the popular vote.

So Many Unknowns

Beyond that, it becomes increasingly hard to say.

On the one hand, he’s a fascist, set on doing fascist things. And this time, unlike in 2016, the fascists are actually expecting to win and have planned for it.

On the other hand, he’s incompetent at most things. The last time Trump was in the White House, he was continually stumbling over his own dick and making one stupid unforced error after another. This started very early on, when he ran his mouth off and earned a Special Counsel investigation for it. Project 2025 is very real and very scary, but it is quite likely that Trump himself would unwittingly sabotage efforts to put it fully into place.

And we then have the opposition, both the so-called “opposition” of the Democratic Party, one of the world’s most politically incompetent major parties, and the latent or potential opposition from the grassroots. And given the inward-looking and subcultural nature of the radical left in the USA, the Democratic Party is hardly the only potential oppositional actor that can be described as likely to be incompetent.

So it’s really a question of which side manages to best triumph over its own internal incompetence. That’s not a question that I (or likely anyone else) can answer right now.

The Big Takeaway

What it does mean, however, that if Trump wins those on the Left should not give up hope and throw in the towel. Real opposition, opposition capable of derailing Trump, will still very much be possible, and the time to start opposing will be the instant the election is called for Trump. And the time to start making contingency plans for such opposition is now.

On the Debate Rules

Published at 16:07 on 17 June 2024

CNN has released a summary of the rules for the upcoming Trump/Biden debate on the 27th. Some comments:

Microphones will be muted throughout the debate except for the candidate whose turn it is to speak. While no props or pre-written notes will be allowed on the stage, candidates will be given a pen, a pad of paper and a bottle of water.

So it’s pretty obvious that the mike for Candidate A will be dead whenever it is Candidate B’s turn to speak. This means no more interrupting by Trump. Sort of a surprise that Trump would agree to this, and I would expect Trump and the sheep who follow him to bleat about “censorship” post-debate because of it.

That’s assuming Trump even shows up, of course, but given that his team has agreed to these rules, my money is on him showing up. If he believed beforehand the rules rigged the debate against him, he simply wouldn’t agree to them, and there would be no debates scheduled.

What’s not so obvious is what happens when a candidate runs past his allotted time to speak.

Ideally, the mikes should be on an automated timer, with a count-down clock, visible to both the audience and each speaker, showing time remaining. The instant it goes to 0:0.000, down to the millisecond, the mike gets cut. If it gets cut mid-syllable, so be it. Should have paid better attention to the clock.

Anything less than the above, and Trump will abuse the situation to gain an unfair advantage by speaking more than his opponent.

Some aspects of the debate – including the absence of a studio audience – will be a departure from previous debates. But, as in the past, the moderators “will use all tools at their disposal to enforce timing and ensure a civilized discussion,” according to the network.

Second part first: don’t make me laugh by writing such whoppers, CNN. Lax enforcement of rules made the so-called moderators putty in Trump’s hands four years ago. They let Trump interrupt Biden, contrary to the rules, over and over and over again. This, CNN, is why I suspect your moderators will let Trump run over. The only thing I will trust is cold, hard, simple, merciless technology. Use an automated timer or Trump will repeatedly run over time.

Regarding the lack of an audience, this is probably to Biden’s advantage. Trump feeds on crowds in a way that Biden simply does not.

Well, That Sure Sucked

Published at 15:46 on 17 June 2024

Yet again, a MySQL auto-update ran while I was out of town. Yet again, the auto-update auto-trashed my database.

In baseball, a hitter has three chances to hit the ball. But that is in a situation where another pitch takes under a minute to make. Life is not a baseball game. I just pissed away most of a day recovering from a MySQL failure. Again. Two strikes and you’re out, MySQL!

I am now back up, with all auto-updates disabled, and using MariaDB instead of MySQL.

Postscript

Published at 18:43 on 2 June 2024

It sucked even more than I expected it to. This is because in addition to all the issues I mentioned previously, the site is crap from a technological point of view: slow, laggy, and full of flimsy server-side Javascript that does things like randomly cause the contents of your coding window to disappear. Plus it doesn’t run at all unless I disable some of the protections on my browser.

At least I had fun sending the stupid thing arbitrary machine code. Which, of course, was harmless and only printed a message linking to the aforementioned article.

I highly doubt I will get selected for an actual interview, but why would I want to be, given what sort of garbage they feel comfortable shoving at people?

Why HackerRank Sucks

Published at 12:02 on 31 May 2024

Foreword

I have thought of writing this article more than once before. I just got assigned yet another HackerRank test as part of an interview process. Sometimes, I have blown such things off entirely. Sometimes, I attempt to do my best on answering them.

This time, I plan to do something different. I will have a link here in my response to the problem; if you are reading this as a result of following that link, then here is why I responded the way I did.

Introduction

HackerRank sucks for two main reasons:

  1. The general irrelevance of undergraduate computer science exercises to real-world programming, and
  2. The artificiality of HackerRank’s time constraints.

Irrelevance of Problems

In my experience, HackerRank’s exercises tend to be thinly-disguised rehashings of undergraduate computer science homework assignments. Such assignments tend to be heavily based on coding implementations of basic data structures, often trees of various sorts, that have very limited real-world relevance to solving problems on the job. I have written on this here before. It’s really not a surprise, given how the usage of such problems is basically mandated by the general nature of the constraints of the HackerRank platform.

Effectively, such tests screen for either recency of undergraduate coursework (and thus lack of practical, on-the-job experience), or willingness to spend time brushing up on a skill set whose real-world utility is extremely limited (and thus for unquestioning submission to authority and willingness to obey pointless rules). The first is diametrically opposed to the goal of filling a senior-level position, and the second is diametrically opposed to the sort of environment that I personally thrive in.

Artificiality of Time Constraints

Real-world programming tasks generally do not pop unexpectedly out of nowhere, with no advance warning. They are usually foreseeable as part of the natural trends of evolution of software systems and the organizations they support. As such, the prudent developer has usually already spent some time thinking about such issues. Sometimes, of course, they do pop up unannounced (long-latent bugs sometimes manifest, and sometimes have severe impact). Even then, they don’t come with a count-down timer and a hard artificial deadline. It is possible to take a walk (I get some of my best ideas outdoors) or to bounce ideas off colleagues.

With HackerRank, there is no such subtlety. The clock is ticking, the artificial deadline is rapidly approaching, and it will be enforced without mercy. (Sometimes you even get a so-called proctored test, in which you must enable a spy camera. Leaving the room is considered cheating. Lucky you.) You will solve the problem in one sitting, and you will do it now. And the problem has limited real-world relevance at best.

Conclusion

Maybe I will submit an actual solution, and maybe I will not. It will depend on the exercise and how I feel about it at the time I submit my response. At any rate, the link here will be the most important part of that response.

Really, there is not much more to say, so it is time to wrap this up. HackerRank sucks, and now you know why.

Well, That Was Sure Wrong

Published at 19:04 on 30 May 2024

Guilty on all counts! Mind you, this was the least important of all of Trump’s trials (the Georgia vote-tampering and Federal insurrection charges are far more important), but the precedent that presidents and ex-presidents are above the law has been completely broken and repudiated. Ex-presidents can be charged, prosecuted, and convicted.

Not that it will matter one whit to Trump’s base of loyal fascist followers. Any real repudiation of the Trump legacy must involve a second defeat in at the polls in November.

Prediction: Mistrial or Acquittal

Published at 09:13 on 29 May 2024

Why? Simple arithmetic.

The USA is about ⅓ fascist (that is the rough fraction of diehard Trumpers), and it only takes a single fascist on the jury to block conviction. In Manhattan, the statistics are not quite so dismal: about 12% voted for Trump in the last election. Let’s be generous and assume some of those did so while holding their noses and that the true measure of the hardcore fascist base is half that.

In other words, Manhattan is 6% fascist. Or, looking at it from a glass half-full point of view, 94% non-fascist. But here’s the rub: the odds of all 12 jurors being non-fascist are 0.94¹² or about 48%. In other words, odds are better than even that there is at least one fascist on the jury.

And no fascist will vote against their führer.

Israel’s Reputational Decline Continues

Published at 23:21 on 28 May 2024

Just in the past few weeks we have seen a series of ignored international court rulings, plus statements from the USA that Israel will be allowed to ignore the rulings (thus showing how hard it is to turn the ocean liner that is foreign policy), plus three Western European nations, two of them NATO members, recognizing Palestine as a fellow nation.

Not much more to say other than the decline continues, and to reiterate that this is all meaningless feel-good stuff until suddenly, at some point in the future, it won’t be.