Tales from the jar side: Medium post on failure, Lying on security questions, UML in IntelliJ IDEA, An Obituary to die for, and more
How much does Santa pay to park his sleigh? Nothing. It's on the house.
Welcome, fellow jarheads, to Tales from the jar side, the Kousen IT newsletter, for the week of December 13 - 19, 2021. This week I taught my Reactive Spring course on the O’Reilly Learning Platform.
On Friday I also received the new M1-based Mac that I ordered, so I’m busy relogging into everything and setting up all my usual tools, including this newsletter on Substack. So far, so good, but lots of hours wasted. No fan running yet, however, so it’s all good.
If you wish to become a jarhead by subscribing, please use this button:
Failure on Medium
The essay I included in this newsletter a couple weeks ago about dealing with failure, where I talked about my loss at a recent chess tournament and my lowest score ever on an exam, is now a post on Medium. It turns out that the editor of the Pragmatic Programmers publication on Medium (Hi Margaret!) is a jarhead. She read my newsletter and asked if I’d like to revise it for that platform. I was happy to oblige.
I took the opportunity to add a section about the so-called “successful failure” of the Apollo 13 mission to the Moon, which meant the mission objective (landing on the moon) was not achieved, but the astronauts made it home safely. If you’ve ever seen the movie Apollo 13, you know how tough that was to accomplish after the explosion that left the service module crippled.
(As an aside, that movie, with its added drama, noble protagonists, and triumph over obstacles, is only the second most Ron Howard-est movie of all. By far the most Ron Howard-est movie is A Beautiful Mind. The real John Nash wasn’t anywhere near as good as the guy in the movie, and his long marriage to Alicia was problematic at best, with multiple affairs with both men and women and even a child out of wedlock. Read the excellent biography by Sylvia Nasar that the movie is based on for the sordid details.)
The most famous line from the movie is the one attributed to NASA Flight director Gene Kranz:
That’s kind of an awkward statement, given how many failures, both by people and technology, had already occurred at that point. But hey, it’s a good line, everybody knew what he meant, and it’s a Ron Howard movie.
The real lesson to be learned was that when you’re faced with failure, don’t let it paralyze you. Keep working the problem, as they say in the movie. Don’t interpret a failure as evidence of deficiencies in your own character, and face the consequences.
The conclusions spelled out in the article are:
Mistakes are an inevitable part of the learning process.
It’s okay to fail. If you aren’t failing, you aren’t trying anything new.
Don’t dwell on your mistakes or they will keep you from moving forward.
All of that is really tough, of course. I would much rather avoid my own failures than face them, but I must admit that the fear of failing, and the fear of the consequences of admitting to failure, are almost always much worse than the failure itself. If I failed (hah) to get that point across, feel free to let me know.
Insecurity Training
I just joined a company as a contractor on a new consulting project, which meant I had to go through their security training this week. That consisted of a series of videos and associated quizzes, which seemed to take forever. My client is small and agile, but a few years ago they were bought by a giant company, so they have to suffer through giant company procedures and policies. The security videos, as you might imagine, were designed accordingly. They were professionally done, and the advice was mostly reasonable, but wow there were a lot of them. Next time I’ll remember to tell the client that I charge double for having to sit through that nonsense.
Don’t get me wrong. It is good to let people know about phishing attacks, or spoofing, or what to do if you get an urgent message from the CEO asking you to transfer a huge sum of money to a foreign client you might want to call the CEO first to verify. Also, it’s probably not a great idea to reuse the same password (“password”) on all your systems, including social media. Write all your passwords down on a post-it note instead and paste it to your computer screen.
Kidding! Don’t do that — hide the post-it note underneath your keyboard. That’s way better. Security by obscurity, I always say. As any baby will tell you, if you can’t see it, it doesn’t exist.
The videos contained one fascinating piece of advice. You know how sites require you to supply answers to several security questions, like your mother’s maiden name or the mascot of your high school football team? The video recommended — and I’m not kidding about this — always lie on those questions. There’s no need to supply honest answers. While I love the idea of lying on stupid forms, the only problem I have with that advice is how to remember the answers I gave.
I therefore did a bit of research, and in case you decide to use this info, here are the results, care of the Smallville Wiki and Wikipedia:
Clark Kent’s mother’s maiden name is Clark. For the record, her full name is Martha Hudson Clark Kent.
The Smallville High School football team is the Crows. The mascot is, of course, a crow, and the school colors are goldenrod and red.
Clark had a golden retriever named Shelby in the show. Much more problematic is that Superman’s dog is named Krypto. Can you imagine in these days of massive cryptocurrency scams and NFTs, having to call out loud, “Here, Krypto! Krypto come here! No, I mean Krypto with a K! He has nothing to do with bitcoin, ethereum, or any other fake speculative currency that isn’t a true currency at all and actually represents nothing!”
Clark Kent was a solid newspaper reporter, and Superman is, well, Superman, so they definitely would both know about the level of evil associated with cryptocurrencies, NFTs, and the abomination known as web3 (the massively slow, inefficient, blockchain-based web where nothing works and everything costs money).
So I’m thinking of going with Clark next time, though other options might be Buffy Summers, Susan Ivanova, or maybe Tony Stark (I love the idea of entering “genius, billionaire, playboy, philanthropist as my hobbies). Other answers I guess I can make up. Now I’m rather looking forward to using some of these answers the next time I register on some obscure web site.
IntelliJ Class Diagram
I mentioned I’ve been playing with the Mockito testing framework recently. In order to discuss it, I need an example to test. I decided to use this an an opportunity to create a rather realistic, if simple, system, that uses lot of features of Java that have been added to the language of the last few years. That way readers can see a combination of topics like sealed classes, pattern matching, records, and more. Given how unfamiliar those are to most current Java developers, the need to test them becomes even more important than usual.
For example, here are the records, based on a sealed interface:
The benefit of sealed classes or interfaces is that you can then take advantage of pattern matching in the enhanced switch statement, which unfortunately is only a preview feature of Java 17, but works when you enable it:
I wrote the code and was pretty happy with it, though I will probably still tinker with it. I also have test cases for everything. If you want to see the source code, it’s in this GitHub repository.
The problem was that describing the code was getting awfully wordy. Back in the 2000s, the Unified Modeling Language (UML) was created for diagramming the composition and behavior of software systems. If you wanted to understand a system you’d never seen, a UML class diagram often helped, as it showed the relationships of many of the components. I even taught a few UML classes back in the day, before they mostly went out of style.
It occurred to me that a simple UML class diagram might really help in my case, but generating those often required expensive commercial tools, or free versions that left much to be desired.
After thinking about it, I wondered if IntelliJ IDEA (my primary IDE) might already have that capability built in, and sure enough, a bit of experimenting gave me this:
This isn’t quite right (and I have to switch to a light background), but I can work with it. The AstroService class has a method called getAstroData() which calls the getResponse() method on the Gateway. Gateway is an interface implemented by the AstroGateway class.
Result is a generic, sealed interface, which only has two subclasses: Success and Failure. Success wraps the result we want. Failure wraps any exception thrown.
AstroResponse and Assignment are records, whose properties are match the methods shown.
Anyway, it was nice to see that a capability that used to require separate tools and lots of money is already available in my primary IDE. Sweet. I just hope it helps.
An Obituary To Die For
(Too soon?)
Most obituaries tend to be dry affairs, but this one, about Renay Mandel Corren in the Fayetteville Observer, has deservedly gone viral. No, really. Here’s the start:
A plus-sized Jewish lady redneck died in El Paso on Saturday.
Of itself hardly news, or good news if you're the type that subscribes to the notion that anybody not named you dying in El Paso, Texas is good news. In which case have I got news for you: the bawdy, fertile, redheaded matriarch of a sprawling Jewish-Mexican-Redneck American family has kicked it.
It only gets better from there.
Miscellaneous
Spoilers, but true:
I found a whole page of log4J hack memes, but this newsletter is already running long so I’ll settle for this:
This was about Kickstarter announcing it was moving to the blockchain, but it works for any company making money by destroying the environment:
I downloaded my vaccine card right away:
And finally, tis the season:
If his heart really did grow three sizes that day, he should probably see a cardiologist as soon as possible.
As a reminder, you can see all my upcoming training courses on the O’Reilly Learning Platform here and all the upcoming NFJS Virtual Workshops here.
Last week:
Reactive Spring and Spring Boot, on the O’Reilly Learning Platform
Kotlin Features Java Devs Need To Know, an NFJS webinar, Friday, 1pm Eastern Time.
This week:
No classes this week, so, in the immortal words of Rodney Dangerfield in Back To School, “Call me when you have no class.”
Planning a Groovy Podcast this week.