Interface vs Abstract Class

Abstract classes
Abstract class is class which contain one or more abstract methods, which is implemented by sub classes. An abstract class can contain no abstract methods but also containe mehtod with body. Abstract classes are useful in a situation when some general methods should be implemented and specialization behavior should be implemented by subclasses.Abstract class can contain private as well as protected members.
When to use Abstract Class-If we have a base class where all the classes will perform the same function, then we can define that in our Abstract class. If you plan on updating this base class throughout the life of your program, it is best to allow that base class to be an abstract class. Because you can make a change to it and all of the inheriting classes will now have this new functionality.

Interface
Interface is extremely useful when you don’t want a big hierarchical type framework. As interfaces are implicitly abstract, they cannot be directly instantiated except when instantiated by a class which implements the said interface. The class must implement all of the methods described in the interface, or be an abstract class. An Interface can only have public members. A class implementing an interface must implement all of the methods defined in the interface, while a class extending an abstract class need not implement any of the methods defined in the abstract class.Maintainability–if you want to add a new feature (method) in its contract, then you must implement those method in all of the classes which implement that interface. However, in the case of an abstract class, the method can be simply implemented in the abstract class and the same can be called by its subclass.

When To use interface – Interfaces are useful when you do not want classes to inherit from unrelated classes just to get the required functionality.It is used where there of chances adding new method in future. Interfaces are more used to set standards. interface gave merely a specification,nothing implemented for any standalone project which can be changed at will its more design flexible and it can be utilized to model multiple inheritance.

Ref – http://www.interview-questions-java.com/java-questions/java-abstract-class-and-interface-interview-questions

kick it on DotNetKicks.com

Shout it

pimp it

Pin it

7 Most useful resources for Oracle ADF across the web

While searching for some good learning resources for oracle Adf,I found this link which can
Help us for learning this technology.May be it can useful for others.

1. http://www.oracle.com/technology/products/adf/learnadf.html
Demo tutorial,and example by oracle,developer guide.
2. http://www.oracle.com/technology/pub/articles/moore-adf.html
history of Oracle Adf
3 http://www.radio21g.com/faces/2007/06/29/adf-faces-for-dummies-0-what-is-oracle-adf-faces/
4. http://kohlivikram.blogspot.com/2008/12/learning-adf.html
5. http://radio.weblogs.com/0118231/
Most popular blog for oracle adf
6 www.oracle.com/technology/obe/ADF_tutorial…/index.htm
tutorial by oracle
7 http://blogs.oracle.com/shay/2008/01/how_do_i_start_learning_jdevel.html

Simple form Using ExtJs

Extjs is mainly used for UI design.Today I will create a simple form using this.And I will explain code also. So that any beginner can understand easily.

 

Ext.onReady(function(){
    Ext.QuickTips.init();
    Ext.form.Field.prototype.msgTarget = 'side';

    var bd = Ext.getBody();
    var simple = new Ext.FormPanel({
        labelWidth:  85, 
        frame:true,
        title: 'Vinay Form',
        bodyStyle:'padding:10px 10px 0',
        width: 450,
        defaults: {width: 250},
        defaultType: 'textfield',

        items: [{
                fieldLabel: 'Customer Name',
                name: 'first',
                allowBlank:false
            },{
                fieldLabel: 'Customer Last Name',
                name: 'last'
            },{
                fieldLabel: 'Address',
                name: 'company'
            }, {
                fieldLabel: 'Email',
                name: 'email',
                vtype:'email'
            }, new Ext.form.TimeField({
                fieldLabel: 'Time',
                name: 'time',
                minValue: '8:00am',
                maxValue: '6:00pm'
            })
        ],

        buttons: [{
            text: 'Save'
        },{
            text: 'Cancel'
        }]
    });

    simple.render(document.body);

After writing this code Form would be looking like below example
form

Ext.onReady(function(){ —– This function provides a way to make our code wait until the DOM is available, before doing anything.

Ext.QuickTips.init(); — It will display error with field in oval style.
Ext.form.Field.prototype.msgTarget = ‘side’; – Message will print on side of form field
var bd = Ext.getBody();
var simple = new Ext.FormPanel({ — Created a variable of Form panel
labelWidth: 85,
frame:true,
title: ‘Vinay Form’,
bodyStyle:’padding:10px 10px 0′, —- Setting the properties
width: 450,
defaults: {width: 250},
defaultType: ‘textfield’,

items: [{ Here we are creating the item for form.

fieldLabel: ‘Customer Name’,
name: ‘first’,
allowBlank:false
},{
fieldLabel: ‘Customer Last Name’,
name: ‘last’
},{ ……………….

Form is looking after writing this code with email validation also and combo box of time also.I hope it would clear some concept of EXT JS.UI design in ExtJs is easy.

For more detail go to www.extjs.com

pimp it