C++, should I switch?

Started by
27 comments, last by jbadams 11 years, 7 months ago
I started learning C++ some time ago, and feel I am a competent programmer. However I've read using C# and Java makes developing applications and games much quicker, and theres a less steep learning curve. I know about how dealing with bugs is easier in those languages, however that doesn't make me want to switch. Essentially, I am asking if I should switch to C#. I've succeeded in making a tic tac toe game and Simple R.P.G. in C++, and know a lot about the language. I really like C++ and so far have had fun learning how to program with it. So should I give up on C++ and switch to C# now that I'm a few months in. (For clarification, C++ is my first language.

I'm a game programmer and computer science ninja !

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here !

Advertisement
Don't switch.

Experiment.
There is one major downside to switching...

Once you've programmed in a sane language, C++ feels SOOOOOOO much *more* painful. I need to make my own ??what??, to do what?? Really..... sheeesh.


Telestyn pretty much got it in one. You are going to be picking up many different languages over your career; dont look at it as leaving one behind, but learning a new one. Your knowledge doesn't magically go away. In fact, learning a second language will generally make you better at your first language.


If I can give you a tip though, learn the new language. Don't try to turn program the new language in the style of your old language. This is a trap far too many people fall into.

Once you've programmed in a sane language, C++ feels SOOOOOOO much *more* painful. I need to make my own ??what??, to do what?? Really..... sheeesh.


C++ is the only sane language.

Once you know c++ there is no reason to use anything else. Unless of course you want the best speed possible in that case you would use assembly (sometimes I use it inline with c++ just for speed). As for making your own code for complicated things you can either have fun and do it yourself or use a third party library.

I tried learning JAVA, I decided it was just like c++ but slower and with too many rules.
C++ is the only sane language.

Once you know c++ there is no reason to use anything else. Unless of course you want the best speed possible in that case you would use assembly (sometimes I use it inline with c++ just for speed). As for making your own code for complicated things you can either have fun and do it yourself or use a third party library.

I tried learning JAVA, I decided it was just like c++ but slower and with too many rules.
C++ is by far my favorite language, but there's a lot of reasons to use other languages. It's incredibly self-harming to restrict yourself to a single language.

e.g. Some personal experiences:
* I want a really simple program to copy certain files from Windows directory A to directory B -- C++ is overkill, I can write this program in 30 seconds with Batch.
* I want to do some basic analysis of some data and display it in a simple table for my own use only -- C++ requires me to build a GUI and write a lot of boilerplate code. Instead I could write 10 lines of JavaScript and spit out HTML to a web-browser.
* I want to write some non-performance-critical gameplay code without worrying about memory management, and would like to use modern features such as closures (on platforms that don't yet have C++11 compilers), and dynamic code reloading (for fast iteration) -- I'll just use Lua.
* I'm doing a bunch of data-processing work, which requires me to be able to quickly iterate on GUIs, load XML files and write out binary streams, while making use of a lot of "standard" data structures. I don't care about memory usage or performance that much, I just want quick development time -- I'll use C#.
* I'm targeting a GPU -- I'll use HLSL, for obvious enough reasons.

Every programmer should learn as many languages as they can and put them in their toolbox. A bigger toolbox gives you more options so you're not hitting nails with a screwdriver...

As for performance, algorithmic optimisation and memory-layout optimisation are much more important than reducing cycles by outsmarting the compiler with manually written assmebly. It should be very rare that there's a need to use inline assembly (and in many of those cases, intrinsics can be a better option).
Somebody is loving the new Language War tag laugh.png

[color=#008000]I really like C++ and so far [color=#008000]have had fun [color=#008000]learning how to program with it. So [color=#ff0000]should I give up on C++ and [color=#ff0000]switch to C# now that I'm a few months in.[/quote]
See, the green and red statements are contradictory. You're having fun with a language, and you want to stop developing in it? What is wrong with you???!11! Seriously though, there is no such thing as "switching" to another language. Your brain has space for more than one language, and just because you write a project in C# because C# is suited to a particular task doesn't mean you are "giving up C++" or "betraying your C++ roots" or some other nonsense - it just means you decided C# was a better language to use for such and such project than C++. Doesn't mean the next program you write will automatically be in C#, or that by opening up Visual Studio C# you've suddenly lost all knowledge of C++ and have to start from scratch again... It's not a crime to be proficient in multiple languages, it's actually a requirement if you want to be productive. Sticking to one language just doesn't cut it, unless your goal is to be known as "the guru".

Essentially, I am asking if I should switch to C#. I've succeeded in making a tic tac toe game and Simple R.P.G. in C++, and know a lot about the language.[/quote]
How much do you really know in C++? I'm asking this because many people think they've "mastered a language" when in reality, they've barely scratched the surface. There may still be a lot for you to discover and have fun with. Anyway, my point is, sure, you can download Visual Studio C# 2010 Express for free, fire up a hello world template and start coding. It's a few minutes away if you've a decent internet connection. Try it out! Figure out the pros and cons of each language for yourself, find their strengths and weaknesses, see where C# can benefit you and when you'd rather use C++.

For example, just today, I wrote some low-level C library code (with some makefile scripting), then worked a bit on my FreePascal raytracer, did some Java for my university assignments later on, and also had some fun in my Python sandbox throughout the day with number theory algorithms. I would not have been able to accomplish any two of those tasks using only one language, so in this sense I was infinitely more productive knowing multiple languages than if I only knew one. Simple as that.

Once you know c++ there is no reason to use anything else.[/quote]
Oh, really? Please, do enlighten us on how you write GPU shaders. Do you cobble them together from C++ macros? Or perhaps you write them directly in IL assembly, hardcore-style? Also, how long does it take you to write a tool that replaces sequences of bytes in a binary buffer? Still waiting, cause in Python I'm done: buf.replace(). Oh, yours is... what? Faster? Oh, but I was only going to use it for a 10kb file anyway.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”


I started learning English some time ago, and feel I am a competent speaker. However I've read using Japanese and Chinese makes communication and business much quicker, and theres a less steep learning curve. I know about how dealing with people is easier in those languages, however that doesn't make me want to switch. Essentially, I am asking if I should switch to Japanese. I've succeeded in making a few essays and forum posts in English, and know a lot about the language. I really like English and so far have had fun learning how to speak with it. So should I give up on English and switch to Japanese now that I'm a few months in. (For clarification, English is my first language.

Fixed.

If you read that and thought it sounded strange, well, that just puts your question into perspective.
As has been said: You have the capacity to learn and use multiple languages at once.
????


If you want to use another language, just start using it, in addition to the languages you currently use.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Oh, really? Please, do enlighten us on how you write GPU shaders. Do you cobble them together from C++ macros? Or perhaps you write them directly in IL assembly, hardcore-style? Also, how long does it take you to write a tool that replaces sequences of bytes in a binary buffer? Still waiting, cause in Python I'm done: buf.replace(). Oh, yours is... what? Faster? Oh, but I was only going to use it for a 10kb file anyway.[/quote]

I'm sorry that came of so rudely but what I meant was for making games, yes scripting languages like python and javascript are great for doing small automation and I admit I use them from time to time, but if you are writing games the bulk of it is usually time critical and should be written in a fast language like c++, that said languages like GLSL are useful but they are incredibly application specific, they really just supplement other languages and not replace them.

More specifically c++ is in my opinion the best general purpose language for writing games.

I'm sorry that came of so rudely but what I meant was for making games, yes scripting languages like python and javascript are great for doing small automation and I admit I use them from time to time, but if you are writing games the bulk of it is usually time critical and should be written in a fast language like c++, that said languages like GLSL are useful but they are incredibly application specific, they really just supplement other languages and not replace them.

More specifically c++ is in my opinion the best general purpose language for writing games.

That's a lot more defensible (and I'm sorry if I came off as rude, too - it wasn't my intention). I don't really agree too much on the "bulk of writing games is usually time critical" - from a graphics point of view it's all handled by the graphics API and driver so from that perspective C++ gives you no special speed advantage. From a game logic point of view, it is true that performance matters, but usually game logic isn't all that intensive (perhaps AI). Physics can be a bottleneck, but surely you are using an existing library which is already compiled in C++ and has bindings in your language (like bullet).

Of course it's very game specific, some games are more intensive than others. AAA games sure are time-critical, but I'm not so sure a tetris, tic-tac-toe, amateur FPS or hangman needs the full horsepower of a modern processor, so in this case I would happily trade some performance for faster development time, for instance.

I'm not sure I'd call GLSL or other shader languages "application-specific". If anything they're incredibly important since they are the *only* languages that can run on graphics cards, so if you ever want to use the GPU, you must learn them - there is no going around that (though note that OpenCL 1.2 has a stripped-down-C++ kernel compiler now! though you still need to learn the API and how to effectively program with it, no more inline assembly and pointer hacks)

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

There is no right or wrong answer. As many have said, it's not like switching to C# as your main language will mean you can never program in C++ again, so it's completely fine. If you're asking this question, though, it probably means the answer is yes. If you're curious about another language, then do what a little kid would do: Check it out. Don't ask for permission from the guys on the forums. Maybe you won't like many of the other languages. So what? Just stick with C++. Maybe you'll realize C++ is a horrible nightmare. Great! Enjoy whatever new language you're using. As long as you're programming, I don't think it quite matters what language you're using.

This topic is closed to new replies.

Advertisement