Thursday, March 27, 2008

When a boolean answer is not enought

This is the kind of post you will find in place like 'The Daily WTF' site, but i just couldn't resist to share what i found today while dealing with some External System:

ExternalSystem -> isDuableOperation( param)

-> Literal Formal Answer: "YES" | "NO"

At first i just thought why didn't return a boolean, nah never mind and i built all my API's around the following assumption

[java code]
public static boolean isDuableOperation(String param){
String output;
// Code that invoke the ExternalSystem;

return "YES".equals(output);
}

it seems simple and works perfectly fine, however few weeks later i got a call saying the UI-Flow was stop none of the inputs were validated correctly.

After digging in the logs the following was found:

[Log file simulation]
dd-mm-yyyy: INFO: com.xyz.ExternalSystemGateway-isDuableOperation -> "The variable ouput is 'ERROR' "

I was shocked, and reminds me WTF web site, then i said myself WTF with the guy who designed the interfaces and how the output should looks like, "YES/NO/ERROR". The most interesting part of this is that when i called the ExternalSystem Support even they were clueless...... :-S

Wednesday, March 12, 2008

Wicket, a web framework that provides real Event Driven Programming

I have being researching about Web Framework for a while, and i had stop with several frameworks on the road.

Frameworks, Frameworks Everywhere

Echo Cocoon Millstone OXF
Struts SOFIA Tapestry WebWork
RIFE Spring MVC Canyamo Maverick
JPublish JATO Folium Jucas
Verge Niggle Bishop Barracuda
Action Framework Shocks TeaServlet wingS
Expresso Bento jStatemachine jZonic
OpenEmcee Turbine Scope Warfare
JWAA Jaffa Jacquard Macaw
Smile MyFaces Chiba JBanana
Jeenius JWarp Genie Melati
Dovetail Cameleon JFormular Xoplon
Japple Helma Dinamica WebOnSwing
Nacho Cassandra Baritus Stripes
Click GWT


Looking for a framework that provides a way to represent a true Event Driven Model, instead of the common MVC Front Controller J2EE pattern and truly believe i hit on the right nail.

I grabbed most of the content from an article posted on javageek.com on 2006 and from Wicket Introduction pages, to gives you a brief of how amazing this framework can be for Web Development.

WICKET

So, what is Wicket? This is the description from the main site:

Wicket is a Java web application framework that takes simplicity, separation of concerns and ease of development to a whole new level. Wicket pages can be mocked up, previewed and later revised using standard WYSIWYG HTML design tools. Dynamic content processing and form handling is all handled in Java code using a first-class component model backed by POJO data beans that can easily be persisted using your favourite technology.

What that basically means is that Wicket separates the front-end visual design (HTML) from the back-end application logic (Java), using components (think Swing JComponents for the web). Instead of being another MVC framework, Wicket is more of an event-driven framework, like a traditional GUI. However, you could look at each 'component' as a tiny MVC with the 'view' part being the html code (but they won't tell it like that). As you will see later, all the application logic falls inside the Java classes, instead of mixing it with the pages, like JSP (true separation of concerns). The Java code is glued to the HTML page by using a special wicket:id attribute that can be assigned to almost any HTML tag, and that tells Wicket where do you want to render a component. Wicket comes with several components like Labels, Links, Lists, etc., which are uniquely defined on a webpage by setting an Id to the component, and the content which is represented by a Model.

Wicket, in my opinion, focuses the development efforts in the right place, inside plain Java code, and leaves the graphical presentation where it should be, inside html. At first you might find a little hard to grasp this paradigm shift, as so many developers are being 'forced' to rely on jstl and jsp scriptlets to accomplish logic programming for a page with all the other frameworks. But once you get used to this, I'm sure wicket will provide really fast development times.

Component state
In Wicket, all server side state is automatically managed. You will never directly use an HttpSession object or similar wrapper to store state. Instead, state is associated with components. Each server-side page component holds a nested hierarchy of stateful components, where each component's model is, in the end, a POJO (Plain Old Java Object). Wicket maintains a map of these pages in each user's session. One purpose of this page map (and the component hierarchy on each page) is to allow the framework to hide all details of how your components and models are accessed. You deal with simple, familiar Java objects and Wicket deals with things like URLs, session ids and GET/POST requests.

Non Intrusive for your HTML Designers
Wicket does not introduce any special syntax to HTML. Instead, it extends HTML in a standards-compliant way via a Wicket namespace that is fully compliant with the XHTML standard. This means that you can use Macromedia Dreamweaver, Microsoft Front Page, Word, Adobe Go Live, or any other existing HTML editor to work on your web pages and Wicket components. To accomplish this, Wicket consistently uses a single id attribute in the Wicket namespace ("wicket:id") to mark HTML tags that should receive special treatment by the toolkit. If you prefer not to render Wicket namespaced tags and attributes to your end-users, Wicket has a simple setting to strip them all out, resulting in ordinary, standards-compliant HTML.

Simplicity
Wicket is all about simplicity. There are no configuration files to learn in Wicket. Wicket is a simple class library with a consistent approach to component structure. In Wicket, your web applications will more closely resemble a Swing application than a JSP application. If you know Java (and especially if you know Swing), you already know a lot about Wicket.

Hopefully you will grasp the idea behind Wicket Framework and start playing around with it to understand how it truly works.

Tuesday, March 11, 2008

Are you still thinking what Java Web framework do you need to learn..

Here is an image found at indeed.com That just show a Job Graph ( 2005 / 2008), showing what's the market is asking for.

Saturday, March 1, 2008

Keeping Spammers away from gmail

This days everyone knows what spam means, just a very annoying way of marketing that eveybody has tasted.

Many popular sites started using the CAPTCHA methodology to avoid automatic registrations via BOTS since year 2000. Sites like hotmail, yahoo, gmail and others are using this method to avoid 'automatic account creation'.

CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) developed by the Carnagie Mellon University, was broken a weeks ago. It just matter of time to start seeing spammers with Gmail account and other sites being violated.

If you have a site that use this method to keep BOTS, outside your site. Be aware that
CAPTCHA is not longer safe.

Since, CAPTCHA was developed by Carnagie Mellon University. Can we expect some solution by
Google?. Lets think about that for a minute Google has always overpass everyone expectation with many contributions and probably they had already started some internal research on this. (This is just my assumption, i haven't heard anything official yet).

Lets wait and see what happens. :D