Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java and Cobol differences [closed]

Tags:

java

cobol

Can anyone help comparing and contrasting between Java and cobol in terms of technical differences as well as architectural design styles

like image 750
user246584 Avatar asked Jan 10 '10 02:01

user246584


People also ask

What is the difference between COBOL and Java?

Cobol is very much a procedural language, while Java is very much an object oriented language. That said, there have been vendor specific OO extensions to Cobol for decades, and the new specification contains a formal specification.

Is Java better than COBOL?

COBOL is a compiled language and tends to have slightly better performance than interpreted languages such Java and C#.

Will COBOL go away?

While the future is uncertain, the decades-old programming language running on mainframes proved its staying power during the pandemic.

Is Java the next COBOL?

Java has succeeded in the marketplace (partially) because it is a language of its time; not one behind the times - or ahead of them. Java is the new COBOL because it's becoming the new de facto standard for enterprise applications. Like COBOL, it's a good language for its time, but there are better ones.


2 Answers

Similarities

  1. Cobol and Java were going to change the world and solve the problem of programming.

  2. Neither lived up to the initial hype.

  3. There are now very large, bloated Cobol and Java programs that are used by banks and are "legacy" ... too large and critical to rewrite or throw away.

  4. Cobol introduce the idea of having long, readable names in their code. Java recommends long, readable names.

Differences

  1. Cobol was invented by an American, Grace Murray Hopper, who received the highest award by the Department of Defense, the Defense Distinguished Service Medal.

  2. Java was invented by a Canadian, James Gosling, who received Canada's highest civilian honor, an Officer of the Order of Canada.

3 COBOL convention uses a "-" to separate words in names, Java convention uses upper/lower CamelCase.

like image 129
Larry Watanabe Avatar answered Sep 19 '22 12:09

Larry Watanabe


COBOL was popular for the simple reason, to develop business applications.

Since the syntax was so clear and human-like, written in procedural style, it was for that reason, that made adapting to the changes in the business environment much easier, for example, to assign a value of pi to a variable, and then subtract zero from it - simple example to show the actual COBOL statements/sentences (it is years since I last programmed in Cobol)

MOVE 3.14 INTO VARPI.
SUBTRACT ZERO FROM VARPI GIVING VARPIRESULT.
IF VARPIRESULT AND ZERO EQUALS VARPI THEN DISPLAY 'Ok'.

If I remember, the COBOL sentences have to be at column 30...

And it is that, hence easier to troubleshoot because any potential business logic error can be easily pin-pointed as a result. Not alone that, since COBOL ran on mainframe systems, it was for a reason, the data transfer from files were shifted at a speed that is light-years ahead of the other systems such as PC's and that is another reason why data processing in COBOL was blindingly fast.

I have worked on the Y2k stuff on the mainframe (IBM MVS/360) and it was incredible at the dawn of the 21st century, praying that the fixes I put in wouldn't bring the business applications to their knees...that was hype, aside from that..to this day, it is still used because of the serious transfer speed of data shuffling around within mainframes and ease of maintainability.

I know for starters, Java would not just be able to do that, has Java got a port available for these mainframes (IBM MVS/360, 390, AS400)?

Now, businesses cannot afford to dump COBOL as they would effectively be 'committing suicide' as that is where their business applications resides on, which is the reason why the upgrade, migration, porting to a different language is too expensive and would cause a serious headache in the world of businesses today...

Not alone that, imagine having to rewrite procedural code which are legacy code and could contain vital business logic, to take advantage of the OOP style of Java, the end result would be 'lost in translation' and requiring a lot of patience, stress and pressure.

Imagine, a healthcare system (I have worked for one, which ran on the system I mentioned above), was to ditch all their claims processing,billing etc (written in COBOL) to Java, along with the potential for glitches and not to mention, serious $$$ amount of money to invest which would cost the healthcare company itself far more, the end result would be chaos and loss of money, and customers (corporations that offer employee benefits) would end up dumping the company for a better one.

So to answer your question, I hope I have illustrated the differences - to summarize:

COBOL is:

  • Procedural language
  • Simple human like syntax
  • very fast on mainframe systems
  • Easy to maintain code due to syntax

In contrast,

Java is:

  • Object Oriented
  • Syntax can get complicated
  • Requires a Java Virtual Machine to run and execute the compiled bytecode.

Hope this helps,

like image 36
t0mm13b Avatar answered Sep 21 '22 12:09

t0mm13b