Java – Disadvantages
The biggest advantage is also a disadvantage at the same time: the performance is reduced, because Java code is interpreted by the interpreter (which makes platform independence possible). Currently, Java applications are somewhat slower than comparable applications written in C++
Java – Advantages
- – is simple – because it is structured
- – supports multi-threading
- – is safe
- – is object oriented
- – is robust
- – has an automatic memory and heap management
- – knows no pointers
- – is dynamic in terms of the runtime system. Classes are linked when they are needed.
- – was developed to support applications in networks, new modules can be implemented over the network
- – is platform independent, Java code is a byte code, not machine code
- – requires only a virtual Java processor, which interprets and executes the byte code.
- – provides by default a library for uniform graphic functions of different Windows systems
- – Abstract Window Toolkit (AWT, java.awt)
- – Applets are easy to integrate into WWW pages, can be loaded and executed from the WWW
Java – Terms
A few remarks on just mentioned terms and features of JAVA .
Java is very much based on C++, but it has special features that should make it particularly suitable for the planned application on the net. Most easily it will have programmers, who are familiar with the syntax of C++. For all non-programmers, Java is as easy or difficult to learn as any other language, even though Sun claims that Java is particularly simple.
The features briefly explained:
Programs written in Java use objects. Objects are divided into two parts, data elements and the associated functions (methods). Contents of data elements represent the state in which an object is currently located. Functions are operations that move a data object from one state to another.
The entirety of objects with the same properties is called a class. Object-oriented programming is the compilation of class descriptions, i.e. the description of the data elements that each object of the class contains and the functions that are applicable to each object of the class. These can be reused, for example, in the context of a larger program package.
Thus, in the course of time you can create an extensive library (class library) of different objects. A set of libraries for standard tasks (such as input/output or graphics) is supplied with the language.
The platform independence/architecture neutrality results from the fact that Java programs are first compiled into neutral byte code. Byte codes are similar to machine instructions, but are not specific to a particular machine. The source codes in Java are compiled to .class files, which contain the program in byte code. The byte codes can now run on any platform that supports Java. They are interpreted and executed quasi at startup.
Threads are parallel actions that a program can execute simultaneously. This means that a thread can perform a calculation while another thread allows user interaction. So there is less waiting time.
Java has easy-to-use synchronization properties that should make the difficulties of programming such environments easier.
Secure and robust
Java programs can be verified before execution because they have no pointers and are available in bytecode. The verification is used by web browsers to ensure that no viruses are contained. Java does not use addresses from numbers, but names for functions and methods that can be easily verified. So no Java applet can execute or access anything that has not been explicitly defined in the verification process. Because every memory access is checked, there are no computer crashes.
If a memory area of the computer is no longer needed, a programmer who programs in C or C++ (and many other languages) must make sure that the program releases it for new use.
This memory management requires great accuracy. In Java, this is done by a built-in program, the Garbage Collector, which scans the memory and releases unused memory areas.
Comparison with other programming languages
Java is an object-oriented, interpretative, hardware-independent, network-capable, multitasking, dynamically extensible Programming language with strict typing and some security measures.
The execution speed of Java. Bytecode is good enough for user interfaces. Time critical program sections can be converted to direct.
Convert the machine code of the target computer. The compiler makes some optimizations and produces relatively good code. Java is strictly typed and forces the programmers to make early decisions.
On the other hand, it also supports them, by revealing many possible sources of error already at compile time. Since Java does not support the actual method calls and does not allow any statements about the layout of the classes in the target system memory, it forces the Programmers to refrain from improper programming style.