Two weeks ago we have covered first day of Geecon 2017 Kraków conference, day two was week ago. Now it’s time to take a closer look at third and final day. I’ve managed to participate in five talks this time.
Henning Schwentner: Value types – the next big Java Thing.
“Codes like a class, works like an int” is the idea behind project Valhala – value types, the next big thing planned for Java after lambdas and modules. Objects have variable state and reside on heap, while values are immutable and reside on stack. The main benefit is ability to create rich domain models while retaining the high performance of primitives. Value types definition will be similar to classes but with an additional keyword. They will be final to keep predictable stack size and will have mandatory equals and hashcode. Expected arrival: Java 10. The talk was a bit unusual concerning number of slides. There were literally hundreds of them, with single image or word which is interesting concept but it was difficult to take a picture when something really cool comes up.
Charles Nutter: Java Native Runtime.
Second talk by Charles on the conference, after diving deep into assembler the day before. This time it was about an open source library for calling native code from Java – the Java Native Runtime. It is designed to address complexity and cumbersomeness of JNI standard. It supports all relevant platforms and provides convenient wrappers around important C functions. Areas of interest are: files, processes, sockets, posix functions, x86 assembler and enums for various errors and modes of operation. Not really something I do in everyday work, but who knows, maybe once I will need something like that and now I know where to look.
Jakub Kubryński: JPA – beyond copy paste.
All non-trivial abstractions are leaky to some degree, and JPA is no different. In the age of copy-pasting from Stack Overflow, it’s good to understand what we are really doing. There were tips regarding usage of annotation on fields and getters; mappings properties; lazy loading with sets and lists; ordering in sets; dealing with N+1 select problem; comparison of persist and merge with entity manager; optimistic locking and versioning; object identity; pitfalls of different levels of caching and importance of distribute cache. HQL does not save us from injection attack and inspecting logs and debugging Hibernate code might be useful to troubleshoot performance problems.
Jakub Marchwicki: Java 9 and REPL, forget debugging, welcome joy and productivity.
Jshell, also known as REPL – Read Evaluate Print Loop is a new feature in Java 9. Essentially, it allows using Java like a scripting language and running code without creating classes and methods. Jakub walked through some basic examples, including some new stream features from Java 9. At the end, we had a functioning web client, being able to connect to a restful endpoint of an application hosted on Heroku. Scripting in Jshell might be useful to quickly try out some simple syntax, new language features, as an educational tool, or for demos, without the need to start IDE and creating project stub. Interesting addition, but I’m a bit skeptical if it will gain much popularity.
Adam Dubiel: HTTP Clients, Silent Heroes of Distributed Systems.
Not all heroes wear capes. There are a lot of http clients for Java out there, but in the end they use the same underlying implementation. Adam discussed few problems and their solutions regarding http following a set of distributed computing fallacies. Since latency is not zero, it’s good to keep a pool of connections and reuse them. Since network is unreliable, we should have suitable timeouts in place and fail fast. In order to save resources, use NIO threads and asynchronous callback when dealing with network, and restrain from doing have lifting not directly associated with network in those threads. Very well executed talk.
There was one more talk after that, by the initial creator of Spring – Rod Johnson, however due to train schedules and tie constraints I decided to skip it. I hurried to the Kraków main station and my train curse hit me hard. 270 km travel took eight hours, since the train started late to begin with, then after some time caught fire (yes, fire), and the backup train after some time was forced to wait another two hours due to some problems with rails. Anyway, the conference itself was very good. I learned a lot, found some inspiration and met cool people. Definitely looking forward to the next installment!