Posts

Showing posts from August, 2007

Singleton: Initialize-On-Demand Holder Class idiom

Memory model article and Initialize-On-Demand Holder Class idiom


Listing 2. The Initialize-On-Demand Holder Class idiom


private static class LazySomethingHolder {
public static Something something = new Something();
}

...

public static Something getInstance() {
return LazySomethingHolder.something;
}


This idiom derives its thread safety from the fact that operations that are part of class initialization, such as static initializers, are guaranteed to be visible to all threads that use that class, and its lazy initialization from the fact that the inner class is not loaded until some thread references one of its fields or methods.

Generic Methods

From Hibernate 3.2.0.GA AbstractEntityManagerImpl.java



@SuppressWarnings("unchecked")
public <A> A find(Class<A> entityClass, Object primaryKey) {
...
try {
return (A) getSession().get( entityClass, (Serializable) primaryKey );
}
catch ...
}

@SuppressWarnings("unchecked")
public <A> A merge(A entity) {
...
try {
return (A) getSession().merge( entity );
}
catch ...
}

Mocks Aren't Stubs by Martin Fowler

The Distance Between Simple And Complex

Eliminate RDBMS

See Phat Data
Very large data sets can't be efficiently managed in an RDBMS.
Alternative is distributed Indexed File Systems
MapReduce
Hadoop
MemCache
phat_data



Hadoop and HBase presentation
hadoop and hbase website

Microsoft Project - Java MPXJ

Favor Package-by-feature