Lambda Type References

Posted by & filed under Java.

We’re used to type erasure ruining our day in Java. Want to create a new T() in a generic method? Normally not possible. We can pass a Class<T> around, but that doesn’t work for generic types. We can’t write List<String>.class One exception to this was using super type tokens. We can get the generic type… Read more »

Modern Extreme Programming

Posted by & filed under ContinuousDelivery, XP.

There was a recent discussion on the Extreme Programming mailing list kicked off by Ron Jeffries saying he wants his XP back. The implication being that Extreme Programming is no longer practised, and that most “Agile” organisations are actually practising Flaccid Scrum – some agile process but little of the technical practices from Extreme Programming…. Read more »

Minimising the Risk of Data Damage

Posted by & filed under Conferences, ContinuousDelivery, XP.

One of the more interesting questions that came up at Pipeline Conference was: “How can we mitigate the risk of releasing a change that damages our data?” When we have a database holding data that may be updated and deleted, as well as inserted/queried, then there’s a risk of releasing a change that causes the… Read more »

Isolating Test-Data in Production

Posted by & filed under Conferences, ContinuousDelivery, XP.

Alex and I recently gave a talk at Pipeline Conference about our approach of testing in production. With our limited time we focused on things we check in production. Running our acceptance/integration tests, performance tests, and data fuzzing against our production systems. We also prefer doing user acceptance testing and exploratory testing in production. In… Read more »

Yield Return in Java

Posted by & filed under c#, Java.

A feature often missed in Java by c# developers is yield return It can be used to create Iterators/Generators easily. For example, we can print the infinite series of positive numbers like so: public static void Main() { foreach (int i in positiveIntegers()) { Console.WriteLine(i); } }   public static IEnumerable<int> positiveIntegers() { int i… Read more »

Adding toList() to Java Streams

Posted by & filed under Java.

The Java Streams API is lovely, but there are a few operations that One repeats over and over again which could be easier. One example of this is Collecting to a List. List<String> input = asList("foo", "bar"); List<String> filtered = input .stream() .filter(s -> s.startsWith("f")) .collect(Collectors.toList());List<String> input = asList("foo", "bar"); List<String> filtered = input .stream()… Read more »

Monitoring Check Smells

Posted by & filed under ContinuousDelivery, XP.

I have become increasingly convinced that there is little difference between monitoring and testing. Often we can run our automated tests against a production system with only a little effort. We are used to listening to our automated tests for feedback about our software in the form of test-smells. If our tests are complicated, it’s… Read more »

Work around Java “same erasure” errors with Lambdas

Posted by & filed under Java.

A common frustration with Java is the inability to overload methods when the method signatures differ only by type parameters. Here’s an example, we’d like to overload a method to take either a List of Strings or a List of Integers. This will not compile, because both methods have the same erasure. class ErasureExample {… Read more »

Implicit Conversions with Identity Functions

Posted by & filed under Java.

What use is a method that just returns its input? Surprisingly useful. A surprising use is as a way to convert between types. There’s a well known trick that’s often used to work around Java’s terrible array literals that you may have come across. If you have a method that takes an array as an… Read more »

The Unruly Mob

Posted by & filed under XP.

At work, we’ve always pair-programmed all our production code, so we’re already pretty bought into it being a good idea to have multiple people working on a single problem. I previously wrote about some of the reasons for pairing. Mob Programming Recently, having inspired by a talk by Woody Zuill, we decided to give mob-programming… Read more »