Sunday, October 6, 2013


I was recently asked in an interview - In java, how do you compare component based frameworks to request based frameworks? I explained EJB as an example of Component based framework and Struts as a request based framework but was not convinced if I did justice to the question.
Any ideas on what interviewer meant and what should have been compared??
regards, avajurug
share|improve this question

3 Answers

They were most likely looking for examples of web frameworks - for example, JSF is a component-based framework, and Struts is a request-based framework.
Request-based frameworks generally make it clear through their APIs that they're working with parsing an HTML request / generating an HTML response, while Component-based frameworks attempt to abstract this away and treat the application as collections of components with renderers and actions to do things.
In my opinion, component-based web frameworks are more trouble than they're worth - their main purpose is usually to development of a web app "easier" for developers unfamiliar with web development, and closer to traditional desktop development. However, in practice, when something goes wrong, you need to develop custom components, you need to customize the framework for something that isn't "out of the box" functionality, etc. you need to understand both underlying "traditional" web development andhow the component-based framework abstracts it - and if you're an experienced web developer and have existing solutions, utilities, libraries or snippets that worked in "traditional" web development, you'll waste time re-implementing them to work within the component-based framework.
share|improve this answer
Thanks Nate. I guess you are correct that probably they meant web frameworks. I am not familiar with JSF, so could not explain. Thanks for the answer. – user150014 Aug 8 '09 at 2:10
2 
+1 for great answer. Having used Struts and JSF for a few years now, I came to similar conclusions. – javashlook Aug 8 '09 at 10:58
Request based framework is a web framework that gets user's request then determine what the system should do and give back the response back to the user. So the flow is pretty much linear. You're thinking in actions: what does user want (request) -> what user will get back (response). An example of Request based framework is Struts. The modern Grails is pretty much a Request based framework too.
Component based framework is not like that. There is actually no clear sense of the flow from front to back. An example of it is not JSF, because in some way JSF is pretty much quite the same with Struts (since the creator of Struts and JSF is the same). A good example of Component based frameworkTapestry and Wicket. The paradigm in these two framework is different. You don't think in actions or request-response, but components and components. You define a component in your application, and you tell what the component does. But the flow does not have to be linear as in Request based framework.

ASP can vaguely compare to JSP / Servlet. ASP.NET can vaguely compare to JSF (build on top of Servlet/JSP).
ASP.NET and JSF are both component-based frameworks, while JSP and ASP are mostly viewtechnologies.

Rich Internet Applications: JSF vs ASP.NET

Rich Internet Applications are Web-based applications that function as traditional desktop applications however Web browsers (or clients) are required to access but unlike traditional applications. The key benefit RIAs possesses is the functionality to interact and manipulate with data, rather than simply visualize or represent it. And that’s the reason users demand their applications to be much more interactive, dynamic and highly responsive. It makes developer task more challenging to meet user expectation.
Market for the server-side languages is crowded and lot of languages are being used by the developers like JSF, ASP.NET, Adobe Flex, PHP and more which promises RIA features. So how can a new developer understand and realize that which application is best for his application. To find out the appropriate server side language always remains the hot issue for the companies and developers. For this reason I am going to compare the features of different frameworks. 
Two main technologies I am going to talk about are ASP.NET and JSF; both represent next generation development frameworks. Comparison will be based on ease of development provided to developer, tools for the framework and support to other frameworks.

What is Web 2.0

The term Web 2.0 is commonly associated with web applications that facilitate interactive information sharing, interoperability, user-centered design, and collaboration on the World Wide Web. To better understand Web 2.0 we can divide it into three sections:
  • RIA (Rich Internet Applications) – RIA helps to achieve the behavior of desktop application on web browser.
  • SOA (Service Oriented Architecture) – It is one of the key section of Web 2.0 that includes buzz words like Feeds, RSS, Web Services and Mash ups.
  • Social Web – Web 2.0 tends to interact much more with end user, end user is not only user of application but also a participant whether it is interacting with wiki or doing podcast or blogging.

What are Rich Internet Applications?

Rich Internet applications (RIAs) are web applications that have some of the characteristics of desktop applications, typically delivered by way of an Ajax framework, proprietary web browser plug-ins, advanced JavaScript compiler technology, or independently via sandboxes or virtual machines. Examples of RIA frameworks that require browser extensions include Adobe Flex, Java FX and Microsoft Silverlight. Rich Internet Applications serve users through web browser, via browser plugin or by an independent sandbox (Independent Desktop Application).
Rich internet applications use a distributed-function model rather than the simple thin-client–server model. RIAs enrich user experiences in part due to their reduced reliance on network/server communications.

Overview of Technologies

JSF (Java Server Faces)

JSF is a rich featured framework of JAVA technology. JSF provides a set of standard features that makes it a powerful and standard among the existing technologies available for the development of web application based on java technologies. Some of the features have been given below to justify the above statement.
  • JSF is standard web user interface framework for Java.
  • Built on top of Servlet API.
  • JSF is a component framework
  • UI components are stored on the server.
  • Easy use of third party components.
  • Event driven programming model.
  • Events generated by user are handled on the server
  • Navigation handling.
  • Can automatically synchronize UI components
  • JSF supports multiple client devices.
  • JSF has extensible architecture.
  • International language support.
  • Extensive tool support (Sun, Oracle, IBM etc.)
  • Rapid application development approach.

ASP.NET

ASP.NET is a programming framework built on the common language runtime that can be used on a server to build powerful Web applications. The first version of ASP.NET offered several important advantages over previous Web development models. ASP.NET 2.0 improves upon that foundation by adding support for several new and exciting features in the areas of developer productivity, administration and management, extensibility, and performance.
ASP.NET is Platform to develop Rich Internet Application has simplified web development and provides rich components to develop web applications. The obstacle face by ASP.NET or Microsoft is integration with other frameworks, although ASP.NET can be used with any of .NET based technologies (C#, VB, J#).
Below are the features of ASP.NET:
  • Easy Programming Model
  • Flexible Language Options
  • Great Tool Support
  • Rich Class Framework
  • Enhanced Reliability
  • Memory Leak, DeadLock and Crash Protection
  • Easy Deployment
  • Dynamic update of running application
  • XML Web Services
  • Mobile Web Device Support

Comparison

This section compares the feature and functionality provided by the frameworks.
FeaturesJSFASP.NET
SecurityJSF used J2EE security features, where the possibilities are numerous and mature.Provides lots of security features but most the security features are ties to Windows Platform
PortabilityOnce develop can run on any platform.Requires windows platform.
Ease of developmentLots of tools provided in the market which visual development or RAD facilityMicrosoft Visual Studio provides extensive support and have made really easy to develop web applications.
MaintainabilityJSF code is based on MVC structured and is really easy to maintain.Visual Studio provides good visual support to maintain the code but sometimes make messy code when using lot of visual mode.
IntegrationJSF can be easily integrated with other frameworks like spring, struts, or moreASP.NET can easily use .NET based Frameworks only as an application framework.
PerformanceReduces the data traffic and increase the performance by long term data cachePerformance in ASP.NET is better than JSF one of the main reason is it only focuses single platform Windows
AJAX integrationMore than 30 Frameworks availableMicrosoft ASP.NET AJAX Control Toolkit
Following table describes the few facts about the J2EE and .Net technologies
J2EE.Net
Type of technologyStandardProduct
Middleware Vendors30+Microsoft
InterpreterJRECLR
Dynamic web pagesJSF, JSPASP.NET
Middle-tier componentsEJB, Spring, JRuby.NET Managed components
Database AccessJDBC, Hibernate, SQL/JADO.NET, ODBC

Conclusion

Both frameworks have their pros and cons, like JSF is very good technology providing much enhanced features like Security, Interoperability, scalability, portability but it not easy to learn as compared to .Net. To build standard web application you have to know and follow standards of J2EE to get good result.
If we talk about ASP.NET it has a very good Integrated Development Environment provided by Microsoft, very easy to learn, even if you don’t know anything about ASP still you can develop fully interactive web application using visual editor.
If we stay within Microsoft technologies to develop application there is lots of support provided but it does provide much support to integrate with other technologies and if we successfully integrate with other technology it affects performance badly.
Both the frameworks are still working to get even better result and most of the time both of them follows each other, even if you see set of built in component provided in both are same and have same sort of functionality. So in the next article of this series I’ll compare the built in component and their support in integrated development environments.


No comments: