History
ABAP is much older than Java. While Java was released by Sun Microsystems in 1995, ABAP was created by SAP in the 1980s as the report language for its business application SAP R/2. Until today, ABAP is mainly used inside SAP as well as by SAP customers and consultants, to develop, modify, and extend SAP applications, like SAP R/3 or SAP ERP. SAP's newest platform solution NetWeaver supports both ABAP and Java. Java, on the other hand, was never intended to be used inside a certain company or for a certain product only, but focused on a broader market from the beginning. It is now widely used in many different programming areas such as network computing, web applications, or business software. All the concepts that ABAP supported since the first release are still supported and all the keywords are still valid, which is one reason why ABAP has many more keywords than Java.
Comparison
This is a comparison of the ABAP with the Java programming language. As two modern object oriented, garbage-collected programming languages, there are many conceptual similarities. However, the two languages with completely different histories also have many differences. This page documents the strong general similarities of the languages and points out those areas where the languages differ. Both languages were designed carefully, and if one language has a feature another lacks it is the result of a conscious design decision. Thus, the reader is advised to avoid the temptation to 'keep score,' and instead think about why the designers made each decision.
Language
Syntax
While Java's syntax is based on C and C++, the syntax of ABAP is not based entirely on a previous language, but has some syntax elements in common with COBOL). For example, each statement ends with a semicolon (;) in Java, while ABAP uses a dot (.). Character strings are surrounded by double quotes in Java (") and single quotes (') in ABAP. Comments are indicated by // or /* in Java and by * or " in ABAP. Whitespace is usually ignored in Java, while it can make a difference in ABAP.
Parameters in method calls are given the specified order in Java, while the parameter names usually have to be given in ABAP (Named parameters). Java supports one or no returning parameters of a method, and any number of importing parameters, while ABAP supports also several exporting or changing parameters.
Both languages do not support operator overloading as well. For many of the operators in Java (+, -, =), ABAP offers built-in functional keywords (ADD, SUBTRACT, MOVE).
Furthermore, both ABAP and Java do not allow pointer arithmetic, by which certain addresses in memory can be explicitly be accessed in languages like C, which are considered unsafe by some language designers.
Example ("Hello World")
ABAP
PROGRAM TEST.
WRITE 'Hello World'.
Java
// Hello.java
public class Hello{
public static void main(String [] args){
System.out.println("Hello World");
}
}
Platform independence
Java Code can run independently on a client or centrally on a server. Java code is not compiled into machine code, like many other languages including ABAP, but into byte code. This code is interpreted by the platform-specific Java Virtual Machine (JVM), which translates the byte code into the machine code of the platform. Thus, Java can run on any platform for which such a JVM is available.
ABAP code usually does not run directly on a client, but on an application server. Clients usually connect to the server via SAPgui or a web browser (BSP, WebDynpro). Therefore, ABAP applications can be used on any client for which a SAPGui client or a web browser is available.
Subscribe to:
Post Comments (Atom)
1 comment:
Nice Comparison, Thanks.
Post a Comment