Sign in to follow this  

Language decision crisis

This topic is 417 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Edited by RiskStructureAdjustment

Share this post


Link to post
Share on other sites

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++?

Share this post


Link to post
Share on other sites

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).

Share this post


Link to post
Share on other sites

E.g. every library uses it's own strings and vectors


That one really bothers me too. But it's not every library. For instance, SFML and gtkmm (a C++ version of GTK+) are happy to work with standard strings and vectors, even if at least in some cases they have their own types too.

Share this post


Link to post
Share on other sites

 

@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.

 

 

I thought by core, you meant the core of the unity. Ie, the engine itself, not the scripts written by the users.

Share this post


Link to post
Share on other sites

Go for C. Clean, fast, simple to learn, powerful and straight-forward... plus you have access the widest range of libraries.

 

C++ gives me headaches, while i love C.

 

Don't listen people saying "ommg in C you have to do yourself your memory management", really it's only 2 functions (malloc & free), nothing to worry about...

Edited by xxFuttBucker444

Share this post


Link to post
Share on other sites

Actually I'm using plain old C, for a 3DS homebrew game, on a medium sized scale.

 

The reason I chose C was simply because at this point I had enough of C++, but now I'm thinking about porting it to C++. And C libraries can be interfaced from C++ without any wrapper or extra library and even most other languages can interface C with only little effort.

 

I would say C is easier to learn than C++. Simply because C is so simple and in my eyes too simple. And this time there is a real alternative ready to be used.

Share this post


Link to post
Share on other sites

 

... plus you have access the widest range of libraries.
 

 

Good point... if only there was some way to access C libraries from C++!

 

 

 

Don't listen people saying "ommg in C you have to do yourself your memory management", really it's only 2 functions (malloc & free), nothing to worry about...

 

I know, right?! I mean, it's like a gun... they only have one button... no way that could cause trouble if you don't know what you're doing!

 

:rolleyes:

 

 

people get told C memory alloc is evil so they think it is.

It's not harder than the concept of constructor/destructor.

Wanna create something ? => malloc/calloc

Delete it ? => free

Check if pointer isn't null before using it when you're unsure about its state and you're fine... I've never had much problems with it. Sure it crashes if you're doing stupid things, but you can't be a good programmer if you don't know what you're doing, the problem is just reported elsewhere if you don't have to handle memory management ...

Edited by xxFuttBucker444

Share this post


Link to post
Share on other sites

Don't tell me it's too hard to do free() if you EXPLICITLY make your function return prematurely... It's not even hard to think about, your productivity won't suffer that much.

 

Talking about shittiness, I'm really more worried about people making overall shitty code than people doing low level stuff if they know what they're doing.

I'm a web developer, my main prog language is PHP and you won't believe the level of code retardness i have to handle on most of the projects i work on, even if they were using super-magic-all-automatic frameworks !!! Such a waste of time trying to understand and rewrite code...

Edited by xxFuttBucker444

Share this post


Link to post
Share on other sites
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.

 

 

 

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

 

Clearly you're looking for languages you can use in Windows, but at the same time, .NET languages are off the table because your friends are using Macs. It sounds like Python or some JVM-based language is your best choice then. If being on a Mac influences your language decision that much, then learn Swift.

Edited by Alpheus

Share this post


Link to post
Share on other sites
If being on a Mac influences your language decision that much, then learn Swift.

I already thought about Swift, but it's only available on Mac OSX and on Linux.

 

 

It sounds like Python or some JVM-based language is your best choice then.

Kotlin is great, but everytime I use something like that I get the feeling that my code is very inportable. It's a very bad feeling, like when you're are sitting on a stack of whatever and it's comfortable but you don't know how many levels are between you and the ground and if the stack breaks, everything made up there is worthless. And in case of the JVM the stack is huge, really huge. Also the user has to install Java, which is because of Minecraft often already the case.

Edited by RiskStructureAdjustment

Share this post


Link to post
Share on other sites

Kotlin is great, but everytime I use something like that I get the feeling that my code is very inportable.

 

Most people have Java some version or another installed on their computer. Plus, the JVM, last I heard, is very portable. It's not the JVM is gonna break in such way to render all languages built inoperable. If Kotlin gives you that warm feeling as a programmer, then use it. Portability and fragility are the very least of its problems.

Share this post


Link to post
Share on other sites
Most people have Java some version or another installed on their computer. Plus, the JVM, last I heard, is very portable. It's not the JVM is gonna break in such way to render all languages built inoperable. If Kotlin gives you that warm feeling as a programmer, then use it. Portability and fragility are the very least of its problems.

Yesterday I tried to get premake + GLEW + GLFW setup in a platform inpendent way(so not a single VS project file). I go back to Kotlin. Also there is this thing: https://github.com/jtransc which compiles JVM Bytecode to Haxe which transpiles to C++ or JS(last time I tried this a hello world Java app resulted 27 MB of C++ source code).

 

EDIT: The binary had a size of ~5 MB

Edited by RiskStructureAdjustment

Share this post


Link to post
Share on other sites

Kotlin is great, but everytime I use something like that I get the feeling that my code is very inportable.
Kotlin compiles to bytecode that HotSpot can understand, that lands you Windows, OSX and many nix flavours (Linux, BSD, Solaris, etc). As if that wasn't enough (it is), it also produces bytecode that ART/Dalvik can understand. That lands you a couple million devices more. If that isnt enough for you (for some weird reason, at this point you're just being unrealistic), you can always hook up libGDX, which is prepared not to only target all of that, but it also has a web backend (through GWT I believe), and an iOS backend (through Intel's Multi-OS Engine). 

 

You can always bring up the "muh performancez!" argument against Java, but portability? That's silly. You're silly.

 

Disclaimer: Targeting all of those platforms is a **fucking ton** of work, regardless of the language you choose. So my position is that worrying about targeting 19 platforms without even having anything to run on them yet is also silly.

Share this post


Link to post
Share on other sites

This topic is 417 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this