why c++ and which other languages

Hello

I've been wondering why you guys decided to start learning c++?
What do you consider as c++ biggest advantages and disadvantages?
What are the other languages that you think are good to know nowadays (for simpler solutions)?

The first is simple: a very powerful modern programming language, that is not restricted (like C#, VB) or slow (any dotNet language).
The advantages, in my mind, is mostly power and flexibility as well as working close to the hardware. The disadvantage is GUI.

Originally Posted by Adak

io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.

Originally Posted by Salem

You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

The first is simple: a very powerful modern programming language, that is not restricted (like C#, VB) or slow (any dotNet language).
The advantages, in my mind, is mostly power and flexibility as well as working close to the hardware. The disadvantage is GUI.

I have to agree with Elysia, though I took it up, simply because I wanted to create every piece of software you could make. With the Power of C/C++, you have the a near unlimited boundary.

You could even make your own programming language ( PHP ), which makes C/C++ the best, besides assembly.

I started C and C++ because of coursework, got hooked on them right away. As for advantages and disadvantages, well that's often application specific. I would say that C++ has advantages over C such as a stronger type system, and the ability to do object oriented design can be very useful, which can be more difficult (but not impossible) in C. However, strong typing isn't always what the doctor ordered, and many scripting languages offer dynamic typing which is also a blessing and a curse depending on the application.

I think that one disadvantage that C++ has is that it is quite a large language, which can make it hard for people to learn as they can encounter advanced topics without much understanding of more basic topics. Furthermore, it tries to maintain a lot of compatibility with C which tends to result in more than one way to do things, causing people to rely on the C approach rather than the C++ approach (dynamic memory allocation is a prime example in my opinion of a topic which people tend to use the C method as opposed to the C++ method). Again, this compatibility has obvious advantages, such as the ability to port code from C to C++ quite easily.

Lastly, good languages to learn very much depend on your requirements. I would thoroughly recommend C since it has had such a massive influence and its more limited feature set can serve to help a programmer develop their skills. In addition to that, Python and Perl are very popular, both of which I'm looking at learning at the moment. Java and C# have a very big role in modern industry and are definitely worth a look if you want a job as a software developer.

Each language is good for different reasons. Java is the most popular, C is the fastest (typically), Ruby is probably the easiest and most expressive. It all depends on what you're looking for.

C++ is good for general-purpose programming. This means you can program just about anything, and you can do it in a style that best fits the task you're working on (whether that be a generic approach, an object-oriented design, a procedural design, etc). C++ provides some of the most extensive support for generic programming, and it comes with an efficient generic library. It also has all of the low-level features from C, which makes it faster than most languages.

The disadvantage of C++ is that it has some obscure syntax which results from strict compatibility concerns, and requires an understanding of some pretty demanding concepts. Basically, it's not easy to learn.

I would thoroughly recommend C since it has had such a massive influence and its more limited feature set can serve to help a programmer develop their skills.

I would not recommend C because it's not type safe, thus very, very easy to do errors that you shouldn't and that it's old, difficult and does not do very well in today's demanding world.
Other looslely typed languages such as Javascript or VB provides automatic conversion between types and such, so its nature fits well with loose typed system. However, C does not do this and therefore, a loose type system is usually a bad thing.
C++ is preferably the tool of choice for modern programming for PCs using C-like approach.

But then again, it's up to each and everyone to pick the tool they feel best suited for the job.

Last edited by Elysia; 08-02-2008 at 09:39 AM.

Originally Posted by Adak

io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.

Originally Posted by Salem

You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

I would not recommend C because it's not type safe, thus very, very easy to do errors that you shouldn't

Sure weak typing isn't great in practice, but I would say that it would be advantageous to learn a weakly typed language to really understand the importance of type safety. It's all good and well to write C style code in C++ and have strong typing on your side, but what happens when a programmer is required to work with a C compiler? It's a lot easier to move from C to C++ than the other way around as far as typing is concerned.

Originally Posted by Elysia

it's old, difficult and does not do very well in today's demanding world.

Not necessarily true - think of all the embedded systems running behind the scenes in today's world. C might not be the leading language in terms of PC application development but don't forget the very demanding embedded world, C is a major player there.

Originally Posted by Elysia

But then again, it's up to each and everyone to pick the tool they feel best suited for the job.

Not necessarily true - think of all the embedded systems running behind the scenes in today's world. C might not be the leading language in terms of PC application development but don't forget the very demanding embedded world, C is a major player there.

Yes, sorry, I meant PC.

Originally Posted by Adak

io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.

Originally Posted by Salem

You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

C++ assumes that the programmer knows what he/she is doing. In comparison to, say, Java.

For example, in Java, useful features of C++, like goto (if you know what you are doing. For breaking out of nested loops for example), pointers and operator overloading are left out because the language designers felt that Java programmers don't know what they are doing, and will use those two features unsafely. While those features are often used incorrectly, they are very useful when used correctly. On the other hand, C++ makes all those features available to the programmer, assuming the programmer knows how to select the best tool for the job at hand.

For example, in Java, useful features of C++, like goto (if you know what you are doing. For breaking out of nested loops for example),

Java's method appears to have been to simplify, as well as attempt to Object Orient, many of the complicated aspects of C++.

Case in point, goto is a reserved keyword in Java, but it has no direct usage as of, yet. Because breaking out of nested loops is something potentially useful, Java has an advanced way to do suck by applying labels to the loops and specifying which loop you want to break from. This is not just applied to loops, but can be applied to almost any type of block of code, I believe. Thus, you have the advantage of forward jumping in code, with some ease of readability and maintainability compared to unrestricted goto or other advanced but almost unrestricted jump methods.

As in the situation with goto, caution should be demonstrated using such a technique, although perhaps not to the same extent.

Originally Posted by cyberfish

pointers and operator overloading are left out because the language designers felt that Java programmers don't know what they are doing, and will use those two features unsafely. While those features are often used incorrectly, they are very useful when used correctly. On the other hand, C++ makes all those features available to the programmer, assuming the programmer knows how to select the best tool for the job at hand.

This has been one of my complaints of Java. I believe restricting operator overloading is a very poor choice. The language itself does support the feature, as is evidenced in the String class having its operator= overloaded to allocate a new String object and assign the string in question. Programmers may abuse such features all the time. Java programmers may write their entire program in a main() method and never properly get into the OO feel for the language, but you can't stop them from doing it. I think the choice should be left to the programmer in such a situation, since there are times that operator overloading has extreme benefits. To restrict all of the good cases on account of the bad might not be the best approach.

C++ has done so well, imo, because it gives programmers almost full power to do whatever they want. One can write code in a very low-level manner in C-style, or slightly more advanced with an OO approach, or a potentially even higher route with the advantages of templates. It is a great language, even if difficult to master, but it is probably not going anywhere anytime soon, just like C is probably still going to be around for awhile.