Alvin Alexander | Java, Scala, Unix, Perl, Mac OS X

For the first time in many years I just came across Kent Beck’s Four Rules of Software Design:

  1. Passes the tests
  2. Reveals intention (should be easy to understand)
  3. No duplication (DRY)
  4. Fewest elements (remove anything that doesn’t serve the three previous rules)

There are wording variations on those rules, but I got those specific words from this Martin Fowler post. As he notes, “The rules are in priority order, so ‘passes the tests’ takes priority over ‘reveals intention.’”

For more information on Kent Beck’s Four Rules of Software Design, see that link, or this link to the original rules on c2.com.

As a brief note this morning, I’d just like to offer a “thank you” to the people who have purchased my new book, Functional Programming, Simplified, as sales have certainly exceeded my expectations. I first offered the idea to the people at O’Reilly, and when they turned it down I was concerned that maybe they knew something I didn’t. But sales and feedback have all been very positive, so thank you for that.

Functional Programming, Simplified

When I first moved to Colorado I used to read the Denver Post, but for at least the last year I’ve read constant stories about reporting staff being gutted down to a bare-bones skeleton crew. These days I don’t even bother looking at it, which is a shame, because honest journalism is important in a free society.

Today the battle for journalism in Colorado continues, as employees of the Denver Post signed a letter about one of their colleagues being censored in the midst of what appears to be significant profit-taking by the newspaper ownership. (I saw “appears” because there is no mention of profit margins; every for-profit business must have a profit margin to stay in business.)

Update: If you’re interested in this sage, I recommend reading, They’ve Killed a Great Newspaper on westword.com.

The battle for journalism in Colorado (and the Denver Post)

If you ever need to batch-insert a lot of records into a MySQL/MariaDB database using the JDBC PreparedStatement (as in preparedStatement.executeBatch()) be sure to change the MySQL URL to use the rewriteBatchedStatements, as shown here:

"jdbc:mysql://localhost:8889/DATABASE?rewriteBatchedStatements=true"

For a recent project I needed to batch-insert about eleven million records into a MySQL database, and the runtime was about 55 minutes. Once I added rewriteBatchedStatements=true to the MySQL URL, the batch-insert time was reduced down to only three minutes. That one little change made all the difference.

I just received a BrainFood email with this recommendation about this new book about Tiger Woods:

“Even if you don’t like golf, this book is hard to put down. One of my working hypotheses is that people with extreme abilities are not balanced. Attempts to address the imbalance usually cause them to lose some or all of their advantage, which contributed to the outlier success.”

Toger Woods book

There’s probably a well-known psychological theory about this, but I had the same thought many years ago. A recent example for me is that Bobby Petrino was once considered an offensive genius in college football, but since his personal scandal he seems much more human. A “balanced” life seems to take away from the obsession that makes certain people great about what they do.

From an interview with Zen Master Bon Shim, for people who live with a lot of fear, worries, and insecurity:

Question: Do you feel that Zen has helped you?

Zen Master Bon Shim: Yes, yes, tremendously. I was a different person forty years ago. I was always very scared, scared of life, of people, of situations.

An interview with Zen Master Bon Shim

I’ve often wondered about the difference between the terms emptiness and interdependence in Buddhism, and came across this excellent Accidental Buddhist blog post recently, which includes this paragraph about a conversation the Dalai Lama had:

“In the course of one of these conversations, His Holiness tells Victor Chan that for decades he has meditated every day on interconnectedness and emptiness. He said that there are two types of reality. Firstly, there is ‘standard’ reality. He gestures towards a mug of water. When we look at it we see water. When we touch it we feel water. We know it is water. But then he described how we can look at it with ‘ultimate’ reality in which the mug is a combination of particles, atoms, electrons and quarks — none of these particles can be described as ‘a mug’. The term mug is just an every-day label for this collection of particles.”

“The mug has come into existence because of a complex web of causes and conditions. Therefore it does not and could not exist independently. It cannot come into being by itself, of its own volition. It is empty of intrinsic, inherent existence. In other words, empty is another word for interdependent.”

I haven’t worked with JavaScript much in the last few years, and I just learned about this cool console.table output-logging technique, which I just saw on this website, which has several other good JavaScript debugging techniques.

JavaScript console.table logging/debugging output

Dries Buytaert has a good story about how he created the now-defunct Mollom anti-spam service. No word on why they didn’t try to sell the service rather than just shut it down.

“While his brain was probed by the fMRI, Mingyur (a Buddhist monk) followed the instruction to engage compassion. Once again the minds of everyone watching in the control room felt as though they had stopped. The reason: Mingyur’s brain circuitry for empathy rose to an activity level 700 to 800 times greater than it had been in the rest period just before.”

“Such an extreme increase befuddles science; the intensity with which those states were activated in Mingyur’s brain far exceeds any that had ever been seen in ‘normal’ people. The closest resemblance is for epileptic seizures, but those episodes last brief seconds, not for a full minute. And besides, brains are controlled by seizures, in contrast to Mingyur’s display of intentionally controlling his brain activity.”

~ from a story about brainwave tests of a monk in 2002

“If you are neutral in situations of injustice, you have chosen the side of the oppressor.”

~ Desmond Tutu

“If we think we want to get joy for ourselves, we realize that it’s very shortsighted, short-lived. Joy is the reward, really, of seeking to give joy to others. When you show compassion, when you show caring, when you show love to others, do things for others, in a wonderful way you have a deep joy that you can get in no other way.”

“You can’t buy it with money. You can be the richest person on Earth, but if you care only about yourself, I can bet my bottom dollar you will not be happy and joyful. But when you are caring, compassionate, more concerned about the welfare of others than about your own, wonderfully, wonderfully, you suddenly feel a warm glow in your heart, because you have, in fact, wiped the tears from the eyes of another.”

~ Archbishop Desmond Tutu, in The Book of Joy

Hillary Clinton was quoted today as saying that being a “capitalist” probably hurt her with Democratic voters. IMHO, being a stiff, non-authentic politician hurt her with all voters. To me all of her answers seemed rehearsed, rather than authentic, and as a result of appearing disingenuous she inspired no passion in voters.

By contrast, Bernie Sanders seemed to passionately say what he believed, and as a result he fired up a portion of the electoral base, even if his views were a little too far “left” for many voters.

If you’re interested in computer system performance, ExtremeTech has an article titled, CPU utilization is wrong on PCs, and it’s getting worse every year. The original article was written on the same topic by Brendan Gregg in 2017, but the problem has been made worse by the Spectre and Meltdown patches.

Back in June, 1997, Wired magazine wrote an article titled, 101 Ways to Save Apple. These days it looks like Apple might end up owning Wired.

101 Ways to Save Apple

If you’re interested in developing applications for the Google Assistant, there is now a Google Assistant Developer Community Program. From that link: “To support your efforts and celebrate your accomplishments, we put together an ever-improving program with benefits and incentives that are tied to specific milestones.”

I can’t find the original source of this image and product, but I have always liked the “Live Brave” saying, which I first heard on the excellent Eli Stone tv series (which stars Johnny Lee Miller, who may be more well known for the movie Hackers and of course, Elementary).

After trying a lot of different anti-spam modules with Drupal 8, the best thing I’ve ever done to reduce comment spam is to go to the Drupal admin /admin/structure/types/manage/blog/fields URI, click Edit on the Comments field, and then select the “Anonymous posters may not enter their contact information.” Since I chose that option two days ago I’ve only had one spammy comment show up in my approval list. That field gave spammers a simple way to enter a URL, and without it, the spam seems to have dried up.

A really nice man named Ben who worked at the Walmart in Broomfield, Colorado passed away recently. We talked a lot and he told me many good stories over the last few years, including this one.

A story from Ben at the Walmart in Broomfield, Colorado