View RSS Feed

Recent Blogs Posts

  1. Bean Definition Inheritance in Spring

    by , 07-07-2012 at 06:20 PM
    Following information is contained by a bean definition:

    • Configuration information
    • Constructor arguments information
    • Container specific information like method initialization
    • Property values information
    • Names of static factory methods

    Configuration data is inherited from the parent definition by the child bean definition. Some values are added or overridden by the child definition. There are no direct concerns between the java class ...
    Categories
    Bean
  2. Choosing composition vs. inheritance

    by , 04-26-2012 at 06:14 PM
    Both inheritance and composition permits you to put the sub-objects in new class. One may be amazed regarding the difference present b/w two and when one could be chooses over the other.

    Generally, composition is used if an existing class features are required in your new class but not the interface. This means that an object is embedded to use it for implementation of functionality of your new class. However, your new class user may see the interface that has been defined instead ...
    Categories
    Composition
  3. Inheritance

    by , 01-08-2012 at 11:11 AM
    Process of including methods and variables of base class into its child class is known as Inheritance. The core benefit of Inheritance is code reusability. In case of shared code, move it to base class to refractor and improve the code. It is also a process in which characteristics of one object are transferred into another object.
    Two main forms of inheritance are as following:

    • Implementation inheritance: Functionality of the parent class is reused in the child or derived
    ...
    Tags: inheritance Add / Edit Tags
    Categories
    Inheritence
  4. Inheritance vs. Composition

    by , 01-08-2012 at 10:55 AM
    The concept of inheritance is based on “is a” relationship. Composition is based on “has a” relationship. Both of these two concepts allow placing sub objects into your class. Below image explains this key relationship.

    Name:  48.JPG
Views: 1131
Size:  25.3 KB

    Inheritance Vs Composition


    Inheritance is based on one direction concept. You can not apply it in reverse. Extends keyword is used to specify inheritance.

    Composition is used in cases in which ...
    Categories
    Inheritence
  5. Using Inheritance - Substitution vs. Extension

    by , 11-30-2011 at 02:51 AM
    We are going to look at inheritance hierarchy. If we take a classic approach, as shown below we would see the methods that have been defined in the base class overridden in the derived classes. Inheritance guarantees that any derived class will have the interface of the base class. If you follow this diagram below, derived classes will also have no more than the base-class interface.

    Name:  Inheritance-Example.jpg
Views: 953
Size:  16.7 KB

    This can be thought of as pure substitution, because ...
  6. Design Principle: Choose Composition vs. Inheritance

    by , 11-30-2011 at 02:48 AM
    With composition or inheritance you can place sub-objects inside your new class. If you do this explicitly than you are using composition otherwise if you do this implicitly, you are using inheritance. I will outline the difference between the two below as well as point out one of the key design patterns to use in your development. Prefer composition vs inheritance.

    Composition is used when you want the features of an existing class to be included inside your new class, but not be ...
  7. Composition Syntax for Reuse

    by , 11-29-2011 at 05:21 PM
    One of the best features of Java is code reuse. But like any tool, it needs to be used effectively. Most programmers might be lead to think that when I talk of reuse only relates to extending a class. Now there is nothing wrong with reusing a class by extending it or using it directly. This type of reuse is using the class without the risk changing the existing code. First we can create objects of the existing class inside the new class. We call this composition. It is a new class composed of objects ...
  8. Composition Rather than Inheritance

    by , 11-29-2011 at 01:27 AM
    One of the more abused features of object oriented languages is inheritance. Second on the list of abused features of Java as an outgrowth of inheritance is the use of polymorphism. Developers seem to believe that everything should be inherited, and that classes should use polymorphism for every object irrespective of whether the arguments will be provided from external sources. Doing these sorts of things will make your designs more difficult to understand and lead to complications later when ...
  9. Extract superclass

    by , 11-20-2011 at 05:49 PM (My Java Tips)
    Inheritance is a very useful feature that object oriented languages provide. Normally you write parent class first and then the child class. When the design of the application is not final, you tend to put more code in a class than required. At some instance, you realize, that you may make a super class and put some methods in it. Eclipse provide an easy way to do this.


    Lets take an example. We have following class:


    Java Code:
    public class CSVFile{
    ...