Spif

Spif is the Simplest Possible Infrastructure Framework for distributed Java applications like J2EE.

Spif provides a way of organizing the infrastructure needed for reading and writing model objects. It allows you to start with a very simple infrastructure and plug in extensions as necessary, without changing the business code using the infrastructure.

For example you may start by storing your objects in a simple hash, then plugging in persistence, remote accessiblilty, caching, locking and access checking as needed. Each such feature is added by one single line of code in your application.

Getting started

Start using Spif in three steps:
  1. Download spif and include spif.jar it in the classpath of the vm(s) in which you'll use it.
  2. Setup a Spif service chain somewhere in your vm startup code:
    The simples possible chain will do for now:
    import net.sf.spif.*;
    ....
    Store.setChained(new HashStore());
    
    Some examples of real-world chains are found here.
  3. Use Spif as object infrastructure:
    import net.sf.spif.Store;
    ....
    Employee you=new Employee();
    Store.put(you.getId(),you);
    ....
    boolean writable=true;
    Employee you=(Employee)Store.get(yourId,writable);
    you.setSalary(employee.getSalary()*1.5);
    Store.put(you.getId(),you);
    ....
    Store.remove(yourId);
    

    You can find the details in the Javadoc.

When to use Spif

Systems which

will benefit from using Spif. That is most server applications, and especially J2EE applications. Spif is a very small framework, it is only concerned with model object infrastructure. You may read all the code you have to use in 5 minutes.

Spif is the framework which emerged from following these design rules on some J2EE projects:

  1. Keep business logic as a pure object model at the server
  2. Partition the model into an operational and a knowledge layer
  3. Partition the operational model into edit bubbles
  4. Use the same model on the client side
  5. Minimize the touching point between the infrastructure and the model
  6. Provide unlimited flexibility at this touching point
  7. Remove all unnecessary flexibility (the fear-motivated flexibility)

Architectures following these rules are called Model Centric Architectures.

SourceForge Logo