Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The eternal battle of programming languages
#1
So the thread "The A-Engine: A new Beat 'em Up game engine" was recently invaded by a discussion about programming languages, so I thought it would be a good idea to take the discussion to a new thread.

Here are the posts: (quotes have been reduced in size so they will take up less space, everything else is a direct copy from the current version of the post)
The first post was by Nightmarex1337: (Click to View)
AmadisLFE wrote a response: (Click to View)
I wrote a response: (Click to View)
Thread author Doctor A wrote a response: (Click to View)
Dia6lo wrote a post: (Click to View)
Doctor A wrote a response to Dia6lo's post: (Click to View)
Lastly Bamboori wrote a post: (Click to View)

And here is my response to Dia6lo's post:
(06-20-2015, 05:34 AM)Dia6lo Wrote:  0. .NET
While I have little experience with it (and .NET in general), I know that C++ can also be used in order to write programs for the .NET platform (see C++/CLI). It may very well not be as good as a C# given that C# was designed for the .NET platform; I cannot tell as I use neither.
I would like to know what the benefits of using a platform like .NET as as opposed to native code.

(06-20-2015, 05:34 AM)Dia6lo Wrote:  1. Syntactic sugar
4. Tons of syntactic sugar
Syntactic sugar is not exclusive to C#, C++ has it as well for example range-based for loop, but many other things could be considered syntactic sugar, like templates or classes.

(06-20-2015, 05:34 AM)Dia6lo Wrote:  2. Resharper (crazy stuff)
I have no experience with this, so I cannot comment on the usefulness of it, but from what I can tell it is also available for C++.

(06-20-2015, 05:34 AM)Dia6lo Wrote:  3. LINQ
Again something I have little experience with (due to small experience with C#), but I doubt implementing it (or at least something like it) in C++ would be a big issue.
For example (Click to View)
There is also sqlpp11 which has a (somewhat) LINQ-like interface for SQL databases, as well as ranges which are also somewhat similar.
I also just saw Doctor A's post with a link to a library that also looks pretty good: https://cpplinq.codeplex.com/

(06-20-2015, 05:34 AM)Dia6lo Wrote:  5. Garbage collection (seriously, this one helps much)
I have yet to see a case where garbage collection is better than RAII. C++ smart pointers (unique_ptr and shared_ptr) already solve a lot of memory management issues.

(06-20-2015, 05:34 AM)Dia6lo Wrote:  6. No headers or includes
Yeah, I admit #include is not a particularly nice thing about C++. There is a study group working on modules for C++, but it is unlikely that it will make it for C++17, so at the moment that is definitely a valid (although arguable minor) argument against C++.

I have not tried it out, but for anyone interested there is an implementation of modules in Clang: http://clang.llvm.org/docs/Modules.html

(06-20-2015, 05:34 AM)Dia6lo Wrote:  7. No -> or ::, just dot(.)
I do not really see this as a problem, as they all have a very specific meaning and thus I never really use the wrong one accidentally.
In C# every object is a pointer, and so "." fulfils the purpose of "->", and C# just reuses "." when accessing members of types where C++ uses "::".
The case where "->" is nice is for smart pointers, as the "->" operator can be overloaded.
Just to be clear I do not think you are wrong here, it is just a minor bugbear if not just a matter of personal preference.

(06-20-2015, 05:34 AM)Dia6lo Wrote:  8. Properties, as wel as auto-properties
I found this article on the topic of properties, so the way I understand them is that they are syntactic sugar for a getter and setter methods, for which I can definitely see the purpose, and while I am sure you could write something similar in C++ (using union, friend and operator overloading) chances are that it would be a poor way to do it, and would certainly require more code than in C#. The obvious thing to do here would be to simply write getter and setter member functions, which obviously lack the sweet look of properties, so this is again a (somewhat) minor bugbear, but definitely something I would not mind seeing.

That said I rarely run into code where I would want to use it (likely due to my programming style), so for now I make do with normal member functions.

Also the example on this article uses properties for letting you access the time as both seconds and hours. If something like this was a part of C++, that is not a case where I would use it.
Instead I would use std::chrono (Click to View)
(06-20-2015, 05:34 AM)Dia6lo Wrote:  9. Readonly fields (not const)
Unless I am missing something about how readonly works in C#, is basically the same way const works in C++:
For example (Click to View)
Feel free to post your own opinions and discuss.
Age ratings for movies and games (and similar) have never been a good idea.
One can learn a lot from reinventing wheels.
An unsound argument is not the same as an invalid one.
volatile in C++ does not mean thread-safe.
Do not make APIs unnecessarily asynchronous.
Make C++ operator > again
Trump is an idiot.
Reply
Thanks given by: MangaD , A-Man , AmadisLFE
#2
Here we get into the discussion of "opinions", or "preferences". This is mine.

Everyone has their own goal, whether it is:
  • to create a game
  • to create a game in a "proper" programming language
  • to program in a particular programming language and create a game
  • something else

Short version is, each programming language is suited for some goals more than others. C#/Java are easier to debug when things go wrong. C++ gives you more control and performance, but has far more difficult concepts and obscure error messages.

Writing a cross-platform application is easier when your code runs on a VM (.net, jvm), though c++ has mitigated this with preprocessor code + CMake (cross-platform Make).

Dependency management for retrieving and using libraries is way, way better (much easier to do) in C#/Java (yay for Maven), which makes them very nice to work with. But I like working with c++, and dependency management just got much better with [biicode].

So ultimately, if your goal is different to someone else's, you'd probably say what you choose is better than what they chose. At work, debates between "senior" people usually aren't about "what you did is not good/correct", but usually it would be "that's not how I would have done it".


p/s: yes I still work on HQ, but nothing to show yet (sigh)
Reply
Thanks given by: Som1Lse , Dia6lo , Bamboori
#3
Okay, I didn't thought we'll go to "war" and I don't want to continue it. So yea, I would like to agree with Azriel:

(06-21-2015, 03:14 AM)Azriel Wrote:  Short version is, each programming language is suited for some goals more than others. C#/Java are easier to debug when things go wrong. C++ gives you more control and performance, but has far more difficult concepts and obscure error messages.

I didn't mean that A-man(or anybody else here) should change his mind and suddenly swap to c#, but I just wanted to tell about features that c# supports natively(not with 3-rd party libraries or self-implemented versions). Ofc, there are many great libs out there and it's totally fine to use them, but I'm more into the idea of having all in one place :p

So, this is my opinion and next will be clarification of Someone else's post.

(06-20-2015, 11:24 PM)Someone else Wrote:  
(06-20-2015, 05:34 AM)Dia6lo Wrote:  2. Resharper (crazy stuff)
I have no experience with this, so I cannot comment on the usefulness of it, but from what I can tell it is also available for C++.
Yep, but it was released a couple of month ago, while classic Resharper's age is about 10 years. That's why classic has more features and it's more stable right now. Btw, if you are a student, you should totally try any of them

(06-20-2015, 11:24 PM)Someone else Wrote:  Also the example on this article uses properties for letting you access the time as both seconds and hours. If something like this was a part of C++, that is not a case where I would use it.
I don't think that it's a good practical use of properties either, but it's just an example that shows how properties work.

(06-20-2015, 11:24 PM)Someone else Wrote:  
(06-20-2015, 05:34 AM)Dia6lo Wrote:  9. Readonly fields (not const)
Unless I am missing something about how readonly works in C#, is basically the same way const works in C++:
Yep, it's kind of my bad here. In C# they divided two functions of C++ const into two modifiers. As msdn states:
Code:
The readonly keyword is different from the const keyword. A const field can only be initialized at the declaration of the field. A readonly field can be initialized either at the declaration or in a constructor. Therefore, readonly fields can have different values depending on the constructor used. Also, while a const field is a compile-time constant, the readonly field can be used for runtime constants as in the following example:
    CSHARP-Code:
public static readonly uint timeStamp = (uint)DateTime.Now.Ticks;
Reply
Thanks given by:
#4
What I wanted to say was people should stop wasting enormous time trying to write C++. There no need for that. It's like starting math with advanced calculus...

This guy deserves a cookie:
Want to be a game developer?
Ultimately, my constant dissatisfaction with the way things are becomes the driving force behind everything I do.
[Image: sigline.png]
LF2 IDE - Advanced visual data changer featuring instant data loader
LF2 Sprite Sheet Generator - Template based sprite sheet generator based on Gad's method
[Image: sigline.png]
There is no perfect language, but C++ is the worst.
Reply
Thanks given by: MangaD
#5
Well, it's personal choise and also great experience using [blabla] langauge, create own data parser or whatever.

It's just the same as when people making new tiny OS just for fun. They're getting a lot of experience with programming. Worth it anyway. Knowledge is true power o/
Reply
Thanks given by:
#6
(06-21-2015, 01:50 PM)Nightmarex1337 Wrote:  What I wanted to say was people should stop wasting enormous time trying to write C++. There no need for that. It's like starting math with advanced calculus...

This guy deserves a cookie:
Want to be a game developer?
If you're trying to get far with Mathematics, then you'll eventually have to learn advanced calculus. What the author of the article is getting at is: going with C++ as a first choice is a bad idea (which I don't believe to be always true). Might be, but C++ is still a great language that is worth picking.

The thing about C++ code always being much verbose isn't always true either. In fact, it's the other way around; C++ code can be much shorter, but that is what has given C++ the reputation of being too abstract.
[Image: signature.png]
A-Engine: A new beat em up game engine inspired by LF2. Coming soon

A-Engine Dev Blog - Update #8: Timeout

Reply
Thanks given by:
#7
A LF2-like engine does not require every bit of performance a PC offers... Seriously, LF2 runs at 30 fps (AFAIK)... I remember the time I tried to compile OGRE library and all I wanted to do was getting starting a little... .::Epic Fail::. I've got used to the way C#/Java libraries work out of the box so much that I couldn't fall back to C++... Also, I remember the day I managed to get a plugin based LF2.IDE easily: just made form controls public so they are reachable outside of the executable and then used reflection to handle the rest (thanks to cs-script library)...

@Someone Else (Click to View)
Ultimately, my constant dissatisfaction with the way things are becomes the driving force behind everything I do.
[Image: sigline.png]
LF2 IDE - Advanced visual data changer featuring instant data loader
LF2 Sprite Sheet Generator - Template based sprite sheet generator based on Gad's method
[Image: sigline.png]
There is no perfect language, but C++ is the worst.
Reply
Thanks given by:
#8
(06-22-2015, 06:39 PM)Nightmarex1337 Wrote:  Notepad++ is a Scintilla based text editor and AFAIK, Scintilla does not support unique syntaxes, in order to do that you need to write a new lexer library-plugin and I have no idea how that is done.

Language -> Define your language...
[Image: random.php?pic=random]
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
The meaning of life is to give life a meaning.
Stop existing. Start living.
Reply
Thanks given by:
#9
(06-22-2015, 07:49 PM)MangaD Wrote:  
(06-22-2015, 06:39 PM)Nightmarex1337 Wrote:  Notepad++ is a Scintilla based text editor and AFAIK, Scintilla does not support unique syntaxes, in order to do that you need to write a new lexer library-plugin and I have no idea how that is done.

Language -> Define your language...
You mean "user defined languages"? That allows adding keywords and all, but limited syntax related options.
[Image: signature.png]
A-Engine: A new beat em up game engine inspired by LF2. Coming soon

A-Engine Dev Blog - Update #8: Timeout

Reply
Thanks given by:
#10
I just remembered one important plus point for C++, and that is it looking really good on your resume :P.
[Image: signature.png]
A-Engine: A new beat em up game engine inspired by LF2. Coming soon

A-Engine Dev Blog - Update #8: Timeout

Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)