Archive for the ‘Concepts’ Category

Page 1 of 3123

Reflection in Java – Simplified

Posted on November 24th, 2008 in Concepts, Featured, Java | 33 Comments »

There are times when you wish you had some access to the information present in your Java classes. Information, such as which fields, methods and constructors are defined in it. This information is called as the metadata of a class and there is a way in which you can access easily without doing tedious coding or resorting to any hacks. It is called as Reflection.

Reflection in Java is done by using using the java.lang.Class class. This class provides access to all the information within your own applications classes or even the regular java library classes. Let’s say you have a class in a package called then if you need the metadata of the Employee class you would have to first assign it to the Class as :

Class c = Class.forName(“;

Accessing Fields, Methods and Constructors with Reflection

If you are not sure which fields and methods are declared in a class and you don’t have access to the source code then you can easily get this information by simple looping.

For example, if I wanted to access the fields and methods declared in the class Employee then its as simple as the below code.

Field[] fields = c.getFields();
Method[] methods = c.getMethods();
for (Field f : fields)
System.out.println("Field: " + f.getName());
for (Method m : methods)
System.out.println("Method:" + m.getName());

You might get some additional methods if you use the getMethods() method. This is because Read the rest of this entry »

Mystery of Accessibility in Local Inner Classes

Posted on April 14th, 2008 in Concepts, Java | 26 Comments »

Here is an interesting concept which I came across just recently and considered it worth sharing. I was reading about inner classes concepts where in, there is a type of inner class called the local inner class. Local inner classes are those classes which reside within the function of a method belonging to an outer class. The code can be something shown like this.

public class LocalInnerClassTest {
	public void defineInnerClass() {
		class MyLocalInnerClass {
			public void doSomething() {				

Now lets suppose we want to pass a variable in the defineInnerClass() and pass it to the doSomething() for some computation, then according to the specifications on local inner classes methods we must declare the variables as final or else it will result in a compile time error. So the resulting code must be something as follows: Read the rest of this entry »

Designing Enterprise Applications – Approaches and Patterns

Posted on March 30th, 2008 in Concepts, Featured, Java EE | 3 Comments »

JavaWorld has published a useful research paper which discusses how to discern which design patterns and frameworks would work best for your enterprise applications, written by Chris Richardson. As a developer it is very essential to know about the different strategies one would adopt in a particular business scenario. This paper helps you in making important decisions about which design patterns would best suite a given set of requirements.

According to the research done by Chris for enterprise applications, here are some of the important points which the paper elaborates:

  1. Make use of the POJO approach, with lightweight frameworks like Hibernate for ORM and Spring AOP for transactional activities.
  2. EJB 3 makes it possible to have your business logic sit within your POJO and also make it run outside the container which makes it really usable.
  3. Implementing 3 tiers for an application which commonly include
    1. Presentation tier
    2. Business Interfaces for encapsulation + Business tier logic in classes
    3. Persistence tier for handling transactions and concurrency
  4. The design should involve,
    1. Modeling your business classes appropriately
    2. Code structuring principles for easier maintenance

While the above points are usually very well known amongst the developer community, it helps if you know which decisions should be taken when. Design patterns which have been established over the years play a key role in making such decisions. The white paper explains a few of the design patterns which are particularly mentioned when enterprise applications are into consideration.

I would like to enumerate here, some of the different design patterns which are Read the rest of this entry »

5 Most Exciting Search Tricks with Google Operators

Posted on March 10th, 2008 in Concepts, Featured, Google | 53 Comments »

Knowing about different techniques of searching in Google, has the biggest advantage in saving precious time. The more you optimize your queries, the more faster you get what you were looking for and finally the more quicker your work gets done. Its a bit of ‘more’ in everything when Google search tricks are applied. If you liked my earlier articles on how to use various tricks provided by Google then here are some ‘more’ for you.

The theme for this article is “Definitive Search“. It means that, instead of beating around the bush for carrying out permutations and combinations of your search queries, why not carry out the search for exactly what we are looking for. By doing this, you would become more sure of getting the most relevant articles to your queries. Notice the ‘more’ here too! :)

Most of the Definitive Search tricks are obtained by using the Google Advanced Operators. I would like to specify in this article as to where the operators can be utilized ‘more’ efficiently. I was myself thrilled when I tried using these operators which lead me into writing this article.

Google Definitive Search Tricks

For this article I am taking a particular case study for search query optimization. So here we go… Read the rest of this entry »

5 Most Fantastic Movie Search Tricks With Google

Posted on February 7th, 2008 in Concepts, Featured, Google | 23 Comments »

My article on 10 Most Amazing Google Search Tricks was very well received which made me realize that people have not yet seen the powerful features provided by Google. The tricks in the article were amongst the common ones which frequent searchers know. But there are still many more which a few rare search savvy people, termed “google hackers” seem to know.

The fact is that, people miss out on these tricks since they are busy finding the keywords! In order to make them aware I will be trying to put up different tricks and their usage as per the requirement so that it becomes easier for you to get the required information in an instant.

This article is specially for the movie lovers since I am one of them. I am not “crazy” about movies but when I am keen to watch a movie I make it sure that the money is well worth spent. This is the place where Google helps me to make most of the decisions quickly. Some of these decisions include finding:

  • Release date
  • Cast of the movie
  • Reviews of the movie
  • Theatres where the movie is being aired
  • Checking the schedule
  • Trailers

So let me reveal the 5 most fantastic Google Movie Search tricks that I frequently use: Read the rest of this entry »

Analyzing and Improving Your Website Performance

Posted on January 14th, 2008 in Concepts, Design | 10 Comments »

How many times have people said that your website is too slow and you found out that there is nothing you can do to improve its performance? The final option most of the times might have been either trying to change your hosting server (may be even blaming him for purposely slowing your website) or finding several ways to optimize your code.

Website performance

Over last few months I have been facing this same problem. I browsed the web for answers, even went ahead and bought many books on Website Optimization. All of them more or less targeted the same issue of Read the rest of this entry »

10 Most Amazing Google Search Tricks

Posted on January 6th, 2008 in Concepts, Featured, Google | 273 Comments »

Searching on Google can be a magical experience once you find out how to make your search queries efficient. By making efficient I mean using some tricks or the cheat sheet provided by Google itself to quickly find what you actually require. Having being hooked onto Google for a long time now, I have come across some amazing search tricks which can change the way you look at Google today.

Google Search Tricks

In this article I will list down the search tricks which I use quite frequently. Be it finding time, meanings or watching the cricket score, searching PDF’s, with Google as the search engine life cannot be more simpler. Here are the 10 most amazing Google Search tricks: Read the rest of this entry »

Page 1 of 3123