Recently I was conducting an evaluation of several different databases for a messaging workload. While benchmarking Apache Cassandra, I noticed unusual patterns in performance metrics. I followed these clues and eventually found some major thread-pool design questions and a potential 18x performance gain realizable on Windows.
Continue readingGood names help — can ‘Foo’ hurt?
Naming is the most important part of design. Concise yet meaningful names are hugely important.
One of my top recommendations to improve legacy code, is to improve & clarify naming. Names should be short and sweet, yet meaningful. For example — Customer.Name.
Continue readingHow to handle InterruptedException
Blocking methods in Java often declare they may throw InterruptedException. How should we handle it?
In this article, Brian Goetz explains why rethrowing it is usually the most correct approach.
How to write good Wiki documentation
Documentation is important. All of us have experienced the challenge of finding the documentation we need, and most of us have struggled to try and write well. But it need not be so difficult.
Following is an easy approach plus a few guidelines that will help to produce & maintain real, usable, documentation easily.
Bad auto-completions in Eclipse
Eclipse recently has suffered increasing numbers of questionable autocompletions — sometimes auto-wrongly replacing perfectly good code typed by the developer.
While there might be a few underlying issues, I found replacing “map.put()” with “map.compute()” particularly annoying and went to investigate. Here’s the solution.
HTTP Status Reason broken in Tomcat 9
Just today, I found the “amusing” fact that Tomcat server developers have taken it upon themselves to delete support for the HTTP Status Reason.
Think “200 OK” or “404 Not Found”. Even for applications sending a reason & clients expecting it, Tomcat is coded to explicitly drop the value — sending just a bald 200 or 404.
Unsurprisingly for those with the slightest knowledge of protocol compatibility, this is now breaking clients in the wild.
How to group SQL records into a single Spark data item
When processing SQL data in Spark, sometimes single rows are not the right unit — your calculation may need a collection or group of records as input.
This post shows how to group SQL data for use in Spark. Continue reading
Conditional breakpoints on multi-threaded code failing in Eclipse?
Today I got a very unusual error while trying to debug the DeepLearning4J framework.
Conditional breakpoint encountered runtime exception. Reason: java.lang.InternalError: Got MethodID of ReferenceType that is not a member of the ReferenceType occured retrieving stack frames.
How to find the Git commit introducing a given change into a file
Continuing last month’s theme of searching Git history — here we look at how to find the source of changes, even after other people have worked on (or reformatted) the area in question.
The question: which commit actually introduced a given string into the file? Continue reading
Why inheritance never made any sense
Great post on inheritance from the Sicpers blog, and why — as a concept — it often fails in OO languages such as Java.
This blog post can help you understand why:
- “Cat and Dog extend Animal” is poor use of OO.
- “Square extends Rectangle” is poor use of OO.
From my own experience, I’ve moved to primarily using inheritance in only two ways: Continue reading