Check out Good Design, Part III: Refactoring by Rob Myers. Here is an excerpt:
Remember this?
public static ProductBean installProduct(String p) {
ProductBean pi = new ProductBean(p);
Connection c = new Connection(“$Updates”);
for (Record x : c.getAllForKey(“PLUG_INS”, “P_NAME”, p)) {
// validate serial number
if (“SNUM”.equals(x.getString(“RECORD_TYPE”))) {…
The full article is available here.