Software crafts(wo)men avoid overbuilding for the present need. Usually, the intrinsic complexity of the problem at hand is exciting enough. Conjecture about how a client may want to generalize in the future, unless the client has that exact need in the present, only serves to clutter the built solution. The mantra is "You Aren't Going to Need It" (YAGNI).
Working software systems evolve over time. Sometimes the need for a feature disappears entirely. Maybe some code was in place to support a launch or a migration, and that work is complete. This is where we meet YAGNI's twin, YDNIA: You Don't Need It Anymore.
Clinging to the past can be as limiting as preparing for a future that will never be. Make your software live in the present.
MathJax
Friday, March 24, 2017
Thursday, March 16, 2017
Java 8 Stream: stream().sorted.collect() throws NullPointerException
Here's what I ran into:
was throwing NullPointerExceptions.
Why?
Turns out the original map actually had a value defined for the null key, as in
"a" -> "b"
null -> "c"
So the obvious first place to look is why on earth that silly null -> "c" mapping exists.
Another option, if this is safe for your use case, is to filter with java.util.Objects::nonNull:
return map.keySet().stream()
.sorted()
.collect(Collectors.joining(":"));
was throwing NullPointerExceptions.
Why?
Turns out the original map actually had a value defined for the null key, as in
"a" -> "b"
null -> "c"
So the obvious first place to look is why on earth that silly null -> "c" mapping exists.
Another option, if this is safe for your use case, is to filter with java.util.Objects::nonNull:
return map.keySet().stream()
.filter(Objects::nonNull)
.sorted()
.collect(Collectors.joining(":"));
Tuesday, January 24, 2017
Don't hate me for my Dune review
Dune by Frank HerbertMy rating: 3 of 5 stars
Don't hit me for only 3 stars! Dune is good at world-building. Dune is good at inspiring the realtime strategy genre of video games. Like Seinfeld, Dune is more fun to talk about than it is to consume. Sadly, Dune is bad at being the book that so many of its fans claim that it is.
It's on a lot of people's sci-fi required reading lists for its strategy, plots-within-plots, and subtle political maneuvering. Reading with a kid-brain in a different decade might have seen those cool things. Reading the book as a 30-year-old in 2016/2017, the characters are hollow, self-satisfied gnostics. Characters only make mistakes when another character's circuitous but perfectly-executed plan involves careful deception. Arrakis' relationship with water is inconsistent. Sand worms are a problem until they aren't. Harkonnens are cartoony bad guys for no reason. Stillsuits are gross. The political maneuvering is clumsy. Jihad is lame. The we-have-Mentats-because-we-decided-we're-never-making-computers-again plot line is undeveloped. The empathy-is-a-greater-power-than-being-smart-all-the-time is suggested only to be immediately discarded.
Herbert wantonly transmutes conjunctions to commas, drives the reader crazy. He attempted to drive up the pace of certain scenes this way, never admitted the experiment was a horrible failure.
The hard sci-fi is inconsistent, the human elements are childish, and the comma-spliced verbal phrases are borderline unreadable. Three stars for historical significance and because so many people remember the book so fondly. Give this one to Michael Bay for a movie remake.
View all my reviews
Subscribe to:
Posts (Atom)