BasePatterns.org

"A good designer must rely on experience, on precise, logic thinking; and on pedantic exactness. No magic will do." - Niklaus Wirth

Software Longevity

All software has a lifespan. The three primary factors that control this lifespan are the popularity of the software; it's usefulness, and the lifespan of the controlling company. Whilst the first two factors are common to all software, the third is one of the primary differentiating factors between proprietary and ...

The Tao of Dependency Management

Increasingly we see the use of dependency management tools becoming a part of mainstream software development. A core feature of many dependency management tools is the use of a repository (or set of repositories) that provide access to published artifacts. Perl has CPAN, PHP has PEAR, and Java has Maven. Maven ...

Future-proofing Software

In the search for methodologies and patterns that help to build better quality software, we find that our methods continue to evolve at a blistering pace. Whether its the leap from procedural to object-oriented design, or the difference between the waterfall and prototyping approaches, all share the common goal of ...

Colophon

Donec ac nisi in lectus euismod sodales. Suspendisse congue, arcu sit amet adipiscing scelerisque, enim neque ullamcorper dolor, sed viverra erat leo eu metus. Cras porttitor bibendum nunc.

Syndicate

April 4th 2012
Tags: Build, Groovy No Comments

Building a Groovy web application from scratch

There are many frameworks available for building Java or Groovy-based web applications, with the most popular Groovy options being Grails or Gaelyk for Google App Engine development. Fortunately however, a lot of the functionality required for building simple web applications is built into the Groovy library itself. Groovy Servlets Support for executing arbitrary Groovy ...
February 17th 2012
Tags: Build No Comments

Bootstrapping an OSGi environment

Something I have always lamented about OSGi is a lack of simple examples to get up and running quickly. So here is a simple example using Groovy: First, dependencies are easily added via Maven, adding the following to your pom.xml should do it. [code] <dependencies> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> </dependency> <dependency> <groupId>org.apache.felix</groupId> <artifactId>org.apache.felix.framework</artifactId> <version>4.0.2</version> </dependency> </dependencies> [/code] Then a simple Groovy script to start ...
October 18th 2011
Tags: Uncategorized No Comments

Prevent multiple instances of an application

A simple way to prevent running of multiple instances of your application is to use Socket communication. For example, in Groovy the first thing you would execute is something like this: [code] try { // choose a unique port (!!) new Socket('localhost', 1337) ...
November 2nd 2009
Tags: Java No Comments

Service Selector

Sometimes we may have more than one implementation and/or instance of a service to which we need to route requests. Routing may be controlled by a number of different factors, such as the request type, request arguments, runtime configuration, etc. An implementation of such routing might look something like this: [java] public interface ...
October 13th 2009
Tags: Java No Comments

Uniform Caching

Typically object caching in Java is managed by the container or framework in use. Occasionally however there is a need to manually cache domain-specific objects, whereby a java.util.Map implementation will not suffice. Using the popular ehcache framework as an example, the following pattern is typically observed: [java] public class SomeClass { private ...