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.

I want to learn new things. Initially I was a PHP programmer. Then I thought it was not enough.

Then I started learning Java thing. It took me 3 months to learn.

Java, J2EE, Spring, Hibernte, Spring Security, Spring Roo and many design patterns MVC and stuff like AOP, DI . I never knew that before but I got the idea what J2EE. After 3 months, I just made a simple page with Registration form integrated with Spring Security.

I wanted to make one complete project in it but that was too much for me and I didn't want spend more time on it as then i need to host that as well so I left that.

Then I started learning Python and made few sys admin scripts and then Django and now I am finishing a complete web app in Python.

Now I want to learn C++, but before that I need to find out what i can do with it. Just like I know Python is very useful because I have my own servers so I can write scripting and websites so Python is good for me.

But I am confused in which areas C++ can help me.

I don't want to end up like I have with Java where either I have big projects or nothing for day to day use.

share|improve this question
add comment

8 Answers

up vote 9 down vote accepted

C++ really comes into play when you either want great speed or low-level programming (which is partially a part of greater speed).

When it comes to computational heavy activities like what you find in modern video games, you require the fastest possible execution time to make sure everything works on time as it should. C++ or C is your best choice when it comes to production code as it allows you the low level work you need and allows you to use something like assembly if you really need it. Of course C++ also allows you to use object oriented programming if you wish to do that.

The low level part can allow you to write something like a driver or work with something like a micro-controller where you need to work with direct memory access.

share|improve this answer
    
i uderstood the advantages but i still didn't get what i can use c++ at personal level –  user824981 Jul 9 '11 at 19:13
add comment

Before learning any language decide for yourself in what direction you want to work. Whether it is web development, System Programming, Business Applications, Mobile App Development, etc. After you solve this puzzle, you will be able to pick languages in that category. And when its done, don't give up, even if software projects take longer.

share|improve this answer
add comment

Off the top of my head (as a non- c++ programmer):

I hear that c++ is one of the preferred languages in commercial computer-game programming (not talking about flash-based games or browsergames here).

Other than that, many Microsoft products have COM APIs in C++ that are more powerful than their Visual Basic Versions or .NET versions. ( COM = Component Object Model).

Take Windows Media Player for example. Programmers are encouraged to write plugins in C++ I think.

Also, it is a good thing to learn C++ if you like to deal with c++ legacy code. I think there is so much code out there that needs to be maintained, customized and pimped, well into the foreseeable future.

However, by the same reasoning you could also learn and become an expert in, say, VB6.

share|improve this answer
add comment

Well if you're looking for a simple and complete project to do in C++, might I suggest making a rouge-like game? Usually they're done in C, but many have been coded in C++ and other languages. Rogue-likes can very simple, shaving off much of the labor intensive aspects of game development and can be completed in extremely short amount of time.

You can use the tried and true curses library (ncurses, or pdcurses depending on your system) which is extremely straightforward and easy to use or you can dive into a graphics library like SDL or openGL.

The only hindrance to having a "complete" game is your own ambition.

share|improve this answer
add comment

Building on the author's response to @Glenn Nelson, at a personal level it will give you greater understanding of how the computer works. C++ works "closer to the metal" than Java and Python. This means that you will have to handle your own memory if you allocate it. Example: Want to create a new integer or Person object at run-time? What happens to it when the program exits? Java and Python will clean that up for you. In C and C++, you have to delete it yourself or else you'll create a memory leak.

You also get better control of the hardware, like your graphics card. This is why many graphics-intensive games are still written in C++.

Another common use of C or C++ is to write other programming languages or operating systems (C is used more for this). Java and Python code don't run directly on the hardware, they compile to set of instructions (bytecode) that are then executed by a C program. So if you ever had the desire to write your own programming language or operating system, C or C++ would be a good choice1.

From your question, I'm not sure what is your motivation for wanting to learn C++. It can teach you some of the things I've outlined. If you're looking for one language that you will do all of your work in, you're looking at it from the wrong perspective. Learning each language give you "another tool in your toolbox". Each has something they can do well. Use the appropriate tool for what you are trying to accomplish.

share|improve this answer
    
1 I intentionally simplified the explanation re: Java. I know people are writing programming languages in it, and that it has AOT and machine compilation. –  Core.B Jul 12 '11 at 14:27
add comment

C++ is a general purpose programming language with a focus on low level programming, speed and low resource consumption.

In short - you can program anything using C++. If you have a choice of language - take c++ if you need the speed (e.g. extensive graphics, number crunching).

What can you do in C++ that is easy to start and can not be done easily with a different language: Write an application for the MeeGo platform. The SDK is in C++. You learn QT which is a good library for C++.

Otherwise - start programming C++ not because you need to take this language for the project but because you want to learn the language. It's worth is. You'll learn a lot about resource management, generic programming, ...

One advice: take your time. C++ is not easy - it's a monster.

share|improve this answer
add comment

If it took you 3 months to learn Java and create a simple Web page, C++ will blow your mind. Get Stroustrup's book and start wading through it. Do EVERY exercise. Let us know how it goes in 3 months, if you are still at it.

share|improve this answer
add comment

C++ is nice for being able to choose to allocate objects on the stack or the heap. Other languages like java force you to allocate objects on the heap.

There is one distinct advantage of allocating on the stack. And that is elegant, deterministic, hands off resource clean up. The destructor of the object automatically fires as it's popped off the stack. Gone are the tripply nested try/finally blocks to handle the clean up of several resource holding objects. It is nirvana.

It really is ironic. Java/.net type languages were supposed to be easier with the garbage collector. But the moment your objects hog limited external resources you fall victum to the garbage collector and are forced to get your deterministic clean up via ugly error handling.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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