The old advice is not valid anymore

Since I just read again the advice to always use StringBuilder instead of String concatenation, we will close this chapter once and for all, right now!

Long story short, using StringBuilder instead of String concatenation is just an old myth. In most cases, it is not true anymore. You can safely do a String1 + String2 in your code, and you won’t notice any difference. There are only a few special cases where a StringBuilder is a must.

Continue reading

How to bring the mouse back

Logitech’s universal USB receiver supports Linux but when the pairing to the device is lost, one cannot easily repair that without Windows or Mac. The project Solaar fixes that. Follow the steps to bring your mouse or keyboard back to live on Linux. It fixed my Logitech M650 L issue. Thanks!

Continue reading

Too little to make a difference

Recently I saw some benchmarks[1] about converting int to String and of course, I got curious. This post shows that the results are legit, but have to be taken with a grain of salt.

While the benchmarking started out quite normally, it turned into an investigation of accuracy and meaning. What goes into the result, does the difference make sense, and where does all that noise come from? How much should we care?

At the end, you have learned that time is relative, memory expensive, and a small difference not really worth the effort. Or in English: Don’t believe any random benchmark you just found on the Internet!

Continue reading

Make sure, you benchmark correctly

Recently, I read posts about some Java loop benchmarks. I am not entirely sure, if the outcome and advise given is correct, so here is my version. I don’t want to blame any of the other tests for being incorrect, but judge for yourself.

Spoiler alert: The type of loop might or might not make a difference and overall, it is rather not the loop that makes the difference but all the other code that leads to conditions that might make some loops run faster, despite the same work/task. And yes, parallelStream() is mostly a bad idea.

This article also will give you a brief glimpse into benchmarking as well as teach you, that most benchmarks are wrong or better, the benchmark is right but the conclusions are wrong. Bring some time, the article got longer than expected. The article is not going to teach you how to benchmark with JMH, how the JVM works, or how that all is executed by the CPU. It might just overwhelm you with facts. But hey, it is not supposed to be the last article on that subject.

Continue reading

Why you should stop using that term and avoid thinking that way

When people talk about test cases, they often divide them into positive and negative test cases. This article will make the case for abandoning these terms entirely, especially negative test cases. Why is that term wrong after all? Why do people, who use that term often, come up with horrible test cases? Why don’t we gain anything when people think about negative test case in the sense of the most popular definitions?

This article discusses all of that and gives you material for your next terminology battle with your fellow co-workers. It will also, hopefully, motivate you to approach the search for test case differently. And, last but not least, it is all highly subjective and my personal opinion.

Continue reading

Something about me and this new blog

Introduction

Welcome to my new blog. In comparison to my old, which is offline because PHP was updated by my hoster and the blog software I used (Nucleus) is not longer maintained, I am going with a static version this time.

Static website hosting has a lot of advantages and a few disadvantages:

  • You don’t depend on provided version of software such as PHP at your hoster.

  • The source is mostly text and easy to migrate if needed.

  • Your data can (and should) live in a repository such as GIT.

  • Almost no security issues.

  • You cannot easily have dynamic content of any kind, such as comments or dynamic image resizing.

  • A site search is hard to integrate and requires external services, hence you won’t find a search here at the moment.

Sure, I could have hosted all that myself, but who wants to run outdated PHP and PHP-based software? That is a security nightmare.

I decide to go with JBake as my content generator despite its slow release cycle and a lack of features. The main reason for choosing it, was the proper support of AsciiDoc as main content language in contrast to pure HTML or Markdown that is used by others. Secondly, it is written in Java, which enables me to make changes and fixes more quickly. It also gives me the opportunity to just fork it and run with my own version from now on, if needed.

One might argue, why to choose AsciiDoc? I am planning to write a book and the AsciiDoc toolchain for that is nice and that gives me the opportunity to learn about it. Also, there is an editor AsciiDoc FX for that.

I carefully styled the AsciiDoc content and you can see that here. This is not full support of every possible AsciiDoc feature, but pretty much enough for the moment. I will certainly adjust that styling occasionally to improve readability and overall layout.

About the Content

You will mostly find content that relates to my work, despite this blog being a private one. This is my current idea about the content:

  • Performance related topics, such as web or Java performance, and performance testing

  • General Java topics

  • Testing and quality assurance

  • Interesting links and general IT support stuff

More About The Blog

The entire blog is open source in the sense of the design, theme, template code, and even the content. You find all the relevant information in the about section. Please keep in mind, that my content is CC-BY-4.0 licensed but that does not mean you can just copy everything and call it your own! Nope, it is still mine but you can use it and extend it. But you have to give me credit.

Shows and tests every possible content snippet.

The following article will demonstrate all content that can be created by using AsciiDoc and JBake. We can even put AsciiDoc in the header of an article. For more demo stuff, look under the tag demo.

That works for a paragraph too. Up to the first headline.

This is also a test post for styling everything nicely and correctly. If you cannot see it here, it is likely that there has not been a style applied yet.

Continue reading

This is another feature demo post.

First headline

This article has no preamble but a flag that indicates that we want to always see all content, even on listing pages.

Another headline

More nice text and so on.

This is another feature demo post.

This is the preamble that turns into a TL’DR. So put some love into this text to ensure it is a true summary.

Headline 1

This article has a preamble and a flag that indicates that we want to always see its full beauty even on the listing page.

Headline 2

Nice data and text.

@Test
public void test()
{
    public int max(final int a, final int b)
    {
        // inline comment and some < > &
        return a > b ? a : b;
    }
}