Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

A friend of mine came from a VMS/COBOL background and we gave her some VB6 to do - she absolutely ran with it.

Next we ran her through some Java stuff and it didn't click at all.

What's similar about COBOL and VB6 (but not Java) that would make this possible?

comments disabled on deleted / locked posts

migration rejected from stackoverflow.com Dec 4 '13 at 15:40

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as primarily opinion-based by gnat, GlenH7, MichaelT, Robert Harvey, Kilian Foth Dec 4 '13 at 15:40

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

9 Answers

up vote 9 down vote accepted

I'm a Cobol developer that learned how to be a Java developer.

Coding in Java requires a different way of thinking about the problem than coding in Cobol. Java is object oriented, while Cobol is procedural. In Java, you have variable encapsulation, while in Cobol, all variables are global. Java can be used to develop all sorts of applications, while Cobol was designed for CRUD data processing. In Java, you have a vast number of libraries to use, while in Cobol, the developer pretty much has to write everything. Some Cobol shops have subroutine libraries, while others don't.

Then you have the scale differences. Java classes tend to be less than 1,000 lines of code. A Cobol program could easily be 20,000 or even 200,000 lines of code. A Cobol program is roughly equivalent to a Java project.

There are some similarities between Cobol and Java. A Cobol procedure is roughly analogous to a Java method. Cobol Working Storage is a good introduction to one use of a Java interface. Cobol 01-level structures are a good introduction to Java bean classes.

A better way to teach a Cobol programmer Java is to build on the similaries first, then cover the differences.

@Gilbert Interesting stuff. I haven't programmed in Cobol in 22 or so years, so none of those similarities came to mind (plus I was obviously using a much earlier version of the language, COBOL-74). Interesting to see those connections, thanks for the info. –  Matthew Frederick Jan 16 '11 at 13:07
@Matthew Frederick: You're welcome. It took me 3 years of working on Java projects before I became a good Java developer. I think it would take most Cobol programmers 3 - 5 years to make the transition. –  Gilbert Le Blanc Jan 16 '11 at 13:22
@Gilbert, interesting read. From my experience with Cobol programmers writing Java, it is my understanding that anonymous inner classes is one of the hardest concepts to grasp (it runs both here and there??) –  user1249 Feb 7 '11 at 16:41
This question (and answer) is particularly interesting to me, as my current (and first) job out of college is working at a company with a massive amount (relatively) of Cobol code and quite a few who currently (still) develop in Cobol. We're ever so slowly migrating a lot of that code to .NET(VB and C#) and I almost fell down the first time I heard an old Cobol programmer say they were having trouble grasping the concepts in VB... –  Wayne Werner Feb 23 '12 at 11:47
add comment

Anyone transitioning from COBOL to VB6 is bringing very little from the first language to the second. Variables, loops, conditionals, and inputs/outputs are things most languages have in common so you're transferring those programming fundamentals, but frankly little else. Realistically they're learning VB6 from scratch.

Basic was specifically designed to be easy to learn. VB6 had limited OOP abilities and really never required you to learn them; you could write procedural code with functions here and there when you either needed to perform something multiple places or your code was getting too long to manage. Visual Basic 6 included events and objects with attributes, but you never needed to understand classes or inheritance or really any OOP stuff.

Java wasn't designed to be easy to learn: syntactically it's largely a C/C++ type language, neither of which were at all designed to be easy to learn. While pointers and structures and such have been eliminated, its base-level C-style syntax is markedly different from Basic -- much more terse as @Aaron noted -- and actually requires you to think of programming differently. Java does require you to understand OOP to get anything complex done.

As a result a person is able to bring those fundamental programming concepts over that s/he originally learned in COBOL and some stuff from VB6 like object attributes/properties, but mostly s/he's learning a language from scratch, and it's not a language that was designed to be easy to learn.

Please don't use the term C/C++. it's largely a C++ type language. Whether i agree with the statement is another matter. Pet Peve: programmers.stackexchange.com/questions/1745/… –  Loki Astari Jan 16 '11 at 6:45
@Martin - In terms of syntax, it is a C/C++ type language (the two languages do have very similar syntax). In terms of semantics, it's neither C or C++ type language. –  Jason Baker Jan 16 '11 at 7:00
@Martin Exactly as Jason said: I did not mean semantically, I mean syntactically. I will reword to clarify. –  Matthew Frederick Jan 16 '11 at 7:55
@Jason - I get the point, but I still think Martin has a point. Java is syntactically similar to C, but only for a very small subset of Java syntax - all the OOP stuff simply doesn't exist in C. If you've mentioned the similarity to C++, also mentioning C is redundant. Not a big deal, of course, but you're not taking enough care to avoid triggering anti-"C/C++" lynch-mobs ;-) –  Steve314 Jul 10 '11 at 1:33
add comment

Cobol and VB6 both make you want to poke your eye out.

In all honesty my guess is that she was given something to accomplish which may have been stubbed up for implementation. This would then theorize that what was easier for her to grasp was syntax; not the language in its entirety.

VB6 is verbose. On top of that a goal of VB6 was to take an approach of trying to use native tongue when making reference to concepts...such as null for which VB6 uses nothing.

The reason for her success is most likely simply a case of grasping a few VB6 syntax concepts out of the gate due to verbosity and the natural language approach of VB6 versus the C like syntax of Java.

To be fair, VB6 is far from being the most eye-poke-inducing environment I've ever programmed in. –  Jason Baker Jan 16 '11 at 6:57
((((((((((I'd). have)). to take))). VB6 (over))). Java)) –  red-dirt Jan 16 '11 at 14:39
@Jason Fair enough...it was meant to be light hearted yet with multiple down votes and no explanations... apparently I touched on a few nerves. –  Aaron McIver Jan 16 '11 at 19:25
what did you poke the other eye out for earlier since you only have one left? Or are you a mighty pirate? –  user1249 Feb 7 '11 at 16:43
@Thorbjørn My eyes are fine..."...make YOU want to poke YOUR eye out..." We would have to get a hold of the OP on their current eye ball situation ;) –  Aaron McIver Feb 7 '11 at 16:54
add comment

It really depends on what you where asking her to do in Java -- especially if it was an existing code base. Java is at least an order of magnitude more complex than VB6 and COBOL.

Java is a strongly-typed language whereas VB6 and COBOL are fairly loosely typed. Java also requires an object-oriented approach by requiring that all of your data and methods be in classes. This is probably a foreign concept to her since the code she wrote in VB6 and COBOL was likely only procedural.

No one with any sense writes loosely type VB6. Nor it VB6 primarily procedural - its actually substantially OO, its just that its well hidden. I do agree however that it will be the OO that's the issue. –  Murph Jan 16 '11 at 13:30
@Murph: I meant to say that the code she wrote was probably procedural. I updated the wording to make what I meant clearer. –  csnullptr Jan 17 '11 at 1:49
add comment

First: The lack of OOP in VB6 to be the first common thing between COBOL and VB6, but the true question is what do you mean by didn't click? I can do Java and C# and Delphi but wouldn't touch VB6.

Did you teach her OO ideas? Java is as usefull as a brick in the water without knowledge of OOP. Nobody with respect for OOP can do VB6.

My advice regarding learning Java would be, forget all the COBOL and VB6, just learn Java as if learning programming for the first time. There are bunch of Java tutorials on youtube she can use, or if possible I like to get her view of what is the problem that she needs to solve in Java and walk her through the steps.

If it was me and she was going to need Java, I would have not exposed her to VB6 before getting her to learn Java, as VB6 prior to Java causes more harm than good.

also +1 to Aaron for :

Cobol and VB6 both make you want to poke your eye out.

Explain exactly how learning VB6 is destructive? –  Pemdas Jan 16 '11 at 6:28
VB6 has OOP.... –  Jason Baker Jan 16 '11 at 7:01
@Pemdas : It is not learning VB6 that is destructive, but learning it prior to learning Java. The framework that VB6 uses compromises learning of Java's frame work. Even learning VB6 before learning VB.net causes problems. Why not teach Java first, which is a more up do date language than VB6 and then teach the archaic VB6? –  Arjang Jan 16 '11 at 7:07
@Jason Baker : No it is not OOP, it is Object Based but not Object Oriented : en.wikipedia.org/wiki/Object-based_language –  Arjang Jan 16 '11 at 7:11
I don't see how see how it makes any difference honestly. –  Pemdas Jan 16 '11 at 7:49
show 9 more comments

I occasionally have the pleasure of explaining Java code to Cobol schooled programmers. Most things go quite easily, but the thing that was hardest to explain was a situation where I created an anonymous class with an instance that was then sent to some other code, allowing the remote code to access variables in the local code through the anonymous class instance without even knowing so.

In other words: closures.

add comment

COBOL and BASIC were invented within 5 years of each other (1959 and 1964) and share many traits. Visual Basic is only loosely based on Basic, but it doesn't surprise me that moving from cobol to VB is a relatively easy step.

Java is has a fundamentally Object Orientated design (though some non-OO features are there) when makes it a relatively easy step from other OO languages like C++ or C#.

I'm not sure the dates are terribly important. C was influenced by ALGOL, FORTRAN, BCPL, CPL, and B. –  Kennah Oct 22 '11 at 4:09
add comment

I made the transition from COBOL to OO languages via VB6 a few years back. The syntax is different, but using End If instead of END-IF isn't a major change. The lack of implementation inheritance in VB6 makes true OO impossible, so in practice almost everyone I knew ended up using VB6 classes as nothing more than a place to put code, which was almost entirely procedural. The only thing that was difficult to adjust to was that VB6 was event-driven.

Moving on to a true OO language (in my case VB.NET) was more challenging because so many of the common patterns used in OO programming were impossible before. At the time, I had experimented with Java and Python, so I knew what was going on, just not the best way to use the new tools, but my colleagues basically wrote VB6 code in VB.NET. It wasn't until I read Head First Design Patterns that things started to click for me.

add comment

By and large, the world of programming languages can be divided up between those with C syntax and those with BASIC syntax.

COBOL does not fit into either camp, exactly, but COBOL syntax is much, much closer to BASIC syntax than to C syntax.

I think this is a core reason why we COBOLogists will do better with VB6 or VB.NET than with C, C++, C#, or Java.

add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.