Sometimes it is conveniant to use exceptions for implementing the regular program logic. Assuming we want to find some data and then process them. When no data is found, this step can be skipped, because there is nothing to do. So we could program something like this: public Data readData(Param param) { Data data = db.read(param); if (data.isEmpty()) { throw new NotFoundException(„nothing found“); } return data; } public ProcessedData doWork(Param param) { …
Kategorie-Archive: Java
Guava-Collections in Java-APIs
When we write APIs, that have parameters or as return values, it is a good idea to consider relying on immutable objects only. This applies also when collections are involved directly or indirectly as content of the classes that occur as return values or parameters. Changing what is given through the API in either direction …
hashCode, equals and toString
In many programming languages we are urged to define methods hashCode, equals and toString. They are named like this in Java and in many JVM languages or they use similar names. Some languages like Perl and Scala provide decent mechanisms for the language to figure these out itself, which we do most of the time …
Not all projects are on ideal paths II (Tim Finnerty)
This is another story of a project, that did not go as well as it could have gone while I was there. From unsuccessful projects we can learn a lot, so there will be stories like this once in a while. The first one was about Tom Rocket. Tim Finnerty It was the time, when …
„Not all projects are on ideal paths II (Tim Finnerty)“ weiterlesen
2019 — Happy New Year
Gott nytt år! — Godt nytt år! — Felice anno nuovo! — Καλή Χρονια! — Щасливого нового року! — Срећна нова година! — С новым годом! — Feliĉan novan jaron! — Bonne année! — FELIX SIT ANNUS NOVUS — Gullukkig niuw jaar! — Un an nou fericit! — Frohes neues Jahr! — Happy new year! …
Indexing of Arrays and Lists
We index arrays with integers. Lists also, at least the ones that allow random access. And sizes of collections are also integers. This allows for entries in Java and typical JVM languages, because integers are actually considered to be 32bit. Actually we could think of one more entry, using indices , but then we would …
Devoxx Kiew 2018
In the end of 2018 the number of conferences is kind of high. A great highlight is the Devoxx BE in Antwerp. But it has now five partner conferences in London, Paris, Krakow, Morocco and Kiev. So I decided to have a look at the one in Kiev. How was it in comparison to the …
Devoxx Antwerp 2018
In 2018 I am visiting a few conferences. A great highlight is the Devoxx BE in Antwerp, which I had the privilege of visiting 2012, 2013, 2014, 2015, 2016 and 2017. As it should be, it is not just the same every year, but content and speakers change a bit from year to year. Some …
Logging
Deutsch Software often contains a logging functionality. Usually entries one or sometimes multiple lines are appended to a file, written to syslog or to stdout, from where they are redirected into a file. They are telling us something about what the software is doing. Usually we can ignore all of it, but as soon as …
Some thoughts about String equality
Of course Strings are today in some way Unicode. In this article we assume code points as the building blocks of Strings. That means for example in the Java-world, that we are talking about one code point being comprised of one Java character for typical European languages, using Latin, Greek or Cyrillic alphabets including extensions …