Home » Author Archives: Alex Staveley (page 2)

Author Archives: Alex Staveley

How could Scala do a merge sort?

scala-logo

Merge sort is a classical “divide and conquer” sorting algorithm. You should have to never write one because you’d be silly to do that when a standard library class already will already do it for you. But, it is useful to demonstrate a few characteristics of programming techniques in Scala. Firstly a quick recap on the merge sort. It is ...

Read More »

Scala pattern matching: A Case for new thinking?

scala-logo

The 16th President of the United States. Abraham Lincoln once said: ‘As our case is new we must think and act anew’. In software engineering things probably aren’t as dramatic as civil wars and abolishing slavery but we have interesting logical concepts concerning ‘case’. In Java the case statement provides for some limited conditional branching. In Scala, it is possible ...

Read More »

Scala: Collections 1

scala-logo

This post contains some info on Scala’s collections. Problem? We want a function that will take an List of Rugby players as input and return those players names that play for Leinster and can run the 100 meters from the fastest to the slowest. Step 1: Have a representation for a Rugby player. Ok so it’s obvious we want something ...

Read More »

Scala: call me by my name please?

scala-logo

In Java, when frameworks such as log4J became popular in Java architectures it was a common occurence to see code such as:                   if (logger.isEnabledFor(Logger.INFO)) { // Ok to log now. logger.info('ok' + 'to' + 'concatenate' + 'string' + 'to' + 'log' + 'message'); } It was considered best practice to always ...

Read More »

Scala: Do you partially understand this?

scala-logo

Nearly everyone who learns Scala can get confused over the word partial used in the contexts: Partial functions Partially applied functions Let’s look at both. Partially applied functions Scala gets its functional ideas from classical languages such as Haskell (Haskell 1.0   appeared in same year as Depeche Mode’s Enjoy the Silence and Dee Lite’s Groove is in the Heart ...

Read More »

Scala function literals

scala-logo

Functions are an important part of the Scala language. Scala Functions can have a parameter list and can also have a return type. So the first confusing thing is what’s the difference between a function and a method? Well the difference is a method is just a type of function that belongs to a class, a trait or a singleton ...

Read More »

Is Java Dead or Invincible?

java-logo

Writer Isaac Asimov once said that ‘the only constant is change’. That isn’t just a phrase in the software industry, it is an absolute fact. Once, there was a day when Corba was king but it was usurped by Web Services. Even within the world of Web Services, that used to be all about SOAP but now it’s REST style ...

Read More »

Code reviews in the 21st Century

software-development-2-logo

There’s an old adage that goes something like: ‘Do not talk about religion or politics’.  Why?  Because these subjects are full of strong opinions but are thin on objective answers. One person’s certainty is another person’s skepticism; someone else’s common sense just appears as an a prior bias to those who see matters differently. Sadly, conversing these controversial subjects can ...

Read More »

Extending your JPA POJOs

eclipselink-logo

Extensibility is an important characteristic in many architectures.  It is a measure of how easy (or difficult) it is to add or change functionality without impacting existing core system functionality. Let’s take a simple example.  Suppose your company have a core product to track all the users in a sports club.  Within your product architecture, you have a domain model represented ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.