C++, Java, CGI

I’ve decided I want to learn more about programming. Why? Because I enjoyed writing programs in Easytrieve Plus on the mainframe where I used to work. I figured that EZ+ is pretty obscure nowadays, and I should learn something that would make me more employable.

My first choice is C++ because so many jobs call for it. But I’ve uncovered books on Java and CGI while unpacking. All of my programming experience is in structured, as opposed to object oriented, languages.

Should I concentrate on C++? What’s a good book for the OOL beginner, that comes with a good compiler? If the best “beginner’s book” doesn’t come with a C++ compiler, what compiler should I buy?

This is all my humble opinion, of course.

Start from Java and move to C++ afterwards.

When the time comes for C++, there are free compilers that you can download. Try looking here. GCC is free, can be used for a slew of other languages (even Java! But start with Sun’s version) and has quite good performance for its price…

CGI is more of a tecnique; it can be used with any programming language, from Perl and Python to Java and C. I recall articles on doing CGI with C++ for the sake of efficiency.

Try some of the free books from Bruce Eckel for a first taste of OO, Java or C++.

Why should I start with Java and then move to C++?

Here’s a short, succint explanation of why - it is actually the description of C++ in the Jargon File:

Also because I like Java more. This is IMHO, right? :smiley:

Allow me to add: because of the quirks of Java and C++, I feel it is slightly faster to “get” OO programming with Java, and then reapply the concepts you have learned to C++. It is very possible to do it the other way round (I did) but I feel the learning curve for C++ is steeper.

I just read an article that claims that the most used language for development in the US is Java, followed by Visual Basic followed by C++. Dunno how accurate it is, because it was written from a poll based on that magazine’s readers.

I personally work in C++ and prefer it, because I know it best. I have worked in VB and am told that it is becoming much more structured. I tinkered with Java and C# and liked them both, but for now my job requires C/C++ and so I’ll stick to it.

I’ll second that. Tho’ my way in to OO was through C#. I’d always ground to a halt trying to learn OO principles doing C++ (starting as a C programmer) there’s so much syntactic dressing (Johnny, meet the scope resolution operator) that you can’t see the wood for the trees, and it lets you use techniques that are completely non-OO.

I’ve never bought a compiler. For programming at home I’ve used last year’s model (Borland C++ and Builder) given away on cover disks. Is this an option?

For a bit of Java stuff at work I was given the NetBeans IDE, which is free but was very greedy on PC resources.

I’d say look into C#, but I would wouldn’t I :slight_smile:

BTW what is EZ+?

I took a short class in Java at my previous job. “Getting” OO was a bit of a problem. As I said, I was used to EZ+. You’d set up your input and output files with JCL, then define the fields in the “library section”. i.e., You’d have something that looked like this:

NAME 10 30 A

Which means that the variable you call NAME starts in column 10, is 30 bytes long, and is alphanumeric.

In the body of the program, you’d have something like:

IF NAME = ‘OUT OF BUSINESS’
GOTO JOB
ELSE
NAME-OUT = NAME
END-IF

Of course you could make a “do-loop” to search each byte or string of bytes to do whatever.

In Java there seemed to be “black boxes” that did things. I wondered how they did what they did. And the syntax was different. I think part of the problem was that everybody else in the class had experience writing OO programs, and I was the only one who didn’t. I sort of got left behind. I think what I need to do is sit down with a good manual and work it out on my own – either with C++ or with Java (or both).

But for now, I need to get ready for work…

Okay, one more post.

Easytrieve Plus is a structured programming language similar to COBOL, but easier to use, and which does not need to be compiled before running.

Yup, I know what you mean. I learned OO programing in school with C++, then switched to Java. My first impression was that the syntax was really similar, but what the hell are all these classes? How do you know what does what? Rest assured, it gets easier. You use a very small subset of the available classes on any particular class, and you’ll figure out real quick which ones you need on a regular basis.

You may want to check out some of the Java tutorials on the Sun site:

http://java.sun.com/docs/books/tutorial/

I’m not sure whether you feel you have a good grasp of OO architecture or not. If not, I think it might be helpful to play with Java some and get familiar with it, then try the class again. The second time, you wouldn’t have 2 learning curves to climb at the same time.

-Rob

No wonder you had trouble with OO. I tried to learn OO (C++ then Java) as a C programmer and had several false starts. You have to loose the habit of thinking procedurally. If you want something done (say iterate though a file) you don’t wade in and start looping through it, you design a class that knows about this file type and what you can do with it. I may be back with an example, gotta work now :slight_smile:

One point that hasn’t been made yet is that CGI is not a programming language. It’s an interface to the web server. You can use any programming language for it, although one of the most commonly used is Perl.

IMHO:

Procedural: as much as I hate to admit it, C just because it’s the industry standard. It’s a horrible, horrible language for modern development outside of very specific purposes IMHO but it’s almost indispensible as a stepping stone into other languages because it changed the face of programming.

Others to consider: Perl, “Java lite” (ie: java with no OO), Delphi

OO: I would reccomend C#, it’s like java, only better. Java became the de-facto OO language largely through accident and it shows in a lot of places, the 1.5 release fixes lots of niggling little issues (like including templates) but the haphazard design still shows. C#, OTOH, was designed from the ground up to become the next industry standard by some very, very smart people. And, apart from the rabid anti-MS crowd, seems to have achieved most of what it set out to do. Theres loads of syntactic sugar for the novice programmer and the libraries are well maintained and well documented. The caveat is you need to shell out for a ~$700 IDE or know friends who can load you a copy :wink: :wink: to fully appreciate the benifits.

Others to consider: Java, C++, Objective C

Event Driven: Again, C# seems to be quite good in this respect. With .NET, I think the benifits of VB over C are dramatically reduced and you quickly bump into the limitations of VB. C# seems slightly more terse and more expressive which helps a lot.

Others to consider: VB.NET, Java Swing/AWT

Quirky: Lisp, Prolog, Haskell, Perl, some sort of formal proof langauge are all languages which I think an experienced programmer should have experienced just so they know whats out there in the non-C dominated world. they help expand the horizon of just whats possible with different languages.

Java probably is the better beginner’s language cause there’s stuff you just don’t have to worry about there that you do in C++. That said, Java is missing some things that I consider important–full multiple inheritance and (unless they’ve changed it recently) templates–and if you want to do anything that’s got performance requirements, Java is not an appropriate language to use.

Does string1 == string2 work as one would like it too now? (they got it right in C#) When I was trying to learn OO using Java I got utterly pissed off that every example I’d try (from a not very old book) would bring up deprecated method errors. The bloody language wasn’t stable :mad:

Back to the OP. If you’re looking for something to make you “more employable”, whatever language you choose I suggest getting some formal training. Knowing the syntax of a language and its constructs and keywords is only part of what you need to know as a programmer (maybe you know this from using EZ+).

Passing shot. I thought that Java wasn’t particularly good for CGI programs as data is passed as environment variables that Java has trouble reading? I’m not a Java programmer, maybe this is a piece of cake now.

Another vote for starting with Java before moving to C++. I had several false starts trying to pick up C++ on my own, simply because the language is flexible to the point of being baffling to a beginner trying to do something seemingly simple. Java has almost exactly the same syntax as C++, but is much easier to jump into and start playing around with objects.

For example, if you want to build a GUI program with menus and buttons and such, there is a standard set of objects you just hook together. It’s actually pretty easy, and a lot of fun. GUI programming in C++ is more complicated.

The Java tutorials on Sun’s website are very good. Good luck.

Yes, according to [http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html](this page), the String Comparator has been overloaded to a case insenstive compare. Odd choice, most langauges do case sensitive. It seems like operator overloading has also been introduced in 1.5 which is another pleasant but long overdue feature.

oops, link should be: link

I know exactly what you mean. Theoretically, that’s the ideal of object-oriented design and programming – it’s all about black boxes, and you’re not supposed to care about how they work, just how you can get access to them. So Java is supposed to be a great environment, since you have these enormous libraries of objects that take care of the details, and all you have to worry about is figuring out how to put the objects together to get what you want.

But it’s frustrating. I’ve been programming in C++ for over a decade, and I think I’ve got a good handle on object-oriented programming. But I still can’t deal with smalltalk (about as close to a “pure” OO language as you can find that’s still remotely practical), because it’s just this huge system and you have to struggle to find an entry point. There comes a point where you just want to think about the task procedurally, not dig through the reference for 100 different object libraries.

So even though Java is smaller and cleaner and you don’t have to worry about dangling pointers and memory leaks and such, I think C++ is easier to work with.

As for book recommendations, I don’t know. I got the syntax down from the Stroustrup book, but that’s not really an introduction. I didn’t understand what was going on until I had a project in mind and then sat down and tried to finish it.

One tool recommendation, though: if you can find a cheap or free copy of Borland C++ Builder, I can’t recommend it highly enough. This is what should’ve become the standard development environment, not Microsoft’s convoluted .NET business. It’s not 100% “standard” C++, as they made some minor modifications to the language to get it to work in the dev environment, but it’s the closest thing I’ve ever seen to letting you get an idea in your head, draw it on the screen, and then just add code to make it work.

Some for C++. and some for Java. It looks as if Java might have a slight lead. And I already have a book.