Monday, August 25, 2008

New Interviewer Syndrome

Referring to context of my previous blog…

What is the difference between Model-2 and Model-3 architectures? This is the question one of my colleague faced in is job interview.

One more question I was informed.. What are the different actions available in Struts? Expected answer was DispatchAction, ForwardAction, IncludeAction, DownloadAction, EventDispatchAction, LocaleAction, MappingDispatchAction etc.

How relevant are these questions in a job interview for a lateral? I call these questions as Text book questions which are intended to test the memory. I will refer asking this kind of questions in interview as “New Interviewer Syndrome”. Why? As I observed with most of interviewers including myself, in initial interviews interviewer will get tempted to do some show off and aim to ask questions which interview doesn’t even heard of. Most of the times these questions will be irrelevant. Just as in above examples, in first scenario there is nothing like Model-3 and in second case with my experience we rarely use the any thing other than DispatchAction. Ofcourse maturity will come with experience and will start asking relevant questions. Same is the case with me, now with experience of near century of interviews I concentrate only on basics that too practical things. So friends, please don’t get into this “New Interviewer Syndrome” and be good interviewers. All the best...

Model-3 Architecture?

What is the difference between Model-2 and Model-3 architectures? This is the question one of my colleague faced in is job interview. Never before I came across Model-3 architecture, so I googled for it. Soon I realized there is nothing official about Model-3 but I could find two references to it. One is a blog and other one is a mail-archive related to a project in sourceforge.

After studying these links I felt like any framework/application using JSF and EJB 3.0 is a Model-3 app. Let me explain why…
As per one of the links the below are the main properties of Model-3 architecture.

1. An improved event model.
2. A new scope that encourages efficient memory usage.
3. Standardized create, read, update, and write support between model and controller.
4. Supports cooperation and interaction between multiple MVC components ( portlets ).

Let’s take the Seam framework which uses JSF and EJB 3.0 and analyze about requirements. As we know JSF is a component based framework with support for different events and listeners like ActionListeners, ValueChangeListeners etc. So the first requirement is fulfilled. Seam introduces a context called Conversation context which is between Session and Request, which is the 2nd point. In 3rd point Author talks about simplified CRUD operations and easy linking of UI and persistence layer. This is in a way achieved with EJB 3.0’s entities which follow JPA.

Based on the above discussion can we conclude MVC with added events and JPA type persistence is Model-3?

Monday, August 11, 2008

JBoss Seam - Overlapping responsibilities?

Right now I am working on a project using JBoss Seam. I am getting queries about its advantages and differences. So like to discuss few of them in my blogs.

JBoss claims that Seam will shorten development life cycle. It’s true to some extent as it’s easy to create UI, EJBs, entities etc with help of JBoss developer studio. One reason JBoss gives for fast development is that Seam reduces the glue code required in application using JSF and EJB 3.0. This is done by enabling direct invocation of EJB methods from JSF. In other words EJB or entities can be used as backing beans. No business delegates in Seam. This is becoming arguing point for architects and designers from traditional 3 tier apps and frameworks.

As there are no POJO backing beans in Seam, the EJBs are becoming the first choice to include the code for ActionListeners, ValueChangeLiserners etc. These essentially will contain the presentation logic. This one way combines business logic with presentation logic. Seam also enables JSF to communicate with DB through entities. We can persist or query database using entities from JSF itself.

I advice people planning to use Seam keep the above point in mind and design classes accordingly.