Lombok and Streams in Java 9, Uncle Bob’s Dark Path, and Thoughts on Writing
CodeFX Weekly #2 — 13th of January 2017
You’re still here! Let me fix that by boring you with how my week went. ;) If you make it through that, a bunch of random musings about Java, writing, and whatever, really, are waiting for you.
I send this newsletter out every Friday. Yes, as an actual email. Subscribe!
This week was weird. Time-wise it was a loss: I couldn’t work on Monday (kindergarten closed), wasted time on Tuesday preparing for a meeting that was scheduled for Wednesday, and wasted time on Wednesday going back and forth to that meeting, which was nice but not overly productive either. Meh. Thursday and today were ok.
I didn’t feel particularly productive either. The habit of wasting time is trying to come back and looking into my all-knowing calendar it looks like I’ve wasted about 30 minutes per day that were reserved for work. Stupid me!
But I did get things done! Chapter 4 of “Java Module System in Action” is progressing (it’s on building Java modules with
jar) and I finished an article for Heise Developer. (During which I discovered that I write German articles about 50% faster then English ones! Should look into doing that more often...) SitePoint went well, too, with two articles getting done and the channel being booked until mid February.
Yesterday I’ve given my JUnit 5 talk at JUG Mannheim, which was fun. Small crowd but very engaged and personal. Later we had great discussions about all things JUnit but also Git and particularly Gerrit (I still don’t get what those patch sets are good for and why I don’t just push several commits to the same branch).
I also switched to writing that newsletter intermittently. Whenever I do something slightly less boring that staring at Atom, I write it down afterwards. So what follows is really pretty much everything I did. Sad.
Lombok on Java 9
On StackOverflow, somebody wanted to know, whether Lombok will work on Java 9. I checked and the maintainers are positive that they can add enough command line flags to
javac to keep all their sorcery working, including the injection of their own classes into thejdk.compiler module with
That sounds reasonable but I think I once read that there are modules that can not be patched. Maybe? I will research that when I come across that topic in the book.
More Java 9
Regarding Jigsaw, Jason Greene just published Jigsaw’s Missing Pieces. He is the lead of the WildFly application server project, which uses JBoss modules, another module system on the JVM besides OSGi. He is worried that Jigsaw falls too far behind these systems (feature-wise), fragmenting the ecosystem into users of different, incompatible module systems.
StackOverflow frustrated me. Somebody had a question regarding the new methods on
dropWhile. How on earth is the most upvoted answer better than mine?! Especially considering it was given half a day later? :-/ Oh, the anger! (Gamification. It works, bitches.)
While the Java Language Specification is rather strict when it comes to identifier names, the JVM Specification is pretty relaxed. Did you know that
#"☠';:@?\/ is a valid class name for the JVM? I didn't.
And neither did the guy who turned to the mailing list because he found out that the same is true for modules names. He’s maintaining a project that allows to edit bytecode with scripts (or something along those lines) and now wonders how he should parse those scripts. Imagine, users might want to include basically the entirety of UTF-8 including semicolons and all kinds of quotation marks (maybe even CR and LF? I was to lazy to check that) in identifier names. Lol, parsing that’s not a position I’d want to be in…
Anyways, apparently there once was a proposal that would’ve allowed code like this in Java:
I’m not sure what to think of it but it’s surely an interesting proposal.
I accidentally happened upon the fact that Log4J2 has an SLF4J backend. With that any SLF4J implementation can be used to back the Log4J2 API. The intend is that applications can safely code towards the Log4J2 API, using advanced features that SLF4J does not support while knowing that they can fall back to any kind of logging framework by going this easy route:
Log4J2 API ~> Log4J2-to-SLF4J-Bridge ~> SLF4J-API ~> SLF4J-Implementation
Abstraction for the win! :)
Uncle Bob, Type Safety, Kotlin, and Functional Programming
Uncle Bob complained about how Swift and Kotlin, with their fancy features like checked exceptions and null avoidance, walk the dark path and make programmers lazy because they write less tests. Err… what? Having the compiler test my code looks like a pretty solid head start into testing to me.
I don’t know anything about Swift, so I was thankful for a great SO answer explaining exception handling. I admit, adding an exception afterwards does look a little tedious. Regarding avoiding null: I’m sure you know how much I despise it so I’m happy to use a type system that prevents it from creeping in accidentally. Also, number of times I went back to make something optional that wasn’t before: 2. So what I think of hist post? Also number 2.
Safe Refactoring in Kotlin (or not?)
How can you tell I never did anything serious with a language that is not Herculeanly typed? I never even bothered to run ReRe after renaming the packages. That didn’t go well because prefixing a reference to a top-level function does not compile — but that didn’t stop IntelliJ from doing it anyway:
This newsletter is written in Markdown and I’m doing my best to accommodate the text-only folks (I’m one of you). I hope you find it readable, especially with the footnote link syntax.
Who’s The Audience?
I came across an interesting article on dev.to: Untold Problems of a Software Blog — Bots. TL;DR: Most traffic is from bots, good and bad ones. Among them are those looking for ways to reuse content for a variety of reasons, many for nefarious or financial ones, most without giving any credit to the original author. Definitely a good read!
An interesting example was howdoi, which gives your command line the power to help you out with everything:
Installed! (Assuming you have pip it’s just
pip install howdoi.)
If you wonder what the life of a freelancing author looks like, here’s a typical schedule:
Somehow I stopped reading blogs because Vernor Vinge’s Zones of Thought series seized me and doesn’t let me go. Oh the joy of good SciFi! Instead, here’s a lousy list of funny (?) links:
- Is a genie constantly trying to murder you?
- Words you can’t say on TV in 2017: Fuck, Shit, Alexa
- Fight back!
- 16 Most Powerful Characters in the Marvel Universe (don’t ask why)
- The quick brown fox jumps over the lazy dog — finally!
so long … Nicolai
PS: Don’t forget to subscribe! :)