Posts Tagged: Java

Breaking into open source

Posted by & filed under , , .

I read recently Shubheksha‘s blog post “A Beginner’s Very Bumpy Journey Through The World of Open Source” which describes her initial journeys into the open source world and reminded me a bit of some of my initial adventures into open source. (I even wrote a blog post ages ago — my goodness, literally ages ago […]

Scripting

Java, Map and Optional

Posted by & filed under , .

I do like the Optional class in Java — it is a long awaited elegant replacement for returning null whenever something isn’t there then relying on if( x != null ) checks or using ?: in the format (x == null) ? “foo” : “bar”. It works great also with the new Java stream classes […]

Disable PMD Plugin to Run for Test Sources

Posted by & filed under , .

I use PMD in my Gradle builds quite a bit. (Maybe a bit more nowadays that the FindBugs peeps seem to be struggling with that project — see this email from Andrey on this: https://mailman.cs.umd.edu/pipermail/findbugs-discuss/2016-November/004321.html). The issue I had with it is that there is no way to quickly turn off their checks for the src/test/… […]

PMD Rules

Posted by & filed under , .

If you have used such plugins in your project as FindBugs, Checkstyle etc then you quite likely have heard of PMD too. (I have used these tools initially with Apache Maven and nowadays use them via Gradle in my builds, but there’s lots of support for others tools, Ant included.) The trouble with PMD as […]

Of Fibonacci’s Number and Groovy’s Memoization

Posted by & filed under , .

As a developer, chances are every time you hear recursion mentioned you probably also hear of Fibonacci’s number. And in the same breath you probably hear also of stack overflow 🙂 Because — as you get to learn quickly — if you decide to implement Fibonacci’s number via a recursive function, you end up abusing […]

Collection Sorting — Java vs Groovy

Posted by & filed under , .

With the introduction of lambdas in Java (not so) recently, some argue that Groovy lost some of its thunder, as closures are now first class citizens in the JDK. However, as I’m about to show, while lambda’s pushed the Java language a great deal forward, Groovy still makes a lot of things incredibly easy (and […]

A Bit of Lovin’ for the Groovy Object Initialization

Posted by & filed under , .

I’m going to spread some lovin’ today for the widely-used yet less appreciated feature in Groovy which allows creating a Java bean and setting its properties in one line. Especially when dealing with unit tests this saves me a great deal of time and frustration. If you ever worked with “pure” (??) Java beans, then […]

Parallel : Groovy and Java Streams

Posted by & filed under .

This is something that every now and then I have to do: check whether either one or all elements of a collection meet a certain criteria. The standard code initially in Java involved a for loop and iterating through the collection explicitly and checking the condition at each step. Then Apache Commons came on with their […]

On Java Annotations and Type Safety

Posted by & filed under , .

Nicolas Fränkel published a blog entry recently talking about “Type-safe annotations” in Java — which trigger my thoughts on the same matter, and voila, there’s this post as a result of it. This is in fact my 2 cents on the matter — and as such I’d recommend you read Nicolas’ point of view too […]

Small Note on gradle’s afterEvaluate

Posted by & filed under , .

If you use gradle and you took the path to write your own gradle plugins (try it, it’s fun!) to make your build process more … “enjoyable”, then this might come in handy one day. I have worked on a few gradle plugins, some of them inside the Netflix Nebula suite, some of them outside Netflix […]