Tuesday, October 12, 2010

JSON versus XML

What about Binary Data?

JSON is a text-based data representation format, and as in all text-based formats, binary data need to be encoded as text. One approach is to convert the binary data to base 64 encoding, and another approach is to convert the binary data to other text-encoded formats, such as hex values, for example [\uDEAD, \uBEEF,...].

A better solution is to decouple the binary data via a Uniform Resource Locator (URL), where the binary data is represented or pointed to by the URL. In this approach the binary data wouldn't be embedded into the JSON text but would exist on a server on the web. This approach would allow for a separate mechanism for retrieval that can support caching and asynchronous retrieval and local storage.




Choosing the right data interchange format is an important design decision when building any network-aware software. This is especially true when designing mobile and embedded applications, where attributes such as lightweight and efficientare important characteristics to consider. Such characteristics are important because they translate to lower computation requirements and use of power, potentially better performance, and lower costs of operation.
In mobile applications, developers typically rely on home-grown data-interchange formats or on the Extensible Markup Language (XML). The advantage of the former is that it can be tailored to particular situations for the purpose of maximizing performance and/or computational resources. The advantage of the latter, when used over HTTP, is that it is a de facto standard for data interchange. In addition, the text-based/human-readable representation used in XML makes it easier to debug.
Yet these two approaches also have disadvantages, one being proprietary in nature, non-standard, and potentially non-interoperable, while the other one could be considered too heavy and verbose for data representation, again this is especially true for mobile and embedded applications.
JSON versus XML
The question of JSON versus XML is a topic left to the reader. I will say that XML purists question whether JSON is reinventing the wheel, and you can find lots of discussions on this topic by searching the web. At the end, the argument of JSON versus XML should be answered based on the run-time environment, parser availability, and integration and application requirements.
An alternative to consider is the JavaScript Object Notation or JSON, a lightweight data-interchange format. In this article I introduce JSON for data interchange in the Java Platform, Micro Edition (Java ME).
JSON is defined as part of JavaScript (ECMAScript) scripting language. Being native to JavaScript, JSON is ideal for browser-based applications. But JSON is not limited to JavaScript, and its lightweight characteristics make it very attractive for mobile and embedded applications in general.
JSON uses a very straightforward syntax that is based on two main data structures:
  • Collection of name/value pairs, and
  • Order list of values.
JSON is text-based, making it human-readable and great for debugging. JSON supports notation for all the basic data-types, and provides the methods to parse back and forth to Java native types.


Less Verbose, yet easy to debug (readable)

Readability of data over the wire is very much important to debug with ease. XML is very good at this, however XML requires two tags per data point, plus extra tags for the root nodes, this adds to size of the document. On the other hand JSON requires only one tag i.e. the name of the elements as such its less verbose. And the good part is that all this comes with sacrificing the readability.

More Speed & Less Bandwidth Utilization

Since the packet size is smaller in JSON compared to XML to convey the same data, the the data transmission between the Client and Server is faster using in turns helps to reduce network traffic as less number of bytes flow over the wire making the Server to get done quickly and the Client be more responsive.

Less Memory Footprint, faster generation & processing

The data structure for JSON is smaller resulting in less memory utilization on both Client and Server esp. at the Client Size, helping the browser to accept larger size JSON documents and parse them quickly with using much of Clients CPU and Memory making the Browser interface more responsive.

Supported in Browsers via Javascript

The other important benefit is you can parse JSON text with JavaScript's eval() function. No special libraries are needed and this works across all the browsers so one don't have to worry about cross-browser issues. As long as the browser has JavaScript enabled and support this eval() function, you will be able to parse JSON data.


Monday, October 4, 2010

Cloud Computing : Everything you Wanted to Know

When the idea of Cloud Computing took shape at first it sounded nebulous. However, it didn't take time for people to realize its immense benefits and the result is now there for everyone to see. It has become quite a rage and almost every small and large companies are now interested in Cloud Computing and are reaping the benefits of it. 


Cloud Computing has taken the IT world by storm and its future seems bright since more and more companies are taking the plunge. Now what does Cloud Computing mean? Cloud Computing can be simply put as something providing web services over the internet. That means it delivers business applications via a web browser while the data and software are stored on the servers. It is so easy to use that anyone having a personal computer and internet access can start using 'The Cloud'.



Why Cloud Computing? 


More from less is the apt way to explain the immense benefits of using Cloud Computing. By engaging in Cloud Computing, companies can optimize productivity as well as profit without making huge investments on in-house resources and technical equipments, something that IT companies always wanted. 


Since the Cloud Computing users do not own or rent usage of the web browser but only the services, they avoid capital expenditure by paying only for the services they use. They can either opt for the subscription-based service or adopt the utility model (pay-per-use service). 


By Cloud Computing companies save: 

  • Investments on in-house resources and technical equipments
  • Endless wait for the shipment of the product
  • Labor costs for deploying, maintaining, and upgrading software or application
  • Effort spent in training new personnelLicensing new software

Is Cloud Computing going to be a great force to reckon with? 


If statistics are to be believed then Cloud Computing will be a great force in the market in years to come. At present, the market opportunity of Cloud Computing is huge and Merrill Lynch puts it at $100 billion. By 2011, they predict it to increase further by $60 billion. However, there is nothing surprising about it since what else can provide you reduced costs, capital expenditure, increased storage, great profits, high automation, flexibility, mobility, and productivity that too so cheaply.


With the weakening of economy Cloud Computing has gained more popularity, as it is the only one that provides low-cost environments. Even large companies are taking interest in it, which was until then used by small and medium businesses.


Tough roads ahead for Cloud Computing 


The huge benefits of Cloud Computing aren't worth a dime if it isn't secure. What is at stake is the personal and business data and companies won't invest time, money, and effort where there isn't security. Providers of hosted services have to do whatever they can to earn the trust of companies by making it secure in all possible ways. Therefore, it can be said that Cloud Computing treads on a thin line; one false step and it will all come crashing down. Considering the advantages of Cloud Computing let us believe that it won't happen.

What is SAAS?

Is SaaS just Hype or Reality?


According to Gartner, the software-as-a-service (SaaS) market, which was $6.3 billion in 2006, would become $19.3 billion by year-end 2011. Moreover, as per the research carried out by Global Industry Analysts, SaaS market is worth 146.5 billion by 2015. Are these figures reality or just hype? Let's substantiate it. 


Like any other new concept, SaaS was also not received with open arms. SaaS was termed as an exaggerated concept that wouldn't stand the test of time, an inflated bubble that would burst with a single prick. Critics denounced it as something irrelevant and unrealistic. The major allegations that were leveled against it were:


Expensive

Since SaaS services are provided on a monthly subscription basis, the subscribers lose track of the        money spent and in most cases the expenses exceed the cost of on-premise ones. 


Higher Upfront Costs


SaaS doesn't lower hardware investment instead it increases overhead costs in the form of up-to-date computers, internal security and firewall solutions, and so on.


Slower Deployment 


SaaS is not easy to set up, as there are issues that complicate its deployment such as customization and integration.


Security Concerns


SaaS is accessed via a web browser, which makes it a potential candidate for being a less secure technology.


These allegations were made at a time when SaaS was relatively new and not many people were familiar with this new concept. However, today the situation is different and therefore any fresh allegations would be uncalled for since not only did SaaS stand the test of time but it also proved that all the arguments against it are baseless and unfounded. 


The advent of economic recession resulted in the mass adoption of SaaS as it was the most cost effective option that offered 24/7 accessibility, easy customization and integration features. This eventually resulted in people realizing its immense benefits.


Benefits of SaaS 



  1. Cost Effective 
  2. No Upfront 
  3. Costs Reduced 
  4. TCO Faster ROI 
  5. Data Security 
  6. Non-Platform Specific



These advantages were experienced not just by large organizations but small and medium businesses too realized their goals with SaaS. SaaS which was our future until recently is our present now. This itself substantiates the fact that the figures given at the beginning of the article are not exaggeration but soon to become reality.

What is SOA?

Service-Oriented Architecture (SOA) as a failure disapproving it as an exaggerated concept. Does it mean that SOA is a total failure? The fact of the matter is that there is more to it than meets the eye. With the advent of economic recession, SOA was written off by most of its critics on the ground that it was impractical since it brought in huge overhead costs. They considered cloud computing as more beneficial than SOA.The following are some of the reasons put forwarded by the critics to advocate that Service Oriented Architecture is a misleading concept:Complexity SOA is all about blending different software services. Deploying SOA based architecture helps organizations to establish loose coupling among services, which can be used within multiple business domains. This interaction between different services makes it a highly complicated and complex concept.Security Implications Security issues are considered as an important disadvantage of SOA. Since SOA facilitates interaction between services either within the company or between different companies, security is an important aspect that is threatened here. Interoperability SOA based architecture is not consistent when it comes to interoperability with other systems and services. Vendor Hype The hype around SOA is nothing but hard sell marketing technique adopted by the vendors. However, statistics prove that the criticism against SOA being an idealistic solution is entirely false and speculative. As per a recent survey conducted by Forrester between Dec 2008 and Feb 2009 when economic recession was at its zenith, 60% of the IT respondents reacted positively to SOA benefits and only one percent found fault with the methodology.Actually the disadvantages noted by the critics are something that the SOA supporters do acknowledge. However, the critics went one-step ahead and blew it out of proportion. Instead of openly denouncing and condemning it as a fallacy, what the supporters suggest is to properly assess and evaluate this concept to reap its innumerable benefits. Some of the strategies proposed by them to minimize its negative aspects are:Never undervalue the complexity of SOA based architecture- SOA is a complex and complicated technology deserving dedicated attention. Implementing SOA technology requires right skill sets and tools - Being a complex technology, only those who are adequately trained must be allowed to implement it.The security risk can be minimized by enforcing SOA Governance - SOA Governance helps to contain security breaches, overhead costs, and lack of interoperability.Domain understanding is very much essential - Details regarding every aspect of SOA based architecture must be properly understood by all in order to fully tap its potential.Never go by the vendor's words - Vendors do not know the intricacies of your business processes and therefore are not in a position to guarantee you anything. To put it briefly, SOA is a force to reckon with but its immense possibilities can be tapped only by those who make an effort to understand it perfectly.

Friday, April 23, 2010

Richfaces: Creation of rich:panelMenuGroup and rich:panelMenuItem

You can create your rich:panelMenuGroup and rich:panelMenuItem components in richfaces from a collection of parent components which internally contains another child collection.
In this scenario i have to show a rich navigation bar that contains the list of different products and each product has a list of particular brands i.e
                                                 Laptops--|
                                                                |--> IBM
                                                                |--> HP
                                                                |--> Sony
                                               Cameras--|
                                                                |--> Canon
                                                                |--> Sony

You can achieve this by using the following code:


<rich:panelMenu selectedChild="#{leftService.focusValue}" style="width:250px" mode="server"
                iconExpandedGroup="disc" iconCollapsedGroup="disc" iconExpandedTopGroup="chevronUp"
iconGroupTopPosition="right" iconCollapsedTopGroup="chevronDown" iconCollapsedTopPosition="right" expandSingle="true">
  <c:forEach var="pComp" items="#{leftService.plist}">
    <rich:panelMenuGroup id="#{pComp.id}" label="#{pComp.groupLabel}" value="#{leftService.menu[pComp.groupLabel]}" >
    <rich:effect for="#{pComp.id}" type="BlindDown" params="duration:1.5" disableDefault="true" event="onclick"/>
 <c:forEach var="cComp" items="#{pComp.childCompList}">
<rich:panelMenuItem label="#{cComp.label}" value="#{cComp.label}" disabled="#{cComp.disable}"
                   actionListener="#{testService.select}" disabledClass="#{cComp.disableStyle}" styleClass="#{cComp.fontStyle}">
<f:param value="#{cComp.label}" name="selectedValue"/>  
</rich:panelMenuItem>
</c:forEach>
 </rich:panelMenuGroup>
</c:forEach>
</rich:panelMenu>


Feel free to discuss....