Coming Up for Air

Chesterton's Fence and the Software Developer

Recently at work, we found an odd scenario with a REST (-ish ;) endpoint from another team: If the request provided a list of, say, 11 IDs in the query string, the system would only return information on the first 10 of them, silently dropping anything over that seemingly odd limit. The initial reaction was of, course, "Well, let’s just increase the limit." To be honest, I had the same reaction, but then I remembered one of my favorite quotes, known as Chesteron’s Fence:

In the matter of reforming things, as distinct from deforming them, there is one plain and simple principle; a principle which will probably be called a paradox. There exists in such a case a certain institution or law; let us say, for the sake of simplicity, a fence or gate erected across a road. The more modern type of reformer goes gaily up to it and says, "I don’t see the use of this; let us clear it away." To which the more intelligent type of reformer will do well to answer: "If you don’t see the use of it, I certainly won’t let you clear it away. Go away and think. Then, when you can come back and tell me that you do see the use of it, I may allow you to destroy it."

— G.K. Chesterton

Chesterton’s context, politics in Great Britain of the 1920s, is, of course, quite different from a software development shop almost 100 years later, but the message is still extremely appropriate: Before you go tearing things down or otherwise changing something you’ve found, you really need to understand not only what you’re changing, but why it was made that way in the first place.

In the case of this REST call, we should ask questions like

  • Are there system load concerns, such as memory or processing time?

  • Are there concerns about the on-the-wire response size?

  • Was there an explicit Product Management decision to set the limit this low for business reasons we don’t see reflected in the code?

And so on. Until we can answer those questions (or reasonably rule them out as relevant), we need to be very hesitant in making the change. Once we’ve explained the original developer(s) built that fence, then we can talk about ripping it down.

Getting JavaFX ListViews to Honor Container Width

I recently struggled trying to text in a JavaFX ListView to wrap inside the container like I asked it to, rather than extend (and disappear) past the boundaries of the container. After some discussion on Twitter and a bit of Googling, I found an answer that I thought I’d share here to, perhaps, save someone some time.

Compiling for Java 8 and Java 9

In a project I’m working on for my book, I need to share classes between two applications. One, an Android project, requires Java 8. The other, a desktop JavaFX application, needs to run under Java 9, complete with module support. The problem with this is that the Maven tooling isn’t quite ready for Java 9, so it’s not as simple as I would like. I have, however, found a solution that seems to work.

JavaFX Frameworks

In my work on my book, I’ve spent quite a bit of time with JavaFX. In the chapter I just submitted, I wrote the application using the NetBeans RCP, which I think is a great piece of software. My only "complaint", I think, is more of a philosophical one more than a technical one, and even stating it that way is probably really over-selling it: for the most part, to use the RCP is to use Swing. Sure, you can use JavaFX in the application, but it seems you have to hold your mouth just right to get two-way data flow working. Possible, but it seems like a bit of work.

At any rate, while casting around The Tubes to track down advice on how to solve one problem or another, I ran across a couple of more modern application frameworks that look really promising, Drombler FX and the Dolphin Platform. Both look pretty slick, but the former seems to be backed by "only one guy" and might be a bit slow moving, while Dolphin is backed by Canoo and, more specifically, Michael Heinrichs, Hendrik Ebbers, Dierk König.

Once I finish this book and have more time to play with shiny new things, I need to give both of these a spin.

I should probably note, though, that there’s nothing really wrong with the NetBeans RCP in any real technical sense (beyond the 'no software is perfect' notion). I just like shiny things. I did, though, successfully create my RCP app and found the experience to be quite nice. If you need a desktop application, you should definitely check out the RCP.

Merry Christmas, 2016

Shepherds following the star. Source:

In the same region there were some shepherds staying out in the fields and keeping watch over their flock by night. And an angel of the Lord suddenly stood before them, and the glory of the Lord shone around them; and they were terribly frightened. But the angel said to them, "Do not be afraid; for behold, I bring you good news of great joy which will be for all the people; for today in the city of David there has been born for you a Savior, who is Christ the Lord. This will be a sign for you: you will find a baby wrapped in cloths and lying in a manger." And suddenly there appeared with the angel a multitude of the heavenly host praising God and saying,

"Glory to God in the highest,
        And on earth peace among men with whom He is pleased."

NetBeans 9 Nightlies

Perhaps I’m a bit of a glutton for punishment, but I have an odd addiction to nightly builds. In working on this book, I need to use NetBeans 9, which, of course, is not out yet. They are, however, publishing nightly builds. Being a command line guy at heart, I’d prefer not to have to go to the download page every time, so I did what any good geek would do: I wrote a script. It’s not pretty, and it’s not very fault tolerant, but it seems to work well enough. If you’re a fellow addict, here you go:


VERS=`curl -s | grep BOUNCER_PRODUCT_PREFIX | cut -f 2 -d \"`

cd ~/Downloads
if [ ! -e $FILE ] ; then
    if [ -e $FILE ] ; then
        rm -rf netbeans
        unzip $FILE

Call Me Crazy, But I'm Writing a Book

A few weeks ago, I was approached by an acquisition editor with Packt Publishing, asking if I might be interested in working on a book with them. Long story short, I signed the paper work and started working on the title Java 9 Blueprints. Books in Packt’s Blueprints series offer a different project in each chapter, showing each is built, explaining the technologies used, etc. So far, it feels a lot like what I aim for in my blog posts, only longer. The target release is Q1 of next year. I have a lot of work ahead of me. :)

Android App Development Quandary

I have a grand total of one Android application in the Play Store, Cub Tracker. It serves two functions for me: it helps me manage my sons' Cub Scout den, and it gives me a means for experimentation in the mobile realm. For the most part, it has done well for me on both counts for the past few years. I am currently faced with an issue of new functionality (which is mostly irrelevant for this discussion) that has brought up a question in the realm of experimentation. This post is a discussion of my options which will allow me to think out loud, if you will, as well as getting (I hope) some feedback on my options.


Sample quote

Quote source