patterns

A pattern, apart from the term's use to mean "Template", is a discernible regularity in the world or in a manmade design. read more at WikiPedia

  •  

      <>Articles:

    A very good document, if you want to improve your code, Click HERE to download it

    This paper informs about design and implementation of error handling facilities in business information systems. It presents a pattern language for the object oriented design of components needed for error handling and also present sample code in different programming languages (C++, Java, Cobol, Smalltalk).
    List of Patterns

    Error Object, Exception Hierarchy , Error Traps, Assertion Checking Object, Backtrace , Centralized Error Logging, Error Handler, Default Error Handling, Error Dialog, Resource Preallocation, Checkpoint Restart, Exception Abstraction, Exception Wrapper, Multithread Exception Handling

    found at: http://www.objectarchitects.de/arcus/cookbook/exhandling/index.htm

    List of Patterns
    To get a better idea of the various patterns and the problems they are related to, we list all pattern names together with page references and questions defining the problems:

    Error Object* What characterizes an error? How to structure and administrate error information?

    Exception Hierarchy * How to structure error types? What role does inheritance play in the structuring of errors?

    Error Traps * What indicators are useful to detect erroneous situations and where to install the traps in the application code?

    Assertion Checking Object * How to implement Error Traps in an object oriented language without using a generative approach?

    Backtrace * How to collect and trace useful information for the system developers or the maintenance team, so that it supports them by the analysis of the error situation? Especially, if we have no or limited access to the stack administered by the system itself.

    Centralized Error Logging * How do you organize exception reporting so that you can offer your maintenance personnel good enough information for analyzing the branch offices problems?

    Error Handler * Where and how do you handle errors?

    Default Error Handling * How do you ensure that you handle every possible exception correctly (no unhandled exception and limited damage)?

    Error Dialog * How to signal errors to an application user?

    Resource Preallocation * How to ensure error processing although resources are short?

    Checkpoint Restart * How do you avoid a complete rerun of a batch as a result of an error?

    Exception Abstraction * How do you generate reasonable error messages without violating abstraction levels?

    Exception Wrapper * How do you integrate a ready-to-use library into your exception handling system?

    Multithread Exception Handling * How to schedule exceptions in a multithread environment?

     



    Softwares:

    Analysis

    Structural Analysis for Java "SA4J is a technology that analyzes structural dependencies of Java applications in order to measure their stability. It detects structural "anti-patterns" (suspicious design elements) and provides dependency web browsing for detailed exploration of anti-patterns in the dependency web. SA4J also enables "what if" analysis in order to assess the impact of change on the functionality of the application; and it offers guidelines for package re-factoring."
       

    Metrics

    Metrics sourceforge
    eclipse plugin
     
       
  • Agile testing is a software testing practice that follows the principles of agile software development. Agile testing is built upon the philosophy that testers need to adapt to rapid deployment cycles and changes in testing patterns. Providing and getting feedback early, fast and regularly is one of the testers main task.

    AgileTestingPoster

    From http://bbv.ch/images/bbv/pdf/downloads/poster/bbv12_poster_agile_testing_1.0_web.pdf

    You can order a print version at http://www.bbv.ch/de/posterbestellung.html

    Find more at http://bbv.ch/de/unternehmen/publikationen.html

  • This package contains a dynamic polymorphic factory...

    •  New class can be add dynamically to the factory... even during runtime (dynamic)
    • Factory methods are in a separate class as virtual functions. (polymorphism)
    • Different types of factories can be subclassed from the basic factory.. (abstract)
    • Useful iin case of licence problem, since Concrete classes are created at runtime, and only need to reside in classpath (If they are not present the code still compile). Below, the example show multiple authorization and autorisation scheme, that can be switche on/off very fast.
    • Factory can be driven with an external condition (properties, registry....)
     
    Notice also that the specific concrete classes are dynamically loaded on demand...(class.forname())


    Source Code

    /**
     * Creation date: (7/19/2002 2:50:45 PM)
     * 
     * @author: Cedric Walter
     */
    public interface AuthentificationIF {
    
            public boolean Authentificate(HttpServletRequest req,                        HttpServletResponse resp);        public boolean hasAutorisation(HttpServletRequest req,                        HttpServletResponse resp);}
    
    public abstract class AuthentificationA implements AuthentificationIF {
    
    /**
      * AuthentificationA constructor comment.
      */
            public AuthentificationA() {
                    super();        }
    
           
    /**
      * Authentificate method comment.
      */
           
    public abstract boolean Authentificate(                       
    javax.servlet.http.HttpServletRequest req,                       
    javax.servlet.http.HttpServletResponse resp);
    }
    
    abstract class AuthentificationFactoryA {
    
            private static java.util.Map factories = new java.util.HashMap();       
    /**
      * ComputeFactory constructor comment.
      */
            public AuthentificationFactoryA() {
                    super();        }
    
            public static void addFactory(String id, AuthentificationFactoryA f) {
                    factories.put(id, f);        }
    
            public static final AuthentificationIF createAuthentification(String id)                        
    throws FactoryCreationException { if (!factories.containsKey(id)) { try { // Load dynamically Class.forName(id);
    }
    catch (ClassNotFoundException e) { throw new FactoryCreationException(id);
    } // verify that it has been stored if (!factories.containsKey(id))
    throw new FactoryCreationException(id);
    } return ((AuthentificationFactoryA) factories.get(id)).getAuthentification();
    } protected abstract AuthentificationIF getAuthentification();} /** * concrete class of the abstract factory */ public class MyAuthentificationFactory extends AuthentificationFactoryA { public MyAuthentificationFactory() { super(); } /** * not use since it is subclass */ protected AuthentificationIF getAuthentification() { return null; } } /** * @author: Cedric Walter */ public class NimiusAuthentification extends AuthentificationA implements AuthentificationIF { private static class Factory extends AuthentificationFactoryA { protected AuthentificationIF getAuthentification() { return new NimiusAuthentification(); } } static { AuthentificationFactoryA.addFactory("com.waltercedric.gof.pattern.factory.NimiusAuthentification", new NimiusAuthentification.Factory()); }
    /**
      * Local constructor comment.
      */
            public NimiusAuthentification() {
                    super();        }
    
           
    /**
      * Authenficate method comment.
      */
            public boolean Authentificate(javax.servlet.http.HttpServletRequest req, 
    javax.servlet.http.HttpServletResponse resp)
    { //do some stuff return true; } public boolean hasAutorisation(javax.servlet.http.HttpServletRequest req,
    javax.servlet.http.HttpServletResponse resp)
    { //do some stuff return true; } } /** * @author: Cedric Walter */ public class NoAuthentification extends AuthentificationA implements AuthentificationIF { private static class Factory extends AuthentificationFactoryA { protected AuthentificationIF getAuthentification() { return new NoAuthentification(); } } static { AuthentificationFactoryA.addFactory( "com.waltercedric.gof.pattern.factory.NoAuthentification", new NoAuthentification.Factory()); } /** * Local constructor comment. */ public NoAuthentification() { super(); } /** * Authenficate method comment. */ public boolean Authentificate(javax.servlet.http.HttpServletRequest req,
    javax.servlet.http.HttpServletResponse resp) { return true; } /** * hasAutorisation method comment. */ public boolean hasAutorisation(javax.servlet.http.HttpServletRequest req,
    javax.servlet.http.HttpServletResponse resp) { return true; } } /** * @author: Cedric Walter */ public class ObtreeAuthentification extends AuthentificationA implements AuthentificationIF { private static class Factory extends AuthentificationFactoryA { protected AuthentificationIF getAuthentification() { return new ObtreeAuthentification(); } } static { AuthentificationFactoryA.addFactory( "com.waltercedric.gof.pattern.factory.ObtreeAuthentification", new ObtreeAuthentification.Factory()); } /** * Local constructor comment. */ public ObtreeAuthentification() { super(); } /** * Authenficate method comment. */ public boolean Authentificate(javax.servlet.http.HttpServletRequest req,
    javax.servlet.http.HttpServletResponse resp) { return true; } /** * hasAutorisation method comment. */ public boolean hasAutorisation(javax.servlet.http.HttpServletRequest req,
    javax.servlet.http.HttpServletResponse resp) { return true; } }
  • Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.



    Source Code

    /**
     * Knows which subsystem classes are responsible for a request.
     * Delegates client requests to appropiate susystem objects.
     * @role __Facade
     */
    public class Facade {
            /** reference to particular subsystem */
            private SubsystemA theSubsystemA;        /** reference to particular subsystem */
            private SubsystemB theSubsystemB;        /** this method is called by client */
            public void facadeMethod() {
                    // multiple subsystems could be involved
                    // to provide some functionality
            }
    }
    
    /**
     * Implements subsystem functionality. Handles work assigned by the Facade object.
     * Has no knowledge of the facade.
     * @role __System
     */
    public class SubsystemA {
            /** some functionality */
            public void subsystemFunctionality() {
            }
    }
    
    /**
     * Implements subsystem functionality. Handles work assigned by the Facade object.
     * Has no knowledge of the facade.
     * @role __System
     */
    public class SubsystemB {
            /** some functionality */
            public void subsystemFunctionality() {
            }
    }
  • Use sharing to support large numbers of fine-grained objects efficiently.




    Source Code

    /**
     * Declares an interface through which flyweights can receive and act on
     * extrinsic state.
     * 
     * @role __Flyweight
     */
    public interface Flyweight {
    	void sampleOperation(FlyweightContext context);
    }
    
    /**
     * Represents extrinsic state of flyweight(s).
     * 
     * @role __State
     */
    
    public interface FlyweightContext {
    }
    
    /**
     * Implements the Flyweight interface and adds storage for intrinsic state, if
     * any. Objects of this class must be sharable. Any state it stores must be
     * intrinsic (independent of this object's context)
     */
    
    public class ConcreteFlyweight implements Flyweight {
    	public ConcreteFlyweight(Object key) {
    		// initialize internal state
    	}
    
    	/** @see patterns.gof.flyweight.FlyweightsampleOperation(FlyweightContext) */
    	public void sampleOperation(FlyweightContext context) {
    		// provide implementation here
    	}
    }
    
    /**
     * Creates and manages flyweight objects. Ensures that flyweights are shared
     * properly. When a client requests a flyweight, this factory supplies an
     * existing instance or creates one, if none exists.
     * 
     * @role __Factory
     */
    
    public class FlyweightFactory {
    	private HashMap flyweight;
    
    	public FlyweightFactory() {
    		flyweight = new HashMap();
    	}
    
    	public Flyweight getFlyweight(Object key) {
    		if (flyweight.containsKey(key)) {
    			return (Flyweight) flyweight.get(key);
    		} else {
    			Flyweight newFlyweight = new ConcreteFlyweight(key);
    			flyweight.put(key, newFlyweight);
    			return newFlyweight;
    		}
    	}
    
    	/**
    	 * @return new instance ofunshared flyweight
    	 */
    	public Flyweight getUnsharedConcreteFlyweight() {
    		return new UnsharedConcreteFlyweight();
    	}
    }
    
    /**
     * Not all Flyweight subclasses need to be shared
     */
    
    public class UnsharedConcreteFlyweight implements Flyweight {
    	/** @see patterns.gof.flyweight.FlyweightsampleOperation(FlyweightContext) */
    	public void sampleOperation(FlyweightContext context) {
    		// provide implementation here
    	}
    
    }
    
  • A collections of links, this time. A lot of persons have already done a stunning job:

    • Sun Java Center - J2EE Patterns:The J2EE Patterns presented here, a collection of J2EE-based solutions to common problems, reflect the collective expertise and experience of Java technology architects in the Sun Java Center over the past three years.
    • Wiki pattern catalogwith some famous contributors like Kent Beck and co.
    • The server side: get the latest informations on Patterns.
    • Javaworld a list of articles

  •  Meta-Patterns: Design Patterns Explained
    Moisés Daniel Díaz Toledano. Email : This email address is being protected from spambots. You need JavaScript enabled to view it.
    www.moisesdaniel.com

    MetaPatterns can be contemplated like a form of understanding the underlying mechanisms of patterns and the form in which they work, and even as a new patterns’ classification.
    The principal objective of patterns is capturing good practices that allow us to improve the quality of the design of systems, determining objects that support useful roles in a specific context, encapsulating complexity, and making it more flexible.
    We can observe that the structure of these solutions (patterns) repeats, using a series of basic mechanisms (even in different levels of abstraction) to produce the same effects in the system.

  • AgileRequirementEngineeringPoster

    From http://bbv.ch/images/bbv/pdf/downloads/poster/bbv11_poster_agile_re.pdf

    You can order a print version at http://www.bbv.ch/de/posterbestellung.html

    Find more at http://bbv.ch/de/unternehmen/publikationen.html

  • Books:

    Softwares:

    Analysis

    Structural Analysis for Java"SA4J is a technology that analyzes structural dependencies of Java applications in order to measure their stability. It detects structural "anti-patterns" (suspicious design elements) and provides dependency web browsing for detailed exploration of anti-patterns in the dependency web. SA4J also enables "what if" analysis in order to assess the impact of change on the functionality of the application; and it offers guidelines for package re-factoring."
      

    Metrics

    Metrics sourceforge
    eclipse plugin