Search This Blog

Saturday, August 20, 2011

PLoP Links And Other Pattern Links

PLoP = Pattern Languages of Programs, a group that collects good patterns like some people collect baseball cards.
Some interesting links:
Books On Patterns
Patterns Catalog
Some Random Interesting Patterns:
Avionics Patterns
Scrum Patterns

Other Links:
Pattern-Oriented Software Architectures
Patterns & Frameworks for 
Concurrent & Distributed Systems - Patterns For Real Time Avionics Messaging in UAV
Great Article on Inversion of Control Layer
Variability Patterns (Software Product Line)

Friday, July 22, 2011

The Joel Test


  1. Do you use source control?
  2. Can you make a build in one step?
  3. Do you make daily builds?
  4. Do you have a bug database?
  5. Do you fix bugs before writing new code?
  6. Do you have an up-to-date schedule?
  7. Do you have a spec?
  8. Do programmers have quiet working conditions?
  9. Do you use the best tools money can buy?
  10. Do you have testers?
  11. Do new candidates write code during their interview?
  12. Do you do hallway usability testing?
Joel Spolsky's Joel Test (How Good is your software team)

Tuesday, July 19, 2011

Software Architecture Patterns and Best Practices

  • The fundamental rule is that all code can depend on layers more central, but code cannot depend on layers further out from the core.  In other words, all coupling is toward the center.   This architecture is unashamedly biased toward object-oriented programming, and it puts objects before all others. Onion Architecture

Sunday, June 26, 2011

My Favorite Java Tricks and Tips


  •  Classpath wild cards since Java 6: java -classpath ./lib/* so.Main Instead of java -classpath ./lib/log4j.jar:./lib/commons-codec.jar:./lib/commons-httpclient.jar:./lib/commons-collections.jar:./lib/myApp.
  • JDK 1.6_07+ contains an app called VisualVM (bin/jvisualvm.exe)
  • variable arity. So, instead of just passing an array, now you can do the following
    public void foo(String... bars) {
       for (String bar: bars)
          System.out.println(bar);
    }
    bars is automatically converted to array of the specified type
    
    
  •  javap disassembler which comes with Sun's JDK is not widely known or used.
  • // For each Object, instantiated as foo, in myCollection
for(Object foo: myCollection) {
 
System.out.println(foo.toString());
}
  • checking for null is not necessary.
Instead of:

if( null != aObject && aObject instanceof String )
{
    ...
}

just use:

if( aObject instanceof String )
{
    ...
}

  • anonymous subclass or anonymous impl of an interface:
public void initAnonymousSubclass() {
//anonymous subclass and directly call a method on it even if it implements no interfaces.
new Thread() {
public void run() {
while (true) {
try {
Thread.sleep(2000);
System.out.println("sleeping");
} catch (InterruptedException e) {
e.printStackTrace();
}
}

}
}.start();
}

public void initImplementationOfInterface(){
new TestInterface(){

@Override
public String printId() {
// TODO Auto-generated method stub
String someString = "time "+System.currentTimeMillis();
System.out.println(someString);
return someString;
}

}.printId();
}

Source attributation: http://stackoverflow.com/questions/15496/hidden-features-of-java

                                                            Monday, March 28, 2011

                                                            Common JEE Application Design Patterns

                                                            • Typesafe enum pattern/enum in JDK 1.5+
                                                            • code to an interface not an implementation
                                                            • abstract parent class to promote reuse for subclasses
                                                            • factory method pattern (loose couples calling code from instances created)
                                                            • abstract factory pattern  (specific method for each concrete type)
                                                            • builder pattern (similar to factory except user had more flexibility (builder.add(x), builder.add(y), etc.)
                                                            • strategy pattern (strategy encapsulates algorithms not data)
                                                            • decorator design pattern: (implements same interface as object it decorates)
                                                            • visitor pattern: (avoids lots of typecasts and instanceof to do common method on different types)
                                                            • iterator pattern
                                                            • template method pattern (e.g. Spring JDBC and Spring JMS)
                                                            • composite design pattern: (act on Manager or Staff object in same way. both subs of employee)
                                                            • facade pattern: (interface to large set of classes)
                                                            • observer pattern: (observer registers with publisher, publisher notifies observer of event)
                                                            • command pattern: OO equivalent of callbacks (sender object invokes operation, receiver object  receives request to execute certain operation)
                                                            • proxy pattern: (remote: EJB, RMI, CORBA, virtual: create memory intensive object on demand (lazy load hibernate objects when needed), access: different clients get different access rights)
                                                            • dynamic proxy: (reflection based; come at a performance cost; common in AOP)
                                                            • adapter pattern (wrap API)
                                                            • service activator pattern (ala MessageBean)  services need a way to be activated asynchronously
                                                            • For completion: (bridge, chain of responsibility)
                                                            • For completion JEE (MVC, front controller, composite view, view helper, dispatcher view, service to worker, business delegate, session facade, value object, fast lane reader, service locator)

                                                            Sunday, March 27, 2011

                                                            Java and General Programming Sites and News Sources

                                                            General:
                                                            stackoverflow
                                                            Refcardz

                                                            Java:

                                                            Java Community Content on InfoQ
                                                            the serverside
                                                            refcardz
                                                            informit
                                                            developerworks
                                                            Automation For the People
                                                            Java Lobby
                                                            Java Developers Journal
                                                            (esp. automation for the people)
                                                            martin fowler
                                                            sdtime
                                                            http://java.sys-con.com/, http://java.dzone.com/
                                                            Developer.com/java
                                                            Java Posse

                                                            Java Reference Guide (http://www.informit.com/guides/guide.aspx?g=java)
                                                            java almanac, The Register/Software

                                                            Automation:

                                                            Saturday, March 26, 2011

                                                            Java, CI and WS Technology

                                                            App Server: JBoss, Glassfish, Geronimo, Tomcat (no EJB), WebLogic (OAS), WebSphere
                                                            • SOAP Stack: Axis2, CXF, Metro, JBoss WS, Websphere JAX-WS, WebLogic (OAS) JAX-WS, Spring Web Services
                                                            • Specs: JAX-WS (JSR 224), JAX-RS (JSR 311), JAX-RPC, SAAJ (JSR 67), JSR 181 (standardize deploy), JSR 109 (WS inside JEE)
                                                            • General Features: Spring Support, Eclipse Plugins, Streaming XML (STaX), Client-side Asynchrony, Server-side Asynchrony, Policy-driven code generation)
                                                            • Marshalling: JIXB , JAXB, XMLBean
                                                            • Attachments: SAAJ (SOAP w/ attach), MTOM (Msg Transmission Optimization Mech), DIME (binary)
                                                            • Encoding: XML, FastInfoSet, JSON
                                                            • Transports: HTTP, JMS, XMPP

                                                            CI: Jenkins, Hudson, Bamboo, TeamCity, Cruise Control

                                                            Build and dependency management: Ant, Ant/Ivy, Maven

                                                            Static Analysis: Checkstyle, FindBugs, PMD, PathFinder, JDepend, Coverlipse, Cobertura, Clover, Coverity, Structure 101

                                                            Test: JUnit, TestNG, EasyMock, SOAPUI, firebug, surefire (maven), STAF(S/W Tasting Automation Framework), Load test (SLAMD distributed load generation , JMeter)

                                                            Documentation: Javadoc, SchemaSpy, UMLGraph

                                                            XML/XSD create/edit/XSLT transform: XmlSpy, Liquid

                                                            Network Tools: wireshark, winscp, putty, tightVNC, nirsoft network tools, pathsync, synergy, filezilla, VMPlayer

                                                            Patterns: Observer, Template, Adapter, Proxy

                                                            JMS/EAI/SOA/ESB platforms: WebSphere MQ, Tibco, Vitria, WebMethods, BizTalk, Sonic, Fiorano, Mule ESB, Apache ActiveMQ, Fuse, MSMQ, GlassfishMQ, Camel, RabbitMQ

                                                            ORM: Hibernate, iBatis

                                                            JSSE Provider: BouncyCastle, AlternativeJSSE, Certicom, IBMJSSEFIPS, SunJSSE

                                                            Issue Tracking: ClearQuest, XPlanner, Trac, Bugzilla, Jira, Mylin

                                                            IDE: Eclipse, SpringSource ToolSuite, plugins: WTP (Web Tools Platform), DTP (Data Tools Platform), ClearCase, Subclipse, m2eclipse, UML2 Tools SDK

                                                            Profiling: JProfiler, JVisualVM, JHat, JConsole, SMAPS

                                                            Modeling: UML, OO round trip – Java, DB schema modeling, DDL generation, reverse engineering, eclipse integration, measure architecture violations, complexity debt

                                                            Enterprise Patterns: WS-Orchestration, BPEL, WS-Choreography/WSDL 2.0 message Exchange Patterns (see Enterprise Integration Patterns), JAX-WS asynchronicity (polling, callbacks, rendezvous with Future, Continuation Passing Pattern), XMPP, MOM (message oriented middleware), JMS (pub-sub), SOAP over JMS, WS (standard request-response), VMWare messaging via GN3/IOS, Contract First WSDL (e.g. Spring WS)

                                                            Websites: stackoverflow, infoq.com/java, the serverside, refcardz, informit, developerworks (esp. automation for the people), martin fowler, sdtimes, http://java.sys-con.com/, http://java.dzone.com/, Java Reference Guide (http://www.informit.com/guides/guide.aspx?g=java), java almanac, http://www.theregister.co.uk/software/

                                                            Books: J Dev Almanac, Effective Java, Java PowerTools, Pragmatic (Ship it, Manage it, Pragmatic Program Automation), Clean Code (smells), Refactoring Large S/W Projects, Agile s/w with Spring, Hibernate & Eclipse, Java Enterprise Design Patterns, Pattern Oriented S/W Architecture, Antipatterns, pragmatic programmer, beautiful architecture

                                                            Nice super list of tech resources

                                                            Technology Resource Links
                                                            SOA, Java, cloud, db, GIS, ORM, reporting, security patterns, testing, thought leaders (Eckel, Spolsky)