Skip to content

Instantly share code, notes, and snippets.

@bivas
bivas / ClassicStrategy.java
Created August 14, 2011 09:39
Strategy pattern as replacement to instanceof if statements
package com.example.strategy;
public interface Strategy<R> {
public R execute(Object input);
}
@bivas
bivas / CloudFoundryMySqlBootstrap.java
Created August 12, 2011 10:58
Running Play Framework Application in CloudFoundry
package plugins;
import java.util.List;
import java.util.Properties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.cloudfoundry.runtime.env.CloudEnvironment;
import org.cloudfoundry.runtime.env.MysqlServiceInfo;
@bivas
bivas / JavaCodingStandards.txt
Created May 31, 2011 12:37
Java Coding Standards
= Motivation =
Code conventions are important to programmers for a number of reasons
- 80% of the lifetime cost of a piece of software goes to maintenance.
- Hardly any software is maintained for its whole life by the original author.
- Code conventions improve the software readability, allowing programmers to understand new code more quickly and thoroughly.
= Coding Standards =
@bivas
bivas / FooServiceImpl.java
Created April 11, 2011 09:46
Using Compile-Time AspectJ as @transactional Proxy Provider
package com.example.svc;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service("fooService")
@Transactional
final class FooServiceImpl implements FooService {
/* constractor, fields, etcs. */
package org.eventroaster.example;
import org.eventroaster.annotation.Event;
import org.eventroaster.EventServiceFactory;
import org.eventroaster.annotation.EventHandler;
import org.eventroaster.EventService;
import org.eventroaster.EventServiceFactory;
@Event
public class EchoEvent {}