Monday, March 31, 2008

Rife: Full-Stack and Open-Source Java Framework



In a debate with advocates of various Web frameworks, such as JSF, Spring MVC, Ruby on Rails...and Rife ( Rife?????), happened at The Server Side Java Symposium, on last Friday, march 28th, discussed about which Java Web Framework is the best. Common news, no??

Right, Sure. But, for me, surprising appeared one name... which? Rife.

RIFE is a full-stack, open-source Java web application framework, offering fast results with the promise of maintainability and code clarity. Development becomes productive, consistent and reusable.



Differences

Here are some differences from other Java Web Frameworks.

  • You get 90% of the features with 10% of the usual effort, thanks to its full stack;
  • Logic-less HTML templates that can be previewed in any browser and edited with standard tools;
  • Uniform component model, designed from the ground up for reusability: applications, sub-sites, pages, porlets, widgets, ... can be easily packaged and placed in any other context;
  • Integrated native Java web continuations and flow continuations;
  • Metaprogramming, driven by your domain model, but without polluting it;
  • Flexible declaration and configuration with support for plain Java as well as XML;
  • Core support for web data flow as well as page logic flow;
  • Integrates with existing solutions such as Spring and standard JDBC datasources;
  • Multi-dimensional conversational state management with scoping;
  • Language-independent template engine with support for XHTML, HTML, XML, Text, SQL, Java;
  • Persistence layer with content management integration and versioning;
  • Designed for the creation of consistent maintainable applications as well as on quick delivery;
  • Embraces standard protocols and specifications, providing larger building blocks by wrapping lower layers with high-level functionalities;
  • Out-of-container testing with full introspection capabilities of the executed flow and components;
  • Lightweight execution model that has been proven in production;
  • Built for Java 5 with intelligent downgraded support for Java 4, and
  • Designed for developer comfort: minimal application restarts thanks to automatic detection of file modifications.

Features

I tried to pass the features of Rife, and some explanation about each one.

Web application engine

RIFE's web engine provides you with a solution that values maintainability above everything else, but without compromising on productivity.

Integrated web continuations

Continuations are constructs that are inspired from Scheme.

IoC support

RIFE focuses on the retrieval of the references and the injection of objects into the web engine elements.

Out of container testing (Nice! )

RIFE web applications can be fully tested outside of a servlet container.

Content management framework

RIFE provides a Content Management Framework that is geared towards the process of storing, loading, validating, formatting, transforming, versioning, retrieving and streaming of various content types.

Bidirectional multi-format template engine

Many template engines start out with a desire to separate presentation from logic.

Template content transformation

The content of each template can be transformed at instantiation.

Centralized meta-data facility

The main purpose of constraints is to alter the default behavior of a data type and to clearly set the accepted limits and behavioral directions.

Authentication framework

RIFE provides its own framework for the authentication of web applications.

JDBC abstraction layer

Using raw JDBC directly requires a lot of discipline and boilerplate code.

Database query builders

RIFE has a layered approach to database interaction and persistence.

Persistence layer

The JDBC abstraction layer and database query builders offer everything to create a generic database persistence engine.

Configuration framework

The configuration of your applications can be isolated into dedicated XML files.

Central application life-cycle management

Each application is a collection of optionally dependent participants that are responsible for initializing and cleaning up the required context and features.

Cron-like scheduler

RIFE provides an asynchronous scheduler as an application participant that can be set up to run tasks at specific moments.

Asynchronous mail queue

Sending mails in real-time can become a huge bottleneck in popular web sites.

Content syndication framework

RSS 2.0 and Atom 0.3 are natively supported and can be generated in real-time.

Resource abstraction

Retrieving and writing resources is completely abstracted.

Web services

RIFE provides support for SOAP and Hessian web-services through the integration of 3rd party libraries.

Integration

RIFE integrates and supports a variety of back-end libraries, frameworks and tools.

Databases

Scripting languages

Servlet containers

Image readers and convertors

Clustering

Web services

Frameworks

Messaging


Examples

You can See some examples, here.


Open-Source Concept ( COOLLL!!)

Like an open-source project works, Rife has a Rive Live Guide as a RIFE Users Guide, where the people can write.


So, Wake up and keep watch this framework and collaborate. :)

Sunday, March 23, 2008

Mockito: A Test Spy implementation

What's the best Mock Framework that you think?

Some people say: "EasyMock, sure!".

Others: "JMock!".

Wait wait wait! You be heard about Test Spy?

Mockito is an implementation of Test Spy, but doesn't use this metaphor at all. Created by Szczepan Faber, aiming to become the best mocking framework!

So, what Mockito do?

Like expect-run-verify library, as EasyMock and Jmock, Mockito offers simpler and more intuitive approach. You ask questions about interactions after execution. Using other libraries, you often look irrelevant interactions.

Mockito has similar syntax to EasyMock, therefore you can do refactor safely! Differ by notion of expectations, there is only stubbing or verification.

Some other features:

* Mocks concrete classes as well as interfaces
* Allows flexible verification in order (e.g: verify in order what you want, not every single interaction)
* Supports exact-number-of-times and at-least-once verification
* Flexible verification or stubbing using argument matchers (anyObject(), anyString() or refEq() for reflection-based equality matching)
* Allows creating custom argument matchers or using existing hamcrest matchers
* Verification errors are clean - click on stack trace to see failed verification in test; click on exception's cause to navigate to actual interaction in code. Stack trace is always clean.
* Little annotation syntax sugar - @Mock
* Single-jar distribution mockito-all-1.2.jar includes cglib, objenesis and java source
* Zip distribution mockito-1.2.zip contains all jars, javadoc and source.