Resurrection In Coding - Part2

In this post my learning journey #LearnToCode #CodingChallenge continues. I like the style of a daily journal very much, so I also kept it for this post.

June 2019

Monday 3

  • Java Learning:
    • Code comments is an important topic. But when and how to write them? Here a provocative post on it. Until now, I’ve written comments like a fool in my code. So I guess from now on it might be good to think twice if a comment is really necessary or not. A clear, precise name for a var, method or class might be the better way to go ;)

Tuesday 4

  • Java Learning:
    • A hard part to understand in Java for me are static classes. What are they? When are they allowed? Why are they even meaningful to write?
      • Static classes can only be created as inner (nested) classes as part of an outer class. They are used to group classes together. We don't need an instance of the outer class to create an object of a static inner class.
      • It is also possible to create a non-static inner class. In that case, we need a reference to an object of the enclosing outer class to instantiate it.
    • Spotted another free online Java course. I guess I have another challenger to compare with! First impression: looks like this is an older one as it is based on Java7.
  • General Learning:
    • What is DDL?
      • DDL stands for Data Definition Language and is one of four categories of the database language SQL. The DDL reflects the SQL commands which can be used to define the database schema (see here)

Wednesday 5

  • Java Learning:
    • Udemy course - composition:
      * Is basically creating objects within objects.
      * As a general rule: prefer composition over inheritance when possible as it give you more flexibility. But of course it depends on the solution you want to achieve.

Thursday 6

  • Java Learning:
    • Testing with JUnit5: in direct contrast to failed assertions (e.g. assertTrue(boolean condition), failed assumptions (e.g. assumeTrue(boolean assumption) do not result in a test failure; rather, a failed assumption results in a test being aborted.
    • Wait, how was this again? When shall I use abstract classes and when interfaces?
    • Today I went through the chapter 7c of Angie’s free Java course. My main learning from it: one can use the Scanner class to easily obtain a user input of the primitive types like int, double, strings, etc.

Friday 7

Sunday 9

  • Java Learning:
    • Day of the week is an easy little programming exercise at the end of Chapter7c of Angie's programming course. But how do I tackle an exercise like this? The first thing, before modelling any specific solution, I was thinking: How am I going to handle invalid user input? Funny isn't it? We tester have this wonderful serendipity of immediately asking ourselves: What can go wrong in the first place? So this is what I ended up with:
try {
     int yourWeekDay = input.nextInt() - 1;
     System.out.println("Your weekday is: " + weekDays.get(yourWeekDay));
} catch (InputMismatchException | IndexOutOfBoundsException e) {
    System.out.println("Only valid weekdays numbers from 1-7 are allowed! (Error message: " + e.toString() + ")");
} finally {

The rest around it, you have to imagine yourself ;)
Finally what? The finally block is a key tool for preventing resource leaks. When closing a file or otherwise recovering resources, place the code in a finally block to ensure that resource is always recovered!

Monday 10

  • Java Learning:
    • Angie's Chapter 8a Data Types
      • Dynamically typed programming languages:
           * Statically typed programming languages such as Java expect that the variables are to be declared before they can be assigned values because the data type is checked at compile time.
           * From Java 10 onwards, one can use _var_ for declaring local variables. Java will then infer the data type based on what is assigned to the variable. This is called _type inference_. But there are a few limitations to it:
           	* This works only for local variables
                   * A variable must be initialised at the time of declaration
               * This cannot be used for method/constructor parameters or return types

Tuesday 11

  • Java Learning:
    • Property based testing in Java with jqwik. Now this sounds interesting, but how do I am going to experiment with this?

Friday 14

  • General Learning:
  • Java Learning:
    • Today I had the pleasure doing a small code review of a few lines of code which have the purpose, to cache some session keys for local testing in our test framework. For doing that caching, the developer was using FileInputStream, ObjectInputStream, FileOutputStream and ObjectOutputStream. Which of course lead me finally searching for a documentation on it. This Java I/O Tutorial explains quite deeply how Input and Output operations in Java work.    * In our current team structure we life the whole team approach of doing code reviews. This means, that everyone is invited to give feedback on a PR. I like that, because you can learn so much from reading and reviewing other peoples code. Sometimes it is just a small typo I spot and sometimes it is a question which triggers some further discussions. And by the end of the day I may have crawled the web once more in search for enlightenment. What a great way of learning!
      • Inheritance is used to get type matching and composition is used to get the behaviour (composing objects together aka object composition)!    * With the Java Instant, one can create an object which e.g. holds the exact moment in time just right now:
Instant now =;

Sunday 16

  • Java Learning:
    • Functional Programming in Java? How is that possible? Here an intro into its basics.
      • Bitwise operators in Java
      • I took a step back and had a look the basic operators. Here another tutorial on it.
      • TODO: I don't quite understand the Bitwise Operators yet. So frustrating :(
      • Angie's course Chapter8a:   * The 8 primitive data types: as soon we are using them as local variables, they have to be initialised! When using them as class variables and aren't initialised explicitly, they get a default value assigned. All the primitive data types can also be expressed as Objects. These objects are known as wrapper classes. Wrapper classes have the advantage that they provide some ready made methods that can be used to be called on the objects. While primitive data types don't provide that.

Tuesday 17

  • Java Learning
    • Just discovered a new free Java IDE named BlueJ which seems to be made especially for beginners. Have to try it one day.
      • A great collection of the most popular IntelliJ Themes 2019 can be found here.
      • JDK12: the new switch expressions look quite sexy to me ;)
  • General Learning:

Wednesday 18

  • Java Learning
    • Modularity in Java
    • Today we experimented with migrating our automation framework from JDK8 to JDK11. But how does one approach such a thing when you have (almost) no idea where to start? Luckily we found this experience report.    *  mvn –T4 test-compile, mvn –T4 clean install will execute these maven commands on 4 threads. With that one can speed up the whole process a bit.

Thursday 19 / Friday 20

  • Java Learning
    • Shading will brake
    • Unit Tests are fundamental. I know you know that. As I mentioned yesterday, we (my pair programming mate and I) are experimenting with migrating our automation framework from Java8 to Java11. This is not an easy task because we have to take care of quite a lot of dependencies and plugins. Finally we have to make sure, that all the implemented checks are still working in our multi module maven project. Here a short list of our learnings so far:
      * A must have in your pom.xml: the version-maven-plugin
      • Don’t just update all the dependencies to the latest version for heavens sake. Consider what for in your code you are using them. Does your code still work "as before" when you upgrade a dependency?
        • Configure the maven-compiler plugin as follows:

Configure the maven-dependency-plugin as follows:


We have to override the dependency-analyser here, as the dependency-plugin v3.1.1 does contain an older version of it. As soon a next version of the dependency-plugin contains an analyser version >= 1.11.1, we can remove the override again. (The issue is that in order to analyse class files (bytecode) generated by Java11, the dependency-analyser needs to support ASM7. Currently only the dependency-analiser v1.11.1 contains a compile dependency to ASM7.)

  • Java11 migration guide - an experience report
  • It's time to migrate
  • General Learning:
    • General Learning:
      • JSON serialize and desirialize:
        • Serialize an object into a byte string
        • Desirialize a byte string back into an object

Sunday 23

  • Java Learning:
    • Angie's course - Chapter8a: ending this chapter with the Wrapper classes. Each primitive data type (char, byte, short, long, float, double, boolean) has a corresponding wrapper class. An object of a wrapper class wraps/contains a field where the primitive data type is stored (source).

Wednesday 26

  • Java Learning:
    • At the time we still have some issues with our migration : it seems that the either the newest version of Lombok or the newest version of jdbi3 which we use, are causing some problems.
    • How can one force an update of maven dependencies which are versioned like this: 81.0-SNAPSHOT? ( I have to add here that this specific dependencies are internal and only major versions of it are incremented. Minor versions are alway released as 81.0-SNAPSHOT)   * Add the -U option at the end of a maven command: mvn clean install –U (force update of dependencies) source
    • Now this is a nice IntelliJ theme!
  • General Learning:
    • Have you ever wanted to make a speedtest (ping time, download/upload rate) from a linux terminal? Here is a way to do that.

Friday 28

  • Java Learning:
    • What exactly is the dependency scope in maven again?
      • Today I have the feeling that I didn’t achieved much at work. All the days my pair-programming mate and I where hunting down some test data. Test data management is quite a pain in our complex system landscape and we can’t do much in order to improve this situation (long story short). To finish the week off, I thought there must be at least something cool in for us. As Angie wrote few days ago a blog post about the ApprovalTests lib, I had the idea of integrating it also in our automation framework. First thing I noticed was, that ApprovalTest for Java seems not to be compatible with JUnit5. Oh no, what a bummer! Well I thought, let’s give it anyway a try. And see, it actually worked! But only with the simple @Test annotation. It doesn’t work with other more advanced JUnit5 features like e.g. @ParametrizedTest. After all, I’m happy that we achieved at least something valuable this week. PR is in review by the way ;) Cheers!

Saturday 29

Sunday 30

  • Java Learning:
    • I'm currently struggling a bit in coming up with a next coding practice kata. There is so much on my plate to learn - taking a deep breath. I'm overwhelmed by the fact that there is an incredible amount of great resources to #LearnToCode out in the web these days. Maybe Conway's Game Of Life might be a challenging exercise to try next?

July 2019

Tuesday 2

Thursday 4

Tuesday 16

Tuesday 23

  • Java Learning :
    • Lombok (v1.18.8) and JDK11: when using the @Data annotation on a nested class, this class has to be static in order that Lombok is able add a default constructor. (doc)
    • An Abstract class behaves as a template for other classes and thus must be extended. It cannot be instantiated and contain static data.
    • A static inner class is a class whose methods and variables can be called without creating an instance of that class. Static means it is initialized once. Only nested classes can be static! (doc)
    • A final class cannot be extended (subclassed).
    • Once I have migrated our automation framework from Java 8 to 11 (which probably will be soon), I can finally use some of the new cool features! But I won’t be able to use Switch Expression yet (as Angie is showing in her blog post) because this is part of Java 12.

Wednesday 24

  • General Learning :
    • When IntelliJ all of a sudden can’t resolve your dependencies anymore, it is probably because your artifactory (if you use one) is down. I learn this the hard way today and spend some hours searching for the cause of that.
  • Java Learning:
    • If you are using maven and are behind a cop proxy and using your own maven artifactory, it might be that you have to declare explicitly a dependency for the junit-platform-launcher in your pom. Otherwise IntelliJ probably won’t be able to download it directly from At least we have to do that in our cop environment.
    • Here our learnings so far from migration our automation framework from Java 8 to 11:
      • Nested classes have to be static in order that lombok is able to create a constructor.
      • A new release tag has to be added to the maven.compiler.plugin for JKD11.
      • The dependency-analyzer has to be overriden with a newer version in the dependency-plugin (can be reverted once the plugin contains a newer version of the analyzer).
      • The jdk in the Jenkinsfile has to be changed to Java 11.
      • Several updates of dependencies are necessary.
      • The junit-platform-launcher has to be explicitly defined in each module. As we are working behind a proxy, IntelliJ isn't capable to download it directly from the official maven repo.
      • Here a few blog posts about migration experiences form Java 8 to 11:

Thursday 25

  • Java Learning:
    • The new IntelliJ version 2019.2 is out! They have add quite a lot of new interesting things. Some great addition are of course only at your service if you buy an Ultimate license. You can get yearly license for EUR149 or just go for the all products pack for EUR249 ;). For more check here
    • Today I merged my approved PR for the migration of our test automation framework from Java 8 to Java 11 into master. I’m now looking forward to use some of the new treasures of Java 11!

Friday 26

Monday 29

  • Java Learning:
    •   JUnit5 : the junit-platform-launcher is a module usually used by the IDE to execute the JUnit tests from within the IDE itself. It isn’t needed by Maven, so IntelliJ doesn’t use the maven settings to download it, but the defined remote jar repositories in IntelliJ. Unfortunately this doesn’t work when you add your password protected companies artifactory there, because you can’t add credentials to access it. So the only possibility you have is to let your companies proxy pass IntelliJ's download request or add the junit-platform-launcher dependency explicitly to your projects/modules pom.
    • I always have asked myself: Why do we actually need the special null value in Java? Here an answer
    • One very handing thing when working with Java in IntelliJ is, that you can open a compiled .class file and IntelliJ will decompile it for you. With that you can have a look what exactly the java compiler did to your original implementation
    • Exceptions in Java: throw vs throws
      • Checked exceptions are exceptions that are checked at compile time. This means that you must handle this exception. Otherwise the method must specify an exception by throwing it to the caller (with the throws keyword) down the call stack.
      • As the opposite: unchecked exception are exceptions that are checked at runtime.
  • General Learning:

Tuesday 30

  • General Learning:
    • This is by far the best experience report I have read about mob programming so far.
  • Java Learning
    • Getting to the point: Is-A and Has-A relationship in Java
      • Used together, composition and interfaces make a very powerful design tool!
    • Now that I have migrate our projects automation framework form JDK8 to 11, I’m experimenting with using some of the new features from Java9,10 and 11.
      • Creating collections (Java9): using List.of() instead of Arrrays.asList() for creating a list of items. But be aware that the downside of using of() is, that the collection is immutable: sorting, adding and removing of elements at a later state, isn’t possible!
      • Local variables(Java10): type inference allows us to declare them using the new reserved word var. A variable which is using var must be initialised at time of declaration. This is because Java is going to infer the type based on the assignment at compile time.

August 2019

Friday 2

  • Java Learning :

    • What is actually the difference between the “commercial” Oracle JDK and the free OpenJDK?
      • Here a nice summary of it. TL;DR: Oracle JDK and OpenJDK builds are essentially identical from Java 11 onward. But what about: Oracle JDK provides much better performance compared to the OpenJDK in terms of responsiveness and JVM performance. Is that an issue to consider? I don’t know…
      • Oracle vs OpenJDK.
    • Doing Chapter9c: Use the @Override to annotate an overriding method. With this you tell Java that your intention is to override that particular method and Java will warn you if you don't do it properly. Without it, Java doesn’t check and warn you.
    • Doing even more chapters: 9d, 10, 11a
      • Polymorphism: An object can have a superclass as its type and be an instance of a subclass. But can only access methods of its type and NOT their instance!
  • General Learning :

    • Git tags are used to mark a certain commit in a Git branch (usually on the master branch). In other words, a Git tag is nothing else as a branch with one commit on it which can’t be changed. Tags are used to release a particular version of the software.
    • Java vs Kotlin

Monday 5

Wednesday 7

  • Java Learning :
    • Conversation on a PR:
      • Me: You can use .equals() instead of == (which is for address comparison) to compare the content of the number objects.
      • Dev: You're partially right... Here, it works because all values of the POS entry mode are between 0 and 99, and the Integer class has a cache of all integers between -126 and +127. Consequently, there's only one instance of all those Integer values in the JVM, so == works. Nevertheless, I'll change it to .equals() as it's a more generic case. In fact, I'll change it from Integer.valueOf to Integer.parseInt, so I'll have an int instead and keep the == 😉
    • Me immediately looking for some resources on this:
    • The internal cache of integers
    • Internal caching in wrapper classes
    • JRebel
    • Netty is a framework for building asynchronous event-driven network application
  • General Learning:

Thursday 8

  • General Learning
    • Oh, what is that katacoda!
      • At work, our backbone systems are running on HPE Nonstop machines. TACL is the scripting programming language used on those systems. Today I had the opportunity to use TACL for the very first time. Felt somehow weird – I guess it’s the programming guide which is almost ancient ;)

Friday 9

  • Java Learning:
* But what is [Feign]( Feign is a framework for writing java clients which can call HTTP [REST(ful) and SOAP(ful)]( services.
* [Intro to Feign](
* [Writing a Java HTTP client with Feign](
* [Feign client to call another microservice](
* [REST API Testing with Feign]( / Same blog post on [BlazeMeter](

Saturday 10

  • Java Learning
    • Hystrix is a latency and fault tolerance library developed by Netflix. The project has gone in maintenance mode, which means that Netflix will no longer actively review issues, merge PRs and release new versions of Hystrix. Instead of Hystrix, one should use active projects like resilience4j

Tuesday 13

Wednesday 14

Thursday 15

  • Java Learning
    • Collections aka data structures is a core framework in Java and is located inside the java.util package.
      • Set (interface) is and unordered list of unique objects (duplicate objects won’t be added). Because Set is an interface, it can’t be instantiated, but of course it can be an objects type. Specific implementations are HashSet, LinkedHashSet, TreeSet.
      • List (interface) is an ordered list of objects. Each object can be accessed by its index position. Specific implementation are ArrayList, LinkedList, Vector and Stack.
      • Queues (interface) hold object to be processed. The objects are ordered and the queue can contain duplicates. Specific implementations are LinkedList. The objects are processed according to the FIFO principle.
      • Map stores key/value pairs. Specific implementations are HashMap, TreeMap and LinkedHashMap. It does not inherit from the Collection interface!
  • General Learning
    • DBeaver is a free universal tool for accessing relational databases. There is also a EE version of it available which supports NoSQL databases. It looks to me, as the UI is build using Eclipse RCP.

Friday 16

  • Java Learning
    • MapStruct is a framework to map Java Beans.
    • An Entity Mapping Solution
    • Collections have a forEach() method. With it and a lambda expression (x -> System.out.println(x)), one can iterate over a collection.
      • Or for with two parameters (k,v) -> System.out.println(“Fruit: “ + k + ”, Calories: “ + V)
      • The shortcut is: forEach(System.out::println) (double colon operator)
      • Of course one can still use the advanced for loop: for(String item: fruit){}

Sunday 18

  • General Learning:
    • TestProject promise is it, to be a codeless test automation platform. Which actually means that it is hosted in the cloud... and what about my test data? Am I going to store it in the cloud? Somewhere out there? Nah.... doesn't really convince me at a first glance. But yeah, maybe I'll give it a try some day.

Monday 19

  • Java Learning
    • Today I’ve received a .patch file to a java class I implemented from a developer on my PR I did last week. I haven’t seen such a file before, so I was first a bit perplexed what I should do with it. But what do you do when you are desperate? Ask the person who created the file and/or google

Tuesday 20

Wednesday 21

Thursday 22

  • Java learning
    • Enum compareTo(Enum e) returns:
      • 0 when the ordinal values are equal
      • A positive value if the invoking enum constant has an ordinal value greater than
      • A negative value if the invoking enum constant has an ordinal value less than
    • Yes, why should one use Object.requiresNotNull() when anyway a NullPointerException is thrown?
      • The major advantages using it are:
        • Controlled behaviour
        • Easier debugging - because you throw up in the context of the object creation. At a point in time where you have a certain chance that your logs/traces tell you what went wrong!
        • The true power of this idea unfolds in conjunction with final fields. Because now any other code in your class can safely assume that bar isn't null - and thus you do not need any if (bar == null) checks in other places!
  • General learning
    • Today I learned once more how helpful git cherry picking is. On my own local branch A, I mistakenly amended some code, which I was working on, to a commit which its changes were already on master. But wait, I don't want to have a different commit with the same commit message on the master at the end! What did I do to solve this? I created a new branch B from master and cherry picked that specific amended commit from my old branch A. With that I got back the same initial state in my working directory (on my new branch B) which I have had on my old branch B before I did the git commit –amend ;)

Friday 23

  • Java Learning
    • Functional programming in Java was introduced with the JDK8. With lambda expressions, one can directly write a so called anonymous function without the need to create a class with a single method in it.
    • Consumer interface
    • Java functional interfaces
    • Another code review done! Today I dignified a developer on some test code he wrote. But what did he actually do? Was it really worth it? Oh yes, it was worth it!. It is very important to me, to also give positive feedback on things I am reviewing. Not only it is supporting and makes someone happy, no, it is for the whole ecosystem I’m working in. Seeing people cheering for each other has incredible power. Being innovative, brave, come up with new ideas, experiment, learn, improve and much more. Here is what he implemented:
      • An abstract class with an abstract method called runTest()
      • In the abstract class a few tests with the test data setup which then are calling the runTest()
      • The test data is then feed in via parameters and a lambda expression.
      • For the lambda expression, one of the parameters takes a Consumer
      • Subclasses with the concrete implementations of the runTest()

Saturday 24

  • Java Learning
    • I know, the pathway in becoming an outstanding Java Developer is long. Here are 10 Tips for getting there.
      • Building Progressive Web Apps with Java? What? How? I always thought that this is only possible with JavaScript. But I was wrong, because there is vaadin}>!

Monday 26

  • Java Learning :
    • JShell (from JDK11 onwards) offers a great way to experimenting with some code pieces.
  • General Learning:
    • Two weeks ago I implemented a very small client (just one class) for querying a RESTful HTTP API. What I didn’t noticed till today is, that the service I am querying with it, is running in Consul. Consul is a data center solution where one can connect and configure applications/services. Consul itself provides a RESTful HTTP API which can perform basic CRUD operations on its nodes, services and more. As I am CRUDing the Key/Value Store of a service, I wasn’t aware that it is important to have a look at the consistency modes when your service which you’re querying, is running on multiple nodes. So in order to guarantee that an KV pair is fully updated on all the service nodes, I added the ?consistent parameter to the each PUT and DELETE request.

Friday 30

September 2019

Monday 2

  • General Learning
    • Bitbucket : as soon one has created a PR in Bitbucket, it is possible to rebase directly from within Bitbucket the branch onto the state of the master branch!
  • Java Learning
    • The comparison strategy with comparator and comparable
    • Writing good and valuable automation code is hard. There are so many factors where you can fail. Here my steps I usually take:
      • Facilitating a three amigos session
      • Creating an example map of story, acceptance criteria and examples
      • Creating/organizing test data (which is very crucial in my context)
      • Discussing the flow of the tests once more with an experienced exploratory tester
      • Implementing the tests
      • Running static code analysis
      • Testing/executing the tests on the DEV and INT environment
      • Checking the console log output
      • Checking the logs in Kibana (DEV/INT)
      • Creating a PR
      • Improve things according to reviews/feedbacks
      • Testing the tests again
      • Check the logs
      • Interactive rebase of my branch (git rebase -i HEAD~3)
      • Rebasing onto the state of master (if my branch has diverged)
      • Merging (Fast forward --only) into master in Bitbucket

Tuesday 3

  • General learning
    * [Ansible Tutorial for beginners](
    * Mnemonics are all present in our daily life. They help us to remember and to recall things..
    	* DRY (that is the only coding mnemonic I can remember so far. Is there another source of information?)
    * [Caution: Rebasing deletes Merge commits!]( Oh but how is this even possible?
    When you locally merge your feature branch into e.g. the develop branch (Git flow branching strategy), this will create a Merge commit on your local develop branch. You then notice (because you have done a git fetch) that on the origin/develop are two new incoming commit. You now either can git merge these two new commit into your local develop branch (this will also create a Merge commit), or you can use git rebase. Git rebase will remove the introduced Merge commit and put a copy of the original commit(s) of your feature branch into the develop branch! So none of your files will be lost, just the Merge commit! To prevent that in the first place use: git fetch origin & git rebase –p (-preserve-merges) origin/develop.
    * [Static site generators - I love it!]( (P.S: I use Hexo)

Wednesday 4

  • General learning
    * What is the difference between a line feed (lf) and carriage return (crlf)? A line feed means moving one line forward. The code for it is ``\n``. A carriage return means moving the cursor to the beginning of the line. The code for it is ``\r``.
    Windows still uses the combination of both as \n\r in files. Unix systems (Linux, macOS) uses the \n. The separation comes from typewriter times, when you turned the wheel to move the paper to change the line n and moved the carriage r to restart typing on the beginning of a line. This was two steps. Git knows how to handle this, you just have to configure it according to the system you use. git config –global core.autocrlf true/input/false (see here).
    * The core.safecrlf in Git is used to make Git check if converting CRLF is reversible when end-of-line conversion is active. Git will verify if a command modifies a file in the work tree either directly or indirectly. For example, committing a file followed by checking out the same file should yield the original file in the work tree. If this is not the case for the current setting of core.autocrlf, git will reject the file.
    The variable can be set to "warn", in which case Git will then only warn about an irreversible conversion but continue the operation, or to “false” where Git won’t do that check at all.

Thursday 5

Friday 6

Monday 9

Tuesday 10

  • Kotlin Learning (CH Open Workshop Days)
    • General
      • The workhop material can be found here
      • Kotlin is developed by Jetbrains which is a company based in Tschechien.
      • 2011 July: announcement of Kotlin
      • 2017 January: Kotlin support for Spring Framework 5.0
      • 2019 May: "Kotlin-first" on Android
      • Motivation
      • Fast, Easy to Learn, Easy to Use
      • Powerful
      • Compiles as fast as Java
      • JVM / Java interoperability
      • Drive Sales of IntelliJ ;-)
      • Packages syntax is the same
      • Functions in Java have to belong to a class
      • Functions in Kotlin don't have to belong to a class
      • The return type void is called Unit
      • e.g. variable var b = 2L // Long inferred
      • val keyword is like var in Java    * Strings val can be accessed directly with ${varName}
      • println("min($i,$j) = ${min(i,j)}")
      • var r = java.util.Random() // no new needed!
      • if (i<j) i else j instead of if (i<j : ?)
      • Loop: for (item in items){println(i)}
      • Generics is written Any
      • Range Expression: for(i in 0..100){println(i)}
      • Step & Downwards: for (i in 0..100 step 2){}
      • Switch statement is when (i){0, 1 -> println("0...1"}
      • Sandbox:
      • Kotlin is a Null-Safe language.
      • private var cookie: String // Must be initialised
      • private var cookie: String? = null // initialise explicitely
      • return cookie!! // could already be null     Safe Call Operator: val len = s?.length; // = s ! = null ? s.length : null // len may have the type int? if length returns an int     Elvis operator: len ?: -1; // if len = null then len = -1    * shouldntBeNull!! // we tell the compiler that this val is never Null! (if it is null a NullPointerException will be thrown!)
      • Smart casts also called automatic casts
      • if (foo is String) or if(foo !is String)
      • Lambdas    * Semicolons are not necessary to end a statement! If you provide them, the Kotlin compile will ignore them.
      • Kotlin code can access any Java code
      • Java code can access all Kotlin code
      • Accessing Kotlin code from Java involves:
      • Knowledge about how Kotlin compiles it's code
        • Might require some @Jvm annotations
      • Kotlin is very well documented
      • Pay attention to null when interoperating with Java
      • The Kotlin compiler supports annotation indicating the nullability:
      • @Nullable and @NotNull from JetBrains
        • JSR-305 @Nonnull (when = When.ALWAYS)
      • Kotlin has no primitive data types. All are objects!
      • Kotlin's Generic-System is a little bit different!    * There are no checked exception. Kotlin does not enforce exception checks.
      • In Java you can use Lambdas for single abstract method (SAM). In Kotlin this is done by just passing a block.
      • dat class Thing(var name: String): the parameter is directly stored as var of this method and also create a getter and setter! For val name, Kotlin would only create a getter.   * var is a changeable variable (mutable)
           * val is a final variable (immutable)
    • Kotlin specialities
      • Operator Overloading
      • Extensions Functions
      • Co-Routines (Parallelism)
      • Kotlin/JS (run JavaScript code) and Kotlin/Native (compile static binaries)
      • Advantages (Pros) of Kotlin:
      • Syntax is compact (getter/setter not needed, like lombok does in Java, but in Kotlin it out of the box
      • Null-safety
      • Enhanced standard library
      • random() on an Array
      • Excellent tooling support of JetBrains
      • Excellent documentation
      • Huge community
      • Strong industry support (Google Android, Springframework support)
      • Cons
      • Java knowledge still recommended
      • Some code must be made compatible with Java
      • New idioms (write new code in Kotlin in a Java project)
      • Language features that don't exist in Java
      • Bigger binaries because of the Kotlin Stdlib
      • JVM licensing from Oracle of course ;)
      • Kotlin vs Java
      • Testing frameworks for Kotlin

Wednesday 11

Thursday 12

Friday 13

  • Java Learning
    • The ternary operator (condition ? expression1 : expression2) is a shortcut of the if-then-else statement.
    • By explicitly using the method: = Objects.requireNonNull(bar, "bar must not be null"); we can control the point in time when the NullPointerException will be thrown. Because most of the time we want to fail as fast as possible. The true power of this idea unfolds in conjunction with final fields. Because now any other code in our class can safely assume that bar isn't null - and thus you do not need any if (bar == null) checks in other places! (stackoverflow)

Tuesday 17

  • Java Learning
    * [Launch a java program as a Windows exe file](
    * [How to build a macOS application from a Java Jar file](
    * Interfaces are used to provide a common behavior that then can be used by several classes.
    	* Should I create a class from which another class can inherit (extends) or should I rather create an interface?
    		* Consider the relationship of the final class to the object which extends the interface.
    		* A DeskPhone and a MobilePhone can Telephone. So Telephone is an interface.
    		* Not every animal can walk so it isn't convenient to create an Animal interface with a walk() method in it. But an Animal class would do the job here.
    o A Dog is an Animal and a Dog is an Animal. So they both extend form the class Animal!
  • General Learning
    • A namespace provides a method to organize objects of various kinds so that these objects can be uniquely identified by a name.
      • E.g. The purpose of using an URI is to give the namespace a unique name.

Thursday 19

Friday 20

  • JavaScript Learning
    • I'm eager to learn more about ELECTRON, a cross platform framework to create desktop apps with JavaScript, HTML and CSS. This open sourced framework was developed by GitHub itself. In its core it uses Chromium and NodeJS to power up the applications. It provides a minimal web browser features with an ability to interact with local file system, that is why we can freely use web technologies.
      * So much to learn, but so little time besides all my other projects I'm currently running (preparing two conference workshops, learning Java for the OCA exam, creating two new papers for conference calls next year, uff... have I got too much on the plate?)
      * So a quick experiment #1: created a first draft version of the all famous Rock-Paper-Scissors Game as Electron App!
      	* [Here the GitHub repot to it](
          * Added some docu to the
          	* Added a section with future ideas and improvements 
          	* Collaborate with me, by creating a PR!
          * I really want to have a single distribution file for macOS, Win and Linux, but how?
          	* [Boilerplates and CLIs?](

Monday 23

  • JavaScript Learning

    • An (minimal) Electron app just needs these three files to work with:
      • package.json which points to the apps main file, lists the project details (some documentation) and defines the used dependencies
      • main.js is the main process and thus the heart of the app. It starts the app and creates a browser window object () to render html
      • index.html is the main entrance web page that will be rendered by main.js
  • Java Learning

    • The de facto standard for handling and updating dependencies is the versions maven plugin
    • Awaitility is a small framework that helps testing of asynchronous systems in Java. Today I updated our dependencies which we use in the our testautomation framework to version 4.0.1. I noticed that the awaitility api has changed fundamentally for the class Duration. The class has changed to a bit in its major version 4. E.g. the class Duration changed to a final class Durations.
    • SpotBugs uses static code analysis to look for bugs in Java code.
    • The Hikari Connection Pool JDBC is a solid, high-performance, JDBC connection pool. GitHub repo
  • General Learning

Tuesday 24

  • Java Learning
    • Here some guidelines when using the var keyword (which came in with JDK11)
      * Reading code is more important that writing it
      • Code should be clear from local reasoning
      • Code readability shouldn’t depend on an IDE
      • Choose variable names that provide useful information
      • Minimize the scope of local variable
      • Consider “var” when the initializer provides sufficient information
      • Use “var” to break up chained or nested expressions
      • Take care when using “var” with generics
      • Take car when using “var” with literals
    • And now a negative example, how “var” changes the behaviour of code.
public class Main {

    public static void main(String[] args) {
        var primes = new ArrayList<>(List.of(2, 3, 5, 7));
        int toRemove = toRemove();


    private static Integer toRemove() {
        return 3;

--> Prints: 2,3,5
public class Main {

    public static void main(String[] args) {
        var primes = new ArrayList<>(List.of(2, 3, 5, 7));
        var toRemove = toRemove();


    private static Integer toRemove() {
        return 3;

--> Prints: 2,5,7 instead

Wednesday 25

  • Java Learning
    • Design Patterns
      • The Strategy Design Pattern (Prevents the mess in subclasses when changing something in the parentclass/superclass)
    • JAXB provides a fast and convenient way to marshal (write) Java objects into XML and un-marshal (read) XML into objects. Guide to JAXB

Friday 26

  • General Learning
  • Java Learning:
    • Today I had to test a fix we made in a local library which we are depending on in our test automation framework. After a mvn clean install, I had the jar file right in my hands. But how do I add this jar now as local dependency into my automation framework? The eviltester has a readymade answer to this: Simple ways to add and work with a .jar file in your local maven setup. Awesome, thanks Alan!

Monday 30

  • General Learning
    • Want to get into public speaking? Here is a Book that I'm probalby going to buy.
  • Java Learning

That's it! The last four month have been quite intensive. A long period has come to an end. See you in the next post!

© 2022 Simon Berner • Crafted with ❤️