Modifying mehtod's input parameters

During maintenance of the legacy projects, I sometimes see constructions like: void appendFooter(Report report); or void populate(Data data); I even saw something like this: void populate(Source source, Target target); What is wrong with these statements? They’re using so called output argument. In the examples above, we’re passing a report or data variable, which usually are going to be global variables available in the scope of the whole class. These methods takes them as an argument and modify them....

August 5, 2019 · 2 min · 354 words · Piotr Wittchen

Get rid of the list null-checks

During development of the legacy Java applications, we still have to deal with null. It’s possible to avoid it completly when we’re designing application from the scratch, applying proper code constructions, static code analysis and we’re consistent during code reviews. Nevertheless in majority of the cases we will encounter null in daily projects. We may even expect them in the method inputs and we have to be prepared for it. With the functional programming in Java we can deal with them in quite elegant way, but I often see people are not using features available nowadays....

July 28, 2019 · 2 min · 355 words · Piotr Wittchen

Zen of the Java library release process

In my previous article I published information about publishing JAR/AAR library to the Maven Central Repository. A few steps of that process were automated, but a few of them were still manual. I mean closing and release process which had to be done by manual clicking on the Sonatype website. Fortunately, it’s possible to automate it. In order to do that, I used gradle-nexus-staging-plugin developed by Codearte. Thanks to this plugin I could get rid of the remaining manual steps left in the release process....

June 8, 2019 · 2 min · 367 words · Piotr Wittchen

Publishing a JAR/AAR to the Maven Central

Introduction As a Java/JVM/Android developers we rely on the work of other people through frameworks and libraries. Many of them are open-source. Most of the developers are consumers of such projects. What if we would like to create our own library and distribute it to other developers? We can always create it and share a *.jar or *.aar file with others. Drawback of such solution is the fact that source of distribution may not be trusted....

May 24, 2019 · 5 min · 1045 words · Piotr Wittchen

Creating a fat AAR

I recently wrote a new library called NeuroSky Android SDK. It’s used for writing Android apps using signals of the brain waves received from the NeuroSky MindWave Mobile headsets. Probably I’ll write a separate article about it because it’s quite interesting topic. This library uses ThinkGear library, which is distributed by the NeuroSky as a *.jar file, so I couldn’t use it as a Gradle or Maven dependency in my project and I had to put this *....

October 2, 2018 · 3 min · 470 words · Piotr Wittchen