11/3/11

Good Practices : Programming Tips Java

One of the Good practices while programming using Java is listed below.


Consider Static Factory Methods instead of Constructors

The normal way for a client to obtain an instance of itself is to provide a public constructor. But apart from this their is another technique which should be the part of every programmer's toolkit. A class can provide a static factory method, which is static method which returns the instance of the class.


Java Tutorial : What is a Class?

Java class is nothing but a template for object you are going to create or it’s a blue print by using this we create an object. In simple word we can say it’s a specification or a pattern which we define and every object we define will follow that pattern.


What does Java Class consist of :
  • When we create class in java the first step is keyword class and then name of the class or identifier we can say.
  • Next is class body which starts with curly braces {} and between this all things related with that class means their property and method will come here.



10/31/11

OOPs Concept : Polymorphism

Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object.


Any java object that can pass more than on IS-A test is considered to be polymorphic. In Java, all java objects are polymorphic since any object will pass the IS-A test for their own type and for the class Object.


It is important to know that the only possible way to access an object is through a reference variable. A reference variable can be of only one type. Once declared the type of a reference variable cannot be changed.


10/23/11

OOPs Concept : Inheritance

After discussing Encapsulation, now its time for 'Inheritance' as OOP Concept.


Inheritance can be defined as the process where one object acquires the properties of another. With the use of inheritance the information is made manageable in a hierarchical order.


When we talk about inheritance the most commonly used keyword would be extends and implements. These words would determine whether one object IS-A type of another. By using these keywords we can make one object acquire the properties of another object.


10/12/11

Conditions of Parallelism : Data Dependence

In Parallel or Sequential Execution of programs there are some concepts of dependence that we need to understand. These dependencies are known as Data,Control and Resource Dependence.


Here I will be focusing on Data dependence.


Data Dependence :


It can be explained as the ordering relationship between statements. There are five kinds of data dependence :


10/9/11

Object Oriented Programming (OOP) Explanation

Object-oriented programming (OOP) is a programming paradigm that uses "objects" to design applications and computer programs. It utilizes several techniques from previously established paradigms, including inheritance, modularity, polymorphism, and encapsulation. Today, many popular programming languages (such as Ada, C++, Delphi, Java, Lisp, SmallTalk, Perl, PHP, Python, Ruby, VB.Net, Visual FoxPro, and Visual Prolog) support OOP.