Monday, February 28, 2011

Application Server Vs Webserver

App server Vs Web server

Taking a big step back, a Web server serves pages for viewing in a Web browser, while an application server provides methods that client applications can call. A little more precisely, you can say that:

A Web server exclusively handles HTTP requests, whereas an application server serves business logic to application programs through any number of protocols.
Let’s examine each in more detail.

The Web server
A Web server handles the HTTP protocol. When the Web server receives an HTTP request, it responds with an HTTP response, such as sending back an HTML page. To process a request, a Web server may respond with a static HTML page or image, send a redirect, or delegate the dynamic response generation to some other program such as CGI scripts, JSPs (JavaServer Pages), servlets, ASPs (Active Server Pages), server-side JavaScripts, or some other server-side technology. Whatever their purpose, such server-side programs generate a response, most often in HTML, for viewing in a Web browser.

Understand that a Web server’s delegation model is fairly simple. When a request comes into the Web server, the Web server simply passes the request to the program best able to handle it. The Web server doesn’t provide any functionality beyond simply providing an environment in which the server-side program can execute and pass back the generated responses. The server-side program usually provides for itself such functions as transaction processing, database connectivity, and messaging.

While a Web server may not itself support transactions or database connection pooling, it may employ various strategies for fault tolerance and scalability such as load balancing, caching, and clustering—features oftentimes erroneously assigned as features reserved only for application servers.

The application server
As for the application server, according to our definition, an application server exposes business logic to client applications through various protocols, possibly including HTTP. While a Web server mainly deals with sending HTML for display in a Web browser, an application server provides access to business logic for use by client application programs. The application program can use this logic just as it would call a method on an object (or a function in the procedural world).

Such application server clients can include GUIs (graphical user interface) running on a PC, a Web server, or even other application servers. The information traveling back and forth between an application server and its client is not restricted to simple display markup. Instead, the information is program logic. Since the logic takes the form of data and method calls and not static HTML, the client can employ the exposed business logic however it wants.

In most cases, the server exposes this business logic through a component API, such as the EJB (Enterprise JavaBean) component model found on J2EE (Java 2 Platform, Enterprise Edition) application servers. Moreover, the application server manages its own resources. Such gate-keeping duties include security, transaction processing, resource pooling, and messaging. Like a Web server, an application server may also employ various scalability and fault-tolerance techniques.
An example
As an example, consider an online store that provides real-time pricing and availability information. Most likely, the site will provide a form with which you can choose a product. When you submit your query, the site performs a lookup and returns the results embedded within an HTML page. The site may implement this functionality in numerous ways. I’ll show you one scenario that doesn’t use an application server and another that does. Seeing how these scenarios differ will help you to see the application server’s function.

Scenario 1: Web server without an application server

In the first scenario, a Web server alone provides the online store’s functionality. The Web server takes your request, then passes it to a server-side program able to handle the request. The server-side program looks up the pricing information from a database or a flat file. Once retrieved, the server-side program uses the information to formulate the HTML response, then the Web server sends it back to your Web browser.

To summarize, a Web server simply processes HTTP requests by responding with HTML pages.

Scenario 2: Web server with an application server

Scenario 2 resembles Scenario 1 in that the Web server still delegates the response generation to a script. However, you can now put the business logic for the pricing lookup onto an application server. With that change, instead of the script knowing how to look up the data and formulate a response, the script can simply call the application server’s lookup service. The script can then use the service’s result when the script generates its HTML response.

In this scenario, the application server serves the business logic for looking up a product’s pricing information. That functionality doesn’t say anything about display or how the client must use the information. Instead, the client and application server send data back and forth. When a client calls the application server’s lookup service, the service simply looks up the information and returns it to the client.

By separating the pricing logic from the HTML response-generating code, the pricing logic becomes far more reusable between applications. A second client, such as a cash register, could also call the same service as a clerk checks out a customer. In contrast, in Scenario 1 the pricing lookup service is not reusable because the information is embedded within the HTML page. To summarize, in Scenario 2′s model, the Web server handles HTTP requests by replying with an HTML page while the application server serves application logic by processing pricing and availability requests.

Caveats
Recently, XML Web services have blurred the line between application servers and Web servers. By passing an XML payload to a Web server, the Web server can now process the data and respond much as application servers have in the past.

Additionally, most application servers also contain a Web server, meaning you can consider a Web server a subset of an application server. While application servers contain Web server functionality, developers rarely deploy application servers in that capacity. Instead, when needed, they often deploy standalone Web servers in tandem with application servers. Such a separation of functionality aids performance (simple Web requests won’t impact application server performance), deployment configuration (dedicated Web servers, clustering, and so on), and allows for best-of-breed product selection.

Friday, February 25, 2011

Websites to Find Free Programming and Development Classes Online

With web development, we need to constantly be evolving our knowledge in order to keep up with the latest trends and technologies. I have heard that the Internet reinvents itself every ten years, and with that being said, we as web developers need to do whatever we can to keep up with the latest information. Sometimes however, money and time are limited, thus we are not able to go back to school, or to advance our education due to these limitations. Therefore, a great option is online classes, especially when those online classes are free! In this post, I have a round up of websites where you can find free programming and development classes online. I hope you find it useful!

HP Learning Center

Link to HP Learning Center

MIT WORLD

Link to MIT World

P2PU

Yahoo! Developer Network

Google Tech Talks

WebCast Berkley

Open University

Utah State University Open Courses

Carnegie Mellon University – Open Learning


Friday, February 18, 2011

5 Tips for creating good code every day; or how to become a good software developer


Being a good developer is like being any other good professional, it’s all it’s about doing as much quality work as possible. There is a popular sentence that summarises it: “Do it. Do it right. Do it right now”.

1.- Have your own to do list for the day.

The best approach to complete complex activities is to break them down into simple activities. Do this every morning by breaking down the different activities you would like to complete for the day and assign them a schedule. This will help you to:

  • Have a better understanding of the activity.
  • Have a focused goal for the day
  • Improve your estimating skills. After a few days you will find that you can predict how much work you can do in a day.

2.- Do one thing at a time.

It’s been proven by different studies and published in different media (ie CNN) that it is more productive to be focus only on one task than to do multitasking.

Work in short batches of intense work of about 25 minutes with a 5-10 minutes rest. There are popular techniques like the pomodoro technique to help you manage the time. There are also tools to help you measure the time you spent on the different tasks,

3.- Do it right.

There are two keys to know if something is done right

  1. To be proud of the solution; it is not just any solution, it is a good solution. It follows the principles of the “Pyramid of the software quality“.
  2. The solution passes at least one review. Ask one of your colleagues that you respect as a good developer to review your solution and for his sincere opinion.

4.- Don’t finish something until it’s completely done

We all know that if there’s still a glass to wash, we cannot say that we have done the dishes, the same applies for painting a wall or driving to a destination but in software development we don’t do that, we say that we are done even when we haven’t completed all the unit tests or when we haven’t checked if the implementation is correct with the customer, that’s a typical behavior from Hope Driven Development and that’s evil.

Something is only done when you are 100% sure that it won’t be necessary to work at all on that solution unless the requirements change.

5.- Better late than sorry BUT better sorry than never

If it’s going to take you an extra day to complete the testing of some code, or to refactor a class which is unreadable, do it, that’s an investment in time for the future, but if you are stuck with something and you are delaying the project too much, just find an easier solution. It may not be as elegant as the one you are implementing, but at least you will have a solution. Make sure to document it as future risk for the project and something that will probably need to be revisited.

Thursday, February 10, 2011

Integration of Dravidian Murugan and Aryan Skanda

Tamil people take pride in naming Murugan a Tamil Kadavul. Their love for this particular deity is high and he is the most worshiped god in Tamil Nadu. His popularity is very high in south unlike north. The concept of Murugan as Tamil Kadavul is even expressed in latest film Billa in ‘Seval Kodi’ song.

Now let us make a small survey of names used to denote Murugan,

  • Kandha (dervative of Sanskrit word Skanda)
  • Subramaniyan(Sanskrit form Subhramanya)
  • Saravana(One who is born in Sara Vana, where Vana means forest)
  • Kumaran(which means younger one in Sanskrit)
  • Shanmuha (one with six faces in Sanskrit)
  • Karthikeya (also Sanskrit orgin)

As you see all the names is either Sanskrit or Sanskrit derivatives.

Let us now see his orgin, He is son of Shiva, Parvathi and brother of Ganesha.

So what are the elements which make him a real Tamil Kadavul?

What is the Myth as we know?

The basic Myth we know is as follows :

  • Shiva created Murugan to kill Curan.
  • He was born as six children and later integrated into one.
  • He arrested Brahma and taught Veda to Shiva in Swamimalai.
  • He fought for Gyana Palam and became an Aandi(saint) and stood on Palani hills.
  • He received his Vel from Parvathi in Sirakali
  • He destroyed Curan in Thiruchentur.
  • He freed the Devas and in turn got married to Indra’s Daughter Theivanai in Thiruthani. Fell in love and married Valli in Palamudhirsolai
  • Settled in Thriparankundram as Deity with two wives.

This myth is standard myth known to all Tamilians and explains the concept of Arupadai vedu(Concept of six sacred houses/Temples)।

What was the Early Tamil myth?

There is no structured myth in Tamil for Murugan, but from various Sangam sources and archeological evidence and by inference, Murugan had the following features and attributes:

  • Eternal youth and beauty
  • Prowess in hunt and fighting
  • Prowess in love making (like Kama in Sanskrit)
  • Ability to enter and possess human beings
  • Red colour
  • Vel as his main weapon
  • Connection with animals like peacock, cock ,elephant and possibly goat and snake
  • Slayer of enemy cur ,representing fear ,terror and anxiety
  • Love for and union with Valli
  • Son of Mother goddess Korravai.

So here you see Murugan has a mother and not a bachelor. He has lover Vali, the daughter of mountain chief with whom he makes sexual union. He is also god of love and victory.

How was he worshiped in Early Tamilnadu?

  • He was believed to posses Katampu tree , hence the name Kadamban
  • He also possessed young women.
  • His priest was known as Velan.
  • Murugan was believed to posses Velan and give blessings to people.
  • He was worshiped by a form of Dance called Veriyatu.
  • He was also god of mountainous region Kurunji.
  • He was worshiped as slayer of evil and terror Cur, which later became Curan.
  • He was also believed to be god of Love, and often quoted in Sangam literature for his interludes with Valli.



How does it differ from Northern Myth?

  • The Atharva Veda describes Kumaran as ‘Agnibhuh’ or son of Agni, the fire god.
  • The Satapatha Brahmana refers to him as the son of Rudra and the ninth form of Agni. Unbarable to bear handle the heat , the sisu was split into six and put in the Pond in Sara Vana (Saravana Poigai).
  • He is brought up as six children and later in fight with Indra he was combined as one person with six heads.
  • He lead the army of Gods(Devas) to defeat Taraka.
  • He is an eternal Bachelor or he is married to Devasena, which means army of gods.
  • His weapon was raging fire , since he was a form of Agni.
  • He is eternally young god
  • He has attributes of attributes of being a teacher (The Chandogya Upanishad refers to Skanda as the “way that leads to wisdom”)
  • Myth of Skanda arresting Brahma also comes up.

Some important points to be noted here are:

  • Skanda is not son of Shiva.
  • He has no mother.
  • He is an eternal bachelor.
  • He doesn’t have a weapon called Vel.
  • There is no mention of Valli.


The Integration:

Integration of Dravidian Murugan and Aryan Skanda has taken place when Pallavas came to Tamil Nadu. The Brahmins have spearheaded this integration.

Some important points in the integrated form:

  • The similar traits of both gods are eternal youth and destruction of evil.
  • The Aryan god had a father but no mother and Dravidian god has mother but no father.
  • The Dravidian mother Korravai was identified with Kali, Durga orAmman as early as Sangam age.
  • Since Kali /Durga were identified with Parvati the consort of Shiva, Murugan was identified as son of Shiva.
  • Taraka the asura in Aryan version was made brother of Surapadman(later name of Cur,Curan)
  • The eternal bachelor who was married to Devasena(Army of god) was changed to God with two wife to accommodate Valli, which was very famous tradition among Tamil .
  • Devasena was comfortably converted to Theivanai(Devayanai- Tamil myth says she was brought up by Ayiravatham the elephant of Indra – hence Deva yanai instead of Deva Sena or Deva Senai) a Brahmin girl and daughter of Indra.
  • The myth also was made up to represent two kind of marriage, Kalavu – love marriage (a Tamil/Dravidian tradition- Valli and Murugan) and Karpu – arranged marriage (Brahmin tradition- Theivanai and Murugan).
  • The fire weapon of North was replaced with Vel which is South Indian tradition.
  • Murugan as a mountain god is still maintained with all his temples situated on or near mountains.

When does the current myth come into Tamil Nadu?

  • The first textual evidence of Murugan as on of Shiva appears in Silapadikaram(4th Century AD).
  • The whole myth was first explained in Thirumurgatrupadai by Nakkirar(7-9th Century AD)
  • Final form of myth we know was written by Kasiappa Civasariyar in Kanthapuranam(14th Century AD)
  • Even in Kanthapuranam , Palani was not mentioned and surrounding myth of Gyana Palam was not included.
  • The standard Myth we know about Murugan was only written in 14 th century by Kasiappa Civacariyar a Brahmin priest at Kanchipuram.

How did the myth enter North India?

  • The myth of Muruga as we know was first written in Sanksirt sources in Sivapurana.
  • Sivapuranas were composed around 9-10th Century AD by Sanskrit scholars of south and it was heavily influenced by the Bakthi movement prevalent in south.
  • Unlike south, the North Indian myth says that Karthikeya was elder to Ganesha.
  • The popularity of Karthikeya is also not much in North India.

This is very brief essay to outline the process of Skanda – Muruga integration.

There some evidences which has come up recently to indicate Murugan might be Pre Historic god and an inherited God of Tamil people rather than an indigenous deity.

Tuesday, February 8, 2011

Top Java Blogs

Top Java Blogs

Java blogs are a great source for increasing you knowledge. There are many Java blogs which are a great source of Java language tutorials and help provide one a reference to the internal workings of the Java language (The blog you are read is one of them ).

In this article I will list down the top Java blogs which are updated frequently so that you can get the latest and best knowledge about the Java language and hence enhance your knowledge of the Java language. All the Java blogs in this list of world's top Java blogs are handpicked by me and have been linked by numerous people.


The list of Best and Top Java blogs follows:

1) http://nighthacks.com/roller/jag/
2) http://thedailyreviewer.com/top/java
3) http://javachamp.blogspot.com
4) http://rrusin.blogspot.com/
5) http://viralpatel.net/blogs/
6) http://tusharosum.blogspot.com/
7) http://learnwithrida.blogspot.com/
8) http://galiarta.blogspot.com/

All the blogs listed above are top rated and followed by a lot of developers and architects.

Hope you like the top Java blogs list given here.

Tips to use boolean variables in Java

Tips to use boolean variables in Java

In Java a boolean variable can be initialized to true or false only and not to integers like in C/C++. Moreover the primitive boolean variables are very widely used in java application development, j2ee development and also while developing java web services. The basic rules to use the boolean variables are:

1) When using a boolean variable in the if condition, there is no need of == operator. The if condition will evaluate to true or false based on the boolean variable’s value and there is no need of comparison operator. The if conditions are very widely used in java application development.

Example Code:

1
2
3
4
5
6
7
8
9
10
11
package example;
public class Test {
public static void main (String[] args) {
boolean var1 = true;
if(var) {
System.out.println(“The condition is true”);
} else {
System.out.println(“The condition is false”);
}
}
}

Here we can see that if condition is getting evaluated successfully as expected. Even though compiler doesn’t complain about using == operator, but there is virtually no need for comparison operator even if using that code in j2ee development.


This can be treated as a best practice or coding guidelines. Beginners are bound to use == operator for if conditions with boolean variables.


2) The DeMorgan's Theorm(NOT (P OR Q) = (NOT P) AND (NOT Q)
NOT (P AND Q) = (NOT P) OR (NOT Q) ) should be used when there are Java short circuit logical operators involved. The theorm can be demonstrated as:


Here is an example code to showcase the principle:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
package example.java;
public class Test{
public static void main (String args[]) {
String a1="Test",a2="Test";
if(!"Test1".equals(a1) && !"Test2".equals(a2)) {
System.out.println("This is test1");
}
if(!("Test1".equals(a1) || "Test2".equals(a2))) {
System.out.println("This is test2");
}
}
}


We can see that using the second if condition in the code above, makes it easier to understand the boolean expression. This is also commonly missed out by most of the Java developers and J2EE developers.