Monday, 29 June 2020

AssertJ SoftAssertions JavaDoc

I recently came across a great example of JavaDoc. It was regarding the AssertJ SoftAssertions class.

It's in the references1.

In short, we have a dinner party hosted at a mansion.

And we're going to use a UnitTest with Assertions to determine if one of the guests has been murdered and who dun it.

It made me smile.

References

[1] SoftAssertions - AssertJ fluent assertions 3.16.1 API
https://www.javadoc.io/doc/org.assertj/assertj-core/latest/org/assertj/core/api/SoftAssertions.html

Thursday, 18 June 2020

Kotlin

I am busy trying to learn Kotlin.

It's important as my company decided to accept the use of Kotlin for new development.

As a matter of fact, I'm currently implementing an API with a colleague and he already started creating it in Kotlin.

So I'm kinda having to play catchup.

Time to get to work!

References

Kotlin Language Guide
https://kotlinlang.org/docs/reference/
Kotlin Koans
https://kotlinlang.org/docs/tutorials/koans.html

Thursday, 11 June 2020

What I learned about Java from my 5-year old.

So, you're at home all day, because of all the COVID stuff, and in order to stay sane, you sometimes have to do things that are out of the ordinary.

Below is my attempt.


Thursday, 4 June 2020

The Dangers of Doubles

The problems with Doubles and Floats are already well documented, but sometimes we fall into the trap again.

In short, the representation of a real number1 in Float and Double is not precise2.

Normally, I am well aware of this limitation, but sometimes I get tripped up by already receiving Doubles and Floats as input.

In this case, it involved Geometrie coordinates, in doubles of course.

The following Unit Test shows the problem:

References

[1] Wikipedia - Real number
https://en.wikipedia.org/wiki/Real_number
[2] What Every Programmer Should Know About Floating-Point Arithmetic
https://floating-point-gui.de/