Interesting Links – 3 Oct 2016

  • User MarkyC showed Falsehoods Programmers Believe About Phone Numbers, in response to a query about what data types were useful for storing phone numbers. Channel consensus was to do what was necessary, but usually: String.
  • From Reddit, OpenJDK6 End of Life details how the open source OpenJDK6 is reaching its end of life, years after the official Java 6 and Java 7 have reached theirs. This was surprising; I didn’t realise OpenJDK6 was still maintained at all.
  • Maven Wrapper is a project that provides mvnw – an analog to Gradle‘s gradlew, a command that will download a Maven instance local for the project. Thus, users of the project don’t have to download or install Maven to be able to run it. (It may or may not work; feel free to try it out!)
  • User ernimril mentioned creative branching via Befunge – you can find an interpreter for it in Java here. Cool stuff, with a more family-friendly name than, say, some other languages that I won’t mention here. (Note paralipsis, used ironically and against my better judgement.)
  • Only works on Windows, but MobaXterm looks cool. Might help alleviate the Microsoftitis that many still suffer from. Has a free edition and commercial edition; some devops people recommend it highly.

Interesting Links – 29 Sep 2016

  • The reflections project scans your classpath, indexes the metadata, allows you to query it on runtime and may save and collect that information for many modules within your project.
  • try { return } finally {}” demonstrates what happens when a finally block modifies a reference that’s being returned in the try block. It’s rather interesting.
  • Need to generate fake data? https://github.com/DiUS/java-faker to the rescue. It’s a port of a popular Ruby GEM; this is not the only implementation, but it serves.
  • User Anthaas offered this gem: “You’ll find most of the people who waste a large amount of time on something simple do so because they are fixated on fixing their solution, rather than finding a solution that works.”
  • User liste pointed out JSimpleDB, a project that says it is a “a better persistence layer for Java.” Basically, it provides a transactional access layer for various data stores (SQL databases, NoSQL data stores) as key/value stores, with quite a laundry list of features copied from the project home page:
    • Encoding/decoding of field values
    • Enforcing referential integrity; forward/reverse delete cascades
    • Field indexes (simple and composite)
    • Query views
    • Schema management
    • Change notification
    • Validation queues
    • Command line interface
    • Designed from the ground up to be Java-centric; 100% type-safe at all times.
    • Works on top of any database that can function as a key/value store (SQL, NoSQL, etc.)
    • Scales gracefully to large data sets; no “whole database” operation is ever required
    • Configured entirely via Java annotations (only one is required)
    • Queries are regular Java code – there is no “query language” needed
    • Change notifications from arbitrarily distant objects
    • Built-in support for rolling schema changes across multiple nodes with no downtime
    • Supports simple and composite indexes, including on user-defined custom types
    • Extensible command line interface (CLI) including Java 8 expression parser
    • Built-in Java-aware graphical user interface (GUI) based on Vaadin

Interesting Links – 26 Sep 2016

  • Oh, shit, git! is a site that shows a number of common things git users say, as well as how to fix the situations that cause them. Note that the title indicates that the readers are expected to be of age. Some examples:
    • Oh shit, I did something terribly wrong, please tell me git has a magic time machine!?!
    • Oh shit, I committed and immediately realized I need to make one small change!
    • Oh shit, I need to change the message on my last commit!
    • Oh shit, I accidentally committed something to master that should have been on a brand new branch!
    • Oh shit, I accidentally committed to the wrong branch!
    • Oh shit, I tried to run a diff but nothing happened?!
    • F*ck this noise, I give up.
      It’s worth noting that your editor has used at least a variant of all of these statements, most of them even in recent memory.
  • User whaley, in a moment when he wasn’t accompanied by roosters, cows, and goats, pointed out “Suffering-oriented programming“, saying that it convinced him that “make it work, make it pretty, make it fast” is the right approach, as compared to “make it work, make it fast, make it pretty.” Good read.
  • From Reddit: “Recaf is an open-source framework for authoring extensions (dialects) as libraries for Java. You can redefine every major syntactic element of the language, either add new ones or create your own flavor of Java that matches your needs. It can be used to give syntactic support to libraries, to generate and instrument code. Last but not least you can experiment with the design and implementation of Java extensions in plain Java.” Seems like another tool to compete (sort of) with Lombok and Autovalue.

Interesting Links, 15 Sep 2016

  • It may be a little early to suggest that Eclipse is dead, but “The Fall of Eclipse” says it anyway, and says why. The Eclipse community would disagree, of course.
  • User liste pointed out MariaDB4j, which is… MariaDB embedded into a jar, suitable for integration testing with MariaDB in a build tool. Sure, H2 and Derby exist, but this allows you to test against MySQL and MariaDB, because if you have to use MySQL in whatever terrible world you happen to live in, you definitely want to test against it instead of a good database, to help you work out what awful bugs you need to avoid.
  • User yawkat also pointed out something that your humble author was unaware of: the hash code of Java Strings isn’t calculated until hashCode() is called. That makes perfect sense, actually. The javadoc for String’s hashCode() points out how the hashcode is calculated, but not when.
  • User cheeser pointed out O’Reilly’s (legal and free) Data Ebook Archive: “An archive of all O’Reilly data ebooks is available below for free download. Dive deep into the latest in data science and big data, compiled by O’Reilly editors, authors, and Strata speakers.”
  • The channel has mentioned tries (pronounced “trees”) as a form of data structure a few times lately; in case you don’t know what a trie is, or how it differs from a tree, see The Trie: A Neglected Data Structure.
  • Using NPM (Node.js‘ package manager) as part of a Java build came up one morning. Without any further context, here are a few references show up to integrating NPM into a maven build, none of which has been tried and tested by the person writing this up for you:

Interesting Links, 2016 Sep 13

  • Technical Itch: JVM guaranteed safepoints, Safepoints in HotSpot JVM, and Dynamic Deoptimization came up in conversation.
  • javap.yawk.at – selckin says it’s basically “take a peek under the hood at the java bytecode for fun and profit.” Interesting site, though, it basically runs javap and procyon (a java decompiler) over submitted code and shows you the bytecode and associates it with the lines of java (or kotlin, or scala) that generated that bytecode.
  • NetBeans Proposal suggests a migration of NetBeans (possibly a fork?) from Oracle to Apache, opening up NetBeans to Apache’s governance model and a wider community. Considering the noises Oracle’s made around NetBeans being deprecated (and therefore likely abandoned), this sounds like a great idea.

Interesting Links, 17 Mar 2016

This list was originally supposed to be published over a week ago, but life’s been busy. Sorry, folks! Happy St. Patrick’s Day!

  • A succesful Git branching model considered harmful is a response to another article, A successful Git branching model. Both models can work; which one works better for you depends on a lot of factors that are likely to be unique to your development environment. (I’ve used both: I find the “cactus model” better, personally.)
  • The Four Software Engineering Personality Types describes four personalities (surprise) in development environment: Iron Man, Michaelangelo (the sculptor, not the Teenage Mutant Ninja Turtle), Yoda, and Captain America.
    • Iron Man is a tinkerer – get 90% of the project done, really quickly.
    • Michaelangelo is the detail-oriented, deep-diving programmer – the one who spends years on a given project, working out every detail. Michaelangelos’ projects tend to be unusable until they’re done – then they’re mission-critical and awesome.
    • Yoda is a teacher (or, if you like, a puppet with a hand up his… I mean, “a teacher.”) These are the guys who know tons of stuff, and show it to others, growing an organization and providing wisdom – and a great lever when they focus on doing specific tasks.
    • Captain America is the workhorse, the one who’ll roll up his sleeves and do the unpleasant work. Like in the comics, Captain America and Iron Man go well together; Iron Man rockets through the stratosphere, flashy and quick, and Captain America cleans everything up and makes it work well.
  • The Deep Roots of Javascript Fatigue goes into the rather chaotic waters of JavaScript development. Java’s in a great place: it’s dynamic enough that the community finds new and interesting ways to develop software all the time, but it’s also stable enough that you’re not having to relearn how to do everything every year, which is the situation you find in JavaScript. Excellent writeup, even if JavaScript development isn’t quite as dire as it might sound on the surface.
  • And now into our selection of excellent DZone content: Abstraction Considered Harmful..? has a bit to say about abstractions: they’re good, but sometimes they’re leaky (and therefore can be bad). But mostly they’re useful. From the article: “Abstraction, in and of itself, is not harmful. On the contrary, it’s necessary for progress. What’s harmful is relying on impenetrable barriers to protect our precious programmers from hard problems. After all, the 21st-century engineer understands that in order to play in the sand, we all need to be comfortable getting our feet a little wet from time to time.”
  • In Anatomy of a Good Java Test, Sam Atkinson (who will show up again in this same collection of interesting links) walks through a simple recipe for good testing. It looks like it’s based around JUnit4 and Hamcrest – hardly awful choices, but also not necessarily the state of the art (or the only way to write good tests). Good baseline, though.
  • In In Defense of the Fifth Year Developer, Matthew Casperson argues for some of the abstraction discussed earlier – the point’s not very clear, but complex code laden with abstractions is easier to test and verify, because it breaks problems down into identifiable units.
  • And back to Sam Atkinson: In Constructor vs. Getter: A Better Way he discusses the use of no-operation classes to wrap optional behavior (thus: NoOpNotifier, with methods that do nothing, instead of a null that has to be checked). This simplifies the code path (a good thing), and also helps with that pesky abstraction thing. Good article.

Interesting Links, 1 Mar 2016

Happy March 1, it’s April Fool’s Day! Oh, wait…

  • From ##java itself: Anthaas_> 99.7% of people who say C++ is faster are not capable of using the highly-skilled techniques required to make that true. Now, about how he collected the data to validate that statement…
  • Gradle.org posted “Gradle vs Maven Feature Comparison“, with a description of “At long last, a comprehensive feature comparison of Maven vs Gradle that shows in detail what Build Automation requires in the Age of Continuous Delivery.” Surprisingly – or not – Gradle comes out well ahead, but most of the features sound more useful than they actually are for most users. (Until, that is, you really need that feature.)
  • Maven Testing Module describes using a Maven module solely for holding resources used for testing. It’s a module that’s included in other project modules at test scope; it has the testing frameworks and other dependencies in it, so your other modules will no longer be cluttered by test resources or artifacts. Cool idea. (For example, you can put H2 in your test project, along with some stored procedures and a test schema for it, and import them into your application for validation… just kidding, avoid stored procedures unless they’re used for every last bit of your data manipulation. And don’t do that.)
  • Heinz Kabutz is back, with “Checking HashMaps with MapClashInspector” – which walks through some of the things you should, and could, think about when designing hash codes for your objects. Highly recommended. Precis: “Java 8 HashMap has been optimized to avoid denial of service attacks with many distinct keys containing identical hash codes. Unfortunately performance might degrade if you use your own keys. In this newsletter we show a tool that you can use to inspect your HashMap and view the key distribution within the buckets.”
  • Of course the announcement propagates right after the links get published… but Flyway 4.0 has been released. This is a database migration tool – if your schema changes during development (or for any other reason), tools like Flyway are beyond valuable in terms of keeping your schema versioned. Highly recommended. The main alternative to Flyway is Liquibase – that’s not an endorsement of either project, just a plea to save your devops people by using tools designed to help them, instead of making them issue manual SQL to update a schema.

Interesting Links, 24 Feb 2016

It’s been a while, and I’m pretty sure I missed some fun stuff, but here goes with a few things:

  • Blogger Sam Atkinson has a few here, some good, some bad. I admire his proclivity.
    • Don’t Rewrite Your Old Application; Refactor!” has some advice for people migrating to new products. It’s got some good thinking in it (rewriting is going to miss stuff, it’s going to take longer than you think) but not a lot of deep reasoning (and misses some possible points, like the resentment from the original architects which has happened to me when I tried to rewrite rather than refactor). Good post.
    • Then there’s “Kill Your Dependencies: Java/Maven Edition“, which says not to introduce dependencies until you have no other choice. That’s not terrible advice on the surface, but … it’s terrible advice. Use what you need. If wasting 3MB of disk space gets you one method from a library that saves you time to write or think or test, well, that 3MB of space is cheaper than you are. YMMV, but it’s not good advice – worth reading, though.
  • jOOQ‘s “The Mute Design Pattern” shows how you can use Java 8’s lambdas to hide checked exceptions for situations where you Just Don’t Care, leading to code like mute( () -> { doStuff(); } ) — which is actually pretty neat. Very handy to have in your coding toolbox, much like Binkley‘s “Java 8 AutoCloseable trick“.

By the way, feel free to send in stuff you think belongs here!

Interesting Links, 15 Feb 2016

  • A great quote from ##java: < surial> maven/gradle are to ant, as svn is to cvs.
  • JavaCPP is a new project that attempts to bridge a gap between C++ and Java, entering the muddy waters along with JNI and JNA (as well as a few other such projects). It actually looks pretty well done – and targets Android as well as the JVM, which seems like a neat trick.
  • First in a couple from DZone: “Reactive Programming by Example: Hands-On with RxJava and Reactor” is a presentation (thus a video) of a use of RxJava. Reactive programming is one way to introduce a scalable processing model to your code, although it’s hardly the only one (and it’s not flawless, either, so if you’re one of the anti-reactive people, cool your jets, it’s okay). If you’ve been wondering what this whole reactive thing is, here’s another chance to learn.
  • Speaking of learning: “Monads: It’s OK to Feel Stupid” punts on the idea of describing what a monad is, saying that it’s okay if you don’t understand them – you can use them anyway. (Java’s streams provide a lot of access to functionality through monads, which present “computations represented as sequences of steps.”)
  • The 5 Golden Rules of Giving Awesome Customer Support” goes through some basic things to think about for, of all things, customer support. (Surprise!) The things are topics, not good headings, but one thing they didn’t point out was that people who use your open source software library are customers, too. You’ll want to read the article to get more relevance out of the headings. The points are:
    • All users are customers
    • Your customer took the time
    • Your customer is abrasive and demanding
    • Your customer doesn’t understand your product
    • Your customer doesn’t care about your workflows

Interesting Links, 9 Feb 2016

  • From Parks Computing, a short word of advice in “On Recruiting” for the movers and shakers (and those who want to be movers and shakers): “The quality of your company’s software will never exceed the quality of your company’s software developers.”
  • DZone is back with a few interesting posts: “OpenJDK – Is Now the Time?” starts by wondering is OpenJDK is reaching critical mass to the point where it should be considered instead of the standard Oracle JDK. It’s an odd post.
    • It points out that if Google had used OpenJDK instead of Oracle’s libraries, the lawsuit might not have happened (Editor’s note: it might have!). This is a good point.
    • It says that the deployment options might open up, with standard package management instead of a custom update process specific to Java. This is also a good point.
    • It points out that OpenJDK’s performance and scalability is the same as the Oracle JDK. This is… not a good point. The codebases are the same (they’re routinely synchronized: code in one will be in the other eventually.) Oracle’s JDK is effectively OpenJDK with some closed-source libraries, so Oracle’s JVM can write JPEGs natively (and some other features like that.)
    • It also points out community improvements to OpenJDK – “As open source developer’s continue to provide insight into the source code, it is likely that OpenJDK could begin to outperform the version released by Oracle.” Um… since the codebases are the same, that’s not likely to happen much at all.
  • From ##java, cheeser had a beautiful expression of reference equivalence. Someone was asking about how two references (A and B) pointing to the same object work – cheeser said, “If B is your *name*, A would be a nickname. Both of them mean you so anything said to either name or nickname both go to you.
  • Fix PATH environment variable for IntelliJ IDEA on Mac OS X” describes a way for OSX users to provide the OS’s PATH to the popular IDE. It turns out that programs installed via brew aren’t necessarily available to IDEA unless you start IDEA from the shell – which few do. It’s easy to fix; this post shows you how.
  • Another from DZone – they’re on fire! – Per-Ã…ke Minborg posted “Overview of Java’s Escape Analysis“, which discusses what escape analysis is (it’s a way of determining the visibility of an object) and what it means for performance. (If an object isn’t used outside of a method or a block, it can be allocated on the stack rather than on the JVM heap – and as fast as the heap can be in Java, the stack is much faster.)
  • Pippo is a new, very small microframework based on services. The example looks … easy enough; take a look, see what you think.
  • Yet one more from DZone: Exceptions in Java: You’re (Probably) Doing It Wrong advocates the use of RuntimeException to get rid of those pesky throws clauses and forced try/catch blocks in your Java code. It’s an argument Spring advocates, and checked exceptions aren’t part of languages like Scala… but I personally find the over-reliance on unchecked exceptions to be terrible. The core argument against check exceptions from the article: “The old argument is that (the use of checked exceptions) “forces” developers to handle exceptions properly. Anyone on a real code base knows that this does not happen, and Exceptions are routinely ignored, or printed out and then ignored. This isn’t some sign of a terrible developer; it is such a common occurrence that it is a sign that checked Exceptions are broken.” Except no, it’s such a common occurrence that it’s a sign that developers are terrible. This article was so terrible that I’ll probably write up a better response as soon as I get some time.