Saturday 28 April 2012

Java Features

Java Feature : 

The inventors of Java wanted to design a language which could offer solutions to some of the problems encountered in modern programming. They wanted the language to be not only reliable, portable and distributed but also simple, compact and interactive. Sun Microsystems officially describes Java with the following attributes:
·   Compiled and Interpreted
·   Platform-Independent and Portable
·   Object-Oriented
·   Robust and Secure
·   Distributed
·   Familiar, Simple and Small
·   Multithreaded and Interactive
·   High Performance
·   Dynamic and Extensible

Although the above appears to be a list of buzzwords, they aptly describe the full potential of the language. These features have made Java the first application language of the World Wide Web. Java will also become the premier language for general purpose stand-alone applications.
Compiled and Interpreted
Usually a computer language is either compiled or interpreted. Java combines both these approaches thus making Java a two-stage system. First, Java compiler translates source code into what is known as bytecode instructions. Bytecodes are not machine instructions and therefore, in the second stage, Java interpreter generates machine code that can be directly executed by the machine that is running the Java program. We can thus say that Java is both a compiled and an interpreted language.


Platform-Independent and Portable

The most significant contribution of Java over other languages is its portability. Jaya programs can be easily moved from one computer system to another, anywhere and anytime. Changes and upgrades in operating systems, processors and system resources will not force any changes in Java programs. This is the reason why Java has become a popular language for programming on Internet which interconnects different kinds of systems worldwide. We can download a Java applet from a remote computer onto our local system via Internet and execute it locally. This makes the Internet an extension of the user's basic system providing practically unlimited number of accessible applets and applications.
Java ensures portability in two ways. First. Java compiler generates bytecode instructions that can be implemented on any machine. Secondly, the size of the primitive data types are machine-independent.

Object-Oriented
Java is a true object-oriented language. Almost everything in Java is an object. All program code and data reside within objects and classes. Java comes with an extensive set of classes, arranged in packages, that we can use in our programs by inheritance. The object model in Java is simple and easy to extend..
Robust and Secure

Java is a robust language. It provides many safeguards to ensure reliable code. It has strict compile time and run time checking for data types. It is designed as a garbage-collected language relieving the programmers virtually all memory management problems. Java also incorporates the concept of exception handling which captures series errors and eliminates any risk of crashing the system.
Security becomes an important issue for a language that is used for programming on Internet. Threat of viruses and abuse of resources is everywhere. Java systems not only verify all memory access but also ensure that no viruses are communicated with an applet. The absence of pointers in Java ensures that programs cannot gain access to memory locations without proper authorization.

Distributed
Java is designed as a distributed language for creating applications on networks. It has the ability to share both data and programs. Java applications can open and access remote objects on Internet as easily as they can do in a local system. This enables multiple programmers at multiple remote locations to collaborate and work together on a single project.
Simple, Small and Familiar

Java is a small and simple language. Many features of C and C++ that are either redundant or souree_s of unreliable code are not part of Java. For example, Java does not use pointers, preprocessor header tiles, goto statement and many others. It also eliminates operator overloading and multiple inheritance. For more detailed comparison of Java with C and C+ + .

Familiarity is another striking feature of Java. To make the language look familiar to the existing programmers, it was modelled on C and C+ + languages. Java uses many constructs of C and C++ and therefore, Java code "looks like a C+ +" code. In fact, Java is a simplified version of C+ +.

Multithreaded and Interactive

Multithreaded means handling multiple tasks simultaneously. Java supports multithreaded programs. This means that we need not wait for the application to finish one task before beginning another. For example. we can listen to an audio clip while scrolling a page and at the same time download an applet from a distant computer. This feature greatly improves the interactive performance of graphical applications.
The Java runtime comes with tools that support multiprocess synchronization and construct smoothly running interactive systems.

High Performance

Java performance is impressive for an interpreted language. mainly due to the use of intermediate byteeode. According to Sun, Java speed is comparable to the native C/C++. Java architecture is also designed to reduce overheads during runtime. Further, the incorporation of multithreading enhances the overall execution speed of Java programs.

Dynamic and Extensible

Java is a dynamic language. Java is capable of dynamically finking in new- class libraries. methods. and objects. Java can also determine the type of class through a query. making it possible to either dynamically link or abort the program. depending on the response.
Java programs support functions written in other languages such as C and C++. These functions are known as notice methods. This facility enables the programmers to use the efficient functions available in these languages. Native methods are linked dynamically at runtime.



Saturday 21 April 2012

OOP Application

OOP :

OOP is one of the programming buzzwords today. There appears to be a great deal of excitement and interest among software engineers in using 00P. Applications of 00P are beginning to gain importance in many areas. The most popular application of object-oriented programming, up to now, has been in the area of user interface design such as windows. There are hundreds of windowing systems developed using 00P techniques.
Real-business systems are often much more complex and ,ontain many more objects with complicated attributes and methods. 00P is useful in this type of applications because it can simplify a complex problem. The promising areas for application of 00P includes:
·      Real-time systems
·      Simulation and modelling
·      Object-oriented databases
·      Hypertext, hypermedia and expertext
·      Al and expert systems
·      Neural networks and parallel programming
·      Decision support and office automation systems
·      CIM/CAD/CAD system
It is believed that the richness of OOP environment will enable the software industry to Improve not only the quality of software systems but also its productivity. Object-oriented
Technology is certainly going to change the way software engineers will think, analyze design and implement system in the future .

Sunday 15 April 2012

Benefits Of OOP

OOP :

OOP offers several benefits to both the program designer and the user. Object-orientation contributes to the solution of many problems associated with the development and quality of software products. The new technology promises greater programmer productivity, better quality of software and lesser maintenance cost. The principal advantages are:
Through inheritance, we can eliminate redundant code and extend the use of existing classes.
We can build programs from the standard working modules that communicate with one another, rather than having to start writing the code from scratch. This leads to saving of development time and higher productivity.
The principle of data hiding helps the programmer to build secure programs that cannot be invaded by code in other parts of the program.
It is possible to have multiple objects to coexist without any interference.
It is possible to map objects in the problem domain to those objects in the program.
It is easy to partition the work in a project based on objects.
The data-centered design approach enables us to capture more details of a model in an implementable form.
Object-oriented systems can be easily upgraded from small to large systems.
Message passing techniques for communication between objects make the interface descriptions with external systems much simpler.
Software complexity can be easily managed.
While it is possible to incorporate all these features in an object-oriented system, their importance depends on the type of the project and the preference of the programmer. There are a number of issues that need to be tackled to reap some of the benefits stated above. For instance, class libraries must be available for reuse. The technology is still developing and current products may be superseded quickly. Strict controls and protocols need to be developed if reuse is not to be compromised.
A software that is easy to use is hard to build. It is hoped that the object-oriented programming languages like C+ + and Java would help manage this problem.



Wednesday 11 April 2012

Message Communication

Java - Message Communication :

An object-oriented program consists of a set of objects that communicate with each other. The process of programming in an object-oriented language, therefore, involves the following basic steps:
1. Creating classes that define objects and their behaviour.
2. Creating objects from class definitions.
3. Establishing communication among objects.
Objects communicate with one another by sending and receiving information much the same way as people pass messages to one another as shown in Fig. . The concept of message passing makes it easier to talk about building systems that directly model or simulate their real-world counterparts.



A message for an object is a request for execution of a procedure. and therefore will invoke a method (procedure) in the receiving object that generates the desired result, as shown in Fig.



Message passing involves specifying the name of the object. the name of the method (message) and the information to be sent. For example. consider the statement
Employee.salary(name);


Here. Employee is the object. salary is the message and name is the parameter that contains information.




Objects have a life cycle. They can be created and destroyed. Communication with an object is feasible as long as it is alive. 



Friday 6 April 2012

Dynamic Binding

Java - Dynamic Binding :

Binding refers to the linking of a procedure call to the code to be executed in response to the
call. Dynamic binding means that the code associated with a given procedure call is not Know until the time of the call at runtime. It is associated with polymorphism and inheritance. A procedure call associated with a polymorphic reference depends on the dynamic type of the reference.


Consider the procedure "draw" in Fig. By inheritance, every Object will have this procedure. Its algorithm is, however, unique to each object and so the draw procedure will be redefined in each class that defines the object. At run-time, the code matching the object under current reference will he called.