Language decision crisis

Started by
29 comments, last by isbinil 7 years, 6 months ago

First of all I want to say hi, I'm new in the forum. I do game development only as an hobby beside school, but started with programming in the 5th grade and now I have a pretty large set of languages learned.

After working with C++ for a while I begun to hate it. C++ is such a flawed language. For example the whole header/source seperation makes code hard to write and to read. Also const correctness is very annoying(I understood why I should do this, but writing const after every second thing makes me cry). These are only two critics on C++ I have more. The problem is not that I don't understand C++, I used C++ extensively, I learned modern C++ with it's bells and whistles but from my view C++ carries a too heavy legacy.

So after this I fall into what I call language decision crisis. Then I tried several languages, Go which looked nice at the first glance, but Go is a baby toy compared to C++(no ternary, no custom iterators...).

Then I tried D, Nim and Rust. All of them are nice languages but they share a common weakness: they have very bad editor support(only very bad autocompletion). I also tried Kotlin which is a very nice language(with very good editor support, IntellJ!), but it's based on the JVM which is a no go for me.

I end up using Haxe, which has better editor support than the other(it works more or less), but the engine I wanted to use(Luxe) of course doesn't work with the latest version(because of some bugs), but the VSCode plugin requires the new version.

So what do you recommend me to do(Yes I know, I shouldn't post these vs threads, but I really need advice). I'm a little bit too picky, I know.

Oh and C# isn't an option, I have two Mac using, Mono hating friends who already annoy me because I'm using Windows.

Advertisement

What do you want to program? Typically, some languages are good for one type of programs and very bad for others. As such, it's a bad idea to first pick a language, and then decide what you want to do with it.

This holds as much for C++ as it does for other languages, of course.

C++ is big, and no doubt ugly at some places. Parts are due to legacy, and other parts are costs that you pay for getting speed. However, C++ is a lot about freedom. While there is a recommended way of doing things, it's not obligatory in many cases. The header files are somewhat unavoidable currently, but nobody said you have to write code in the header file. If you don't do that, the code file becomes the main file, and the header file becomes sort of a summary that you have to keep consistent, but not actually use (much).

Similarly, const is useful, but it's not mandatory. It may cost you some performance, but maybe you can find a workable way, if you continue working in C++.

The alternatives are all very niche languages. They don't have big communities, and thus no development power to handle all the stuff for a good IDE experience. A second problem may be that these languages are much more dynamic than C++, which means it is harder to impossible to give you auto-completion support. I would say this is a price you pay for the flexibility of the language.

Some main stream language to consider (some you excluded):

Java (but it has a JVM, which is apparently a bad thing to you, for some reason)

C# (which is from what I hear, a quite nice Java-like language. I can see why your friends don't like it, but perhaps you should ask them about Objective C :p )

Python

Ruby

Lua

Much more dynamic, quite different, so it may not be what you look for.

Pascal & derivatives, like Modula and Delphi. (I stopped looking for Pascal a long time ago, but I think it still lives).

C would also be an option. Eg Python (as well as other languages) interfaces nicely with it, so you can write most in Python, and the bits where speed matters, in C.

Otherwise, yep I agree you're too picky. There are only a limited number of main stream languages, and that's it.

Alternative directions are to find a better editor, or work to improve your editor in some way, eg add templates or scripts or whatever your editor can do. Last but not least, you can do a lot in code generation, where you generate things you don't want to write every time. The big disadvantage of that is pretty soon you have your own mini language, and obviously no editor comes with support for it.

I do share your distaste for C++, but right now it is still the sharpest tool in the box if you need optimized and portable code. I personally wouldn't bother with any other compiled language anymore. You can also avoid a lot of clumsyness by not feeling obliged to use template magic, iterator trickery and other advanced features of the language. You can get by without those.

C++ is like the English of programming languages, you'll find support for it everywhere which for me is the primary argument to keep using it. Usually I'll stick Ruby or another scripting language on top of it so non-critical code is much easier to write. But in terms of platform support, library availability and such things there just isn't any alternative.

Yes, I know. I probably demonized C++ in my memories too much. I should give it another chance.

Also Rust is on the rise and it's designed to be a real alternative to C++. And thanks to the Rust language server(https://github.com/jonathandturner/rustls), good IDE support will be available in the future.

C++ is such a flawed language. For example the whole header/source seperation makes code hard to write and to read. Also const correctness is very annoying

Go is a baby toy compared to C++(no ternary, no custom iterators...).

Then I tried D, Nim and Rust. All of them are nice languages but they share a common weakness: they have very bad editor support(only very bad autocompletion).

I also tried Kotlin which is a very nice language(with very good editor support, IntellJ!), but it's based on the JVM which is a no go for me.

I end up using Haxe, which has better editor support than the other(it works more or less), but the engine I wanted to use(Luxe) of course doesn't work with the latest version(because of some bugs), but the VSCode plugin requires the new version.

Oh and C# isn't an option, I have two Mac using, Mono hating friends who already annoy me because I'm using Windows.

I've rarely seen such a variety of weak reasons for disliking programming languages. It looks like a psychological problem rather than a technical one: feeling guilty of not learning C++ properly, procrastinating with alternative languages, and believing (deep down) that you actually need to use C++.
Unless you commit to a non-C++ game engine (e.g. Unity uses C#) I suggest giving a second chance to C++ with Visual Studio 2015, GCC for a second opinion, and a humble learning attitude.

Omae Wa Mou Shindeiru

As said above I give C++ another chance. I have luxury problems and I don't get anything done because I'm searching for something which doesn't exit.

The language itself isn't my problem, although my C++ is a little bit stiff, I know C++. And e.g. I know why header files are needed.

At last I want to say thank you, I think I finally can do something.

EDIT: I could do something the whole time, I was simply obsessed with something else

I have to second the other's opinion; your negativity towards c++ is probably based on some bad memories.

It's strange, that you complain about writing down const too often (trust me, in larger projects you'll love these consts), yes you like Rust, which is a way more verbose and stricter language than c++.

Give it a second go, or look into rust a bit more. Atom.io or intellij idea works well with rust, you won't get the same level of auto-completion than you get for c++, but it's getting better with every day.

@LorenzoGatti - I don't think unity's core is written in c#. Isn't that c++?

shaken, not stirred

It's strange, that you complain about writing down const too often (trust me, in larger projects you'll love these consts), yes you like Rust, which is a way more verbose and stricter language than c++.

Rust is indeed very strict and that's not my problem.

Now, after you mentioned it, I think I identified the actual problem I have with C++: everybody does what ever she/he wants. E.g. every library uses it's own strings and vectors or some people do use feature xy some don't. I've already seen people writing OOP code in C++, the C way(so they use C++ as C with namespaces and default argument values).

So my problem is/was freedom, that's a weired problem.

Also in Rust it's only the matter of mut, three letters less :P (not a very good argument).

I agree with your last comment. 10 different people would write 10 different style of code. Heck, even my personal coding style changed significantly in the last 10 years. I would angrily smack my 10 year younger version if we met in person. :)

shaken, not stirred

@LorenzoGatti - I don't think unity's core is written in c#. Isn't that c++?

Unity scripting is traditionally C#. Alternative scripting languages include "UnityScript" (more or less Javascript) and Boo.

Omae Wa Mou Shindeiru

This topic is closed to new replies.

Advertisement