Monday, October 15, 2012

Design Patterns used in Spring ( in IOC, AOP and MVC)


Spring is a collection of best-practice API patterns. Having said that, there are many of these which are used by Spring to provide different module/functionality. To categorize them:

Spring DI/IOC:
  •  Strategy
  •  Singleton
  •  Factory

Spring MVC:
  •              Model View Controller
  •       View resolver
  •        Front Controller
  •              View Helper

Spring AOP and Remoting:

  •       Proxy
  •            Remote Proxy


BeanFactory and Context

  •       Singleton
  •        Factory
  •        Observer-Observable


PS: This list may not be complete/exhaustive/precise. However, the listed patterns are correct as per author’s knowledge.

Experts comment are welcome! :)

Tuesday, October 2, 2012

ExtJs Tutorial #1: Hello World :)


Introduction:

I have already provided a brief introduction in my previous post. So, here we are going to setup the ExtJS API and walk through a simple example of hello world.

Pre-requisites:
  •         A browser (IE/Firefox/Chrome/Safari). Preferably, Chrome and Firefox, b'coz it comes with easy debugging tools like Chrome Developer Tools and Firebug, respectively.
  •         A web-server (If or When you are working with backend data and AJAX)
  •     ExtJS API. You can download it from http://www.sencha.com/products/extjs/download

 Typical Project Hierarchy:

 A typical project with extjs looks like below:



Please note that when you unzip the downloaded file, you will the find all the js files upfront, which are kept here in extJSLibt. I have organized it in a separate folder, which is obviously for better management of code base.

Also, the resources folder comes as a part of framework, which contains the necessary CSS files, images and theme related files etc. So, its important to include this folder as well.

Understanding the major js files and their uses:
When you unzip the Ext JS 4 download, you will see the following files:
1.      ext-debug.js - It provides the minimum number of core Ext JS classes needed to get up and running. This file is only for use during development. Any additional classes should be dynamically loaded as separate files using Ext.require:

For example, Ext.require('Ext.container.Viewport');
People who have worked with Dojo will be familiar with this approach.
2.      ext.js - same as ext-debug.js but minified for use in production.
3.      ext-all-debug.js - This file contains the entire ExtJS library. This can be helpful for shortening your initial learning curve, however ext-debug.js is preferred in most cases for actual application development.
This also helps you in debugging and resolving minor browser related issues or in case you want to do any changes in the default functioning of library. However, it is important to note, any changes you do should comply with the kind of license requirement/policy (http://www.sencha.com/products/extjs/license/) you have.
4.      ext-all.js - This is a minified version of ext-all-debug.js that can be used in production environments. However, it is not recommended since most applications will not make use of all the classes that it contains.
Instead, it is recommended that you create a custom build for your production environment, will cover this in a different post sometime later.
5.     bootstrap.js - This is the file which helps you to load the core js file (ext-all.js) depending upon the environment (local/dev/stage/prod) you are working on. Typically you won’t need it or need to change the code slightly as per your file names and need.


helloWorld.html:

<html>
<head>
    <title> My Application </title>

    <link rel="stylesheet" type="text/css" href="../extjs/ extJSLib/resources/css/ext-all.css">
    <script type="text/javascript" src="../extjs/ extJSLib/ext-all-debug.js"></script>
    <script type="text/javascript" src="../javascript/myApp.js"></script>
</head>
<body>
Home Page.
</body>
</html>


app.js:

Ext.onReady(function (){
      sayHello();
});

function sayHello(){
      Ext.Msg.alert('Hello World!!');

}


app.js explained:

Ext.onReady():

As per docs, Ext.onReady adds new listener to be executed when all required scripts are fully loaded. In other words, it is more like a function be executed on page laod.

Ext.Msg.alert():

As per docs, it displays a standard read-only message box with an OK button similar to the basic JavaScript alert prompt.


Monday, October 1, 2012

RUI (Rich User Interface): The buzz..and The Players!!


User Interface ‘has been’, ‘is’ and ‘will be’ one of the most important aspects of web application development. Now a day, for mobile app development as well. Also, it is one of most important criteria for ‘user/business acceptance’ as well as ‘end user delight’.

Well..a lot of pleasant sounding terms above, but, how do we accomplish this? The answer is RUI…or Rich User Interface.

Enterprises have been spending a lot in developing their own standards and APIs for RUI. However, underneath this, it’s the blend of CSS and some Java Script API.

Some of the popular RUI frameworks available in market are ExtJS, Jquery, Prototype, Flex, YUI and Dojo. Each of them has its own pros and cons. Hence, it’s important to evaluate and decide on one of them before you go ahead with actual development, as per your need. Also, keep in mind the learning curve involved with each of them.
  
One of my favourites is ExtJs. So, following this post, I am going to write more about ExtJS. For now, introducing ExtJS. Here it goes:


ExtJS (pronounced as E-X-T-J-S) is a Rich User Interface framework, provided by Sencha (http://www.sencha.com). And, this is one of most used UI frameworks in the market today.

Interestingly, it comes with both open source as well as commercial license.

It has many rich look components, which are quite extensible. And, plenty of powerful features such as AJAX, DOM Manipulation, Communication Support for REST, Good looking Charts (rendered using SVG).

Object Oriented (Class based) approach allows you to make your own custom component by extending existing components. Further, MVC based approach allows you to make your UI layer modular and extremely maintainable. What’s more? You are bound to get rid of your FAT ugly looking JSPs (or server side scripts).

Further details can be found at http://www.sencha.com/products/extjs/

Watch this space, for more on ExtJS. J



Wednesday, September 26, 2012

The reason for this blog....

Hello F.R.I.E.N.D.S,

Hope you are doing great!

When I started my career 4.5 years back in Information Technology industry, I had only one goal, like many others comp. grads of my generation, to become a JAVA/J2EE developer. I would say, to an extent I achieved my goal.

However, in the process, I did not only learn little bit of Java, rather I learned many technical, functional, non-technical and non-functional aspects of industry and still learning. :)

So, here, in this blog, I am going to share my experience, mostly technical and IT industry related. I am hoping some of you may find it useful and interesting and I also get to learn more from many intellectuals out there.

So, stay tuned!!

Regards,
Kislay Kishore


Prototype

Prototype is another creation pattern. Intent:  - Intent is to create objects by cloning existing instance  - Specify the kinds of obj...