Java+vs+Cobol


 * Owner Matthew Lutteroty

VS

=Brief Java History:= Java has been around for over twelve years and has attracted over 5 million software developers, is used worldwide in every major industry segment, and powers more than 2.5 billion devices: Today, you can find Java technology in networks and devices that range from the Internet and scientific supercomputers to laptops and cell phones, from Wall Street market simulators to home game players and credit cards -- just about everywhere.
 * over 800 million PCs
 * over 1.5 billion mobile phones and other handheld devices (source: Ovum)
 * 2.5 billion smart cards
 * plus set-top boxes, printers, web cams, games, car navigation systems, lottery terminals, medical devices, parking payment stations, etc.

Java Current Statistics:
(source java sun)
 * 800 million Java Desktops
 * 2.5 billion Java Cards
 * 2.1 billion Mobile Devices
 * 7 million set-top boxes
 * 6 million Java Developers
 * 1224 Java Community Process Members
 * 180 Wireless Carriers

Benefits of Java:

 * For the end users, the platform provides live, interactive content on the World Wide Web, with just-in-time software access. Applications are readily available on all operating systems at once. Users do not have to choose operating systems based on the applications, they can run the applications on their favorite machines.
 * Security - java platform allows users to download untrusted code over a network and run it in a secure environment in which it cannot do any harm: it cannot infect the host system with a virus, cannot read or write files from the hard drive, and so forth.
 * Dynamic, extendable programming: Classes are stored in separate files and are loaded only when needed. This means that a program can dynamically extend itself by loading the classes it needs to expand its functionality.
 * Java technologies have been improved by community involvement. This means it is suitable for most types of applications especially complex systems that are used widely in network and distributed computing.

Downsides of Java:

 * All cleanup other than memory cleanup doesn’t happen automatically, so you must inform the client programmer that they are responsible (such as cleaning up input files)
 * Architecture is reasonably processor-intensive (runs more slowly when applet is running)
 * Applet area in the browser window grey (not too pretty, if you are concerned about that)
 * LARGE overhead API; many pre-defined (and unneeded) classes imported every time.

=Brief Cobol History:= COBOL was developed in 1959 by the Conference on Data Systems Languages. This committee was a formed by a joint effort of industry, major universities, and the United States Government. This committee completed the specifications for COBOL as the year of 1959 came to an end. These were then approved by the Executive Committee in January 1960, and sent to the government printing office, which edited and printed these specifications as Cobol60. COBOL was developed within a six month period, and yet is still in use over 40 years later ( [|http://www.csee.umbc.edu).]Cobol has undergone several standard updates in 1968, 1974, 1985, and most recently 2000. Although it continues to be updated, programs developed in the sixties continue to run much as they did when they were designed. The recent update in 2000 added object oriented programming to the language. It is yet to be seen if this will be used much in the modern era of programming.

Benefits Of Cobol:
Legacy Code: Programs from the sixties continue to run reliably, time doesn't need to be spend converting them. Fast: Very low overhead leads to cobol being a very fast language. Control: Offers significant control to memory management for optimal performance. File Control: Developed for reading and writing to different types of files.

Downsides of Cobol:
The cobol programming language has been around since the sixties, and was one of the first high level language developed. It therefore has a lot of idiosyncrasies that are not found in modern languages. This leads to confusion when new programmers are introduced to the language. Also Cobol doesn't have the same high level features present in most modern languages. As modern programmers we are used to a whole library of functions at our disposal which take some of the redundant and menial programming tasks out of our work. Cobol lacks most of these.

=__Java:__=

For Loop:
for (int i = 0; I < n; i++) { System.out.println(i); }

Displaying To Screen:
System.out.println("print this"); System.out.println(variable); System.out.print(variable); (print without a new line)

Declaring variables:
int Variable = 0;

Reading Files:
import java.io.* try{ input = new BufferedReader(new FileReader("something.txt")); string line=null;

System.out.println(line);

} catch(FileNotFoundException e){ System.out.println("File does not exist"); }

Writing To Files:
output = new BufferedWriter(new FileWriter("something.txt")); output.write("stuff to write");

=__COBOL:__=

Perform varying (for loop)
PERFORM Job VARYING i FROM 0 BY 1 UNTIL EndOfFile

Displaying To Screen:
Display "print this". Display variable.

Declaring variables:
01 Variable PIC 9 VALUE ZEROS.

01 Person 05 Name Pic X(10) 05 Address 10 Street Pic X(10) 10 City Pic X(10) 10 Zipcode Pic 9(5)

77 Variable_With_No_Subvariables Pic ZZZZZ.ZZ-

Working With Files
IDENTIFICATION DIVISION. PROGRAM-ID. ADDONE ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT NUMDATA ASSIGN TO INPUTTER. DATA DIVISION. FILE SECTION. FD NUMDATA. 01 NIRBER. 05 INNUM PIC 99999. WORKING-STORAGE SECTION. 01 CHANGE-FIELD. 05 PRINTNUM PIC 99999.

Reading From A File
PROCEDURE DIVISION. 000-READ-OVERWRITE. OPEN INPUT NUMDATA. READ NUMDATA. COMPUTE PRINTNUM = INNUM + 1. CLOSE NUMDATA.

Writing To A File
OPEN OUTPUT NUMDATA. MOVE PRINTNUM TO INNUM WRITE NIRBER. CLOSE NUMDATA.