Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Deciding on a language  (Read 2869 times)

0 Members and 1 Guest are viewing this topic.

dgmulf

  • Newbie
  • *
  • Posts: 3
    • View Profile
Deciding on a language
« on: August 11, 2014, 01:31:02 am »
I'm planning on writing a graphical program using SFML for the first time. The only language I know is javascript, so I have to learn a new programming language for this project. I want something simple and efficient, so Golang and Python both look appealing to me.

I'm wondering about performance, because I will most likely be rendering 3D graphics and doing physics math. I understand that Golang code is compiled, but Python is interpreted. However, apparently "C calls" (whatever those are) are expensive in Golang, making usage of the SFML Go binding computationally expensive. So each language has its performance drawback.

Does one language have a significant performance advantage over the other? Is one language a lot easier to learn than the other?

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Deciding on a language
« Reply #1 on: August 11, 2014, 02:03:13 am »
Answering a question like this always comes down to personal opinion and experience, but here's my two cents.

Few things are more contentious than how well programming languages perform, but I think the most accurate general answer is one I saw on Stack Overflow a few weeks ago: It depends on how much money has been thrown at making it fast.  Most of my personal experience is with C++ and Javascript, languages which have had tons of money thrown at them, and performance has never been an issue for me (except when I did something stupid).  My suspicion is that Python is close to the same level, but that Golang probably isn't.  These days there really isn't an inherent performance difference between compiled, bytecode'd and interpreted code.  However, there's nothing stopping you from throwing together a little benchmark that represents the kind of expensive code you expect to write.

I've never felt that there was a huge gap in learning times between different languages.  Once you learn a single language properly (ie, read a book or two cover-to-cover so you know several of the pitfalls and best practices, not just enough to hack together a Pong clone) it's not all that hard to learn any other language properly in a relatively short amount of time.  If we pretend functional languages don't exist for a moment, most programming languages these days consist primarily of the same C-like syntax and idioms everyone knows already, and most of the stuff that really matters involves making decisions about abstract data structures and algorithms that are mostly language-independent.


Note on my background: C++ was the first language I learned properly, as part of my computer science degree, and after getting my first real job as a C++ programmer... I learned Javascript in a couple months and have barely touched C++ since, since I like UI code and that's the language my company uses for UIs.

P.S. Since you appear to be asking about SFML bindings, note that how good, active and up to date the bindings are is probably far more important than the languages themselves.  This you'll have to check for yourself.
« Last Edit: August 11, 2014, 02:08:42 am by Ixrec »

Mörkö

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
Re: Deciding on a language
« Reply #2 on: August 11, 2014, 03:00:13 am »
Most of my personal experience is with C++ and Javascript, languages which have had tons of money thrown at them, and performance has never been an issue for me (except when I did something stupid).  My suspicion is that Python is close to the same level, but that Golang probably isn't.

I don't know, Golang is in use by google in some pretty heavy weight systems. I'm no expert but I believe google had a good reason for inventing a modern version of C rather than cobbling together their critical server programs in python.

I'm planning on writing a graphical program using SFML for the first time. The only language I know is javascript, so I have to learn a new programming language for this project. I want something simple and efficient, so Golang and Python both look appealing to me.

Most important: Before committing to one of them, try writing small test programs in both. Just enough that you get a feel for how the SFML bindings work in them, how they integrate with OpenGL etc. After you have done that it will be very easy to decide which one felt better to you and better fit your style.

Less important, my opinion: It will be a lot easier to get started in python, because the language was designed to be easy and for people to very quickly throw stuff together, and it really excels at that. If you already know "programming" then you may be able to pick up python very quickly and can start working on your actual game not far from now.

But...

Choosing Go will probably make you a better programmer, and give you more benefits in the long run. The reason is that Go comes with the good stuff you need to write complex programs, most importantly static typing, but also rules that forces the programmer into keeping things simple and clean. Added bonuses include the whole built-in-concurrency thing if you ever need it, and a unit testing system as part of the standard installation.

That's my perspective as a person who started with Python, transitioned to C++ and am just now starting to learn Go, so because I'm a noob I may well be wrong so as per my original suggestion: Do your own research.

dgmulf

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Deciding on a language
« Reply #3 on: August 11, 2014, 04:57:53 am »
Thanks for the informative replies. :)

Ztormi

  • Jr. Member
  • **
  • Posts: 71
  • Web developer by day. Game developer by night.
    • View Profile
Re: Deciding on a language
« Reply #4 on: August 11, 2014, 11:07:40 am »
I thought I'd chip in and offer my point of view, not necessarily for you but anyone. If you are looking forward to working in the IT industry you might want to think what language would benefit you the most. For example, most of the programming job advertisements I see around here is C# or Java. Back when I was studying I did most of my side projects in C# (XNA, SDL.NET, OpenTK and now SFML.NET) because that's what I thought to be the most benefitial to me. Besides I already knew some C++ so C# was natural choice for me.

I still stick to C# mostly for desktop projects because that's the language I personally enjoy the most and that's what I do for living.
« Last Edit: August 11, 2014, 11:15:39 am by Ztormi »

greenk

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Deciding on a language
« Reply #5 on: August 11, 2014, 03:40:52 pm »
Quote
I'm planning on writing a graphical program using SFML for the first time. The only language I know is javascript, so I have to learn a new programming language for this project. I want something simple and efficient, so Golang and Python both look appealing to me.
From your post I suspect you are very new to programming, so forgive me if my assumption is incorrect.

You shouldn't be worrying (too much) about efficiency, it is unlikely to be a limiting factor in any program a beginner would write. If you find your code is slow, a poorly written algorithm will be the culprit 99% of the time unless you are doing something very ambitious. As an aside, python is quite a slow language (although very elegant).

I would also strongly recommend against learning go-lang. As a new language it lacks the learning materials (books, tutorials, source-examples) that more established languages have. Picking something more mainstream will make your life easier.

Quote
I'm wondering about performance, because I will most likely be rendering 3D graphics and doing physics math.

SFML doesn't support 3D, and you would be better off starting with 2D games anyway. Don't underestimate how challenging they can be. If you don't believe me, try and make a polished clone of a popular 2d game like super mario bros.

Python is my favourite language and for simple games it will suffice. However, it isn't well suited to hardcore graphics/physics programming which is more the domain of c++.

C# is a good in-between, very modern, and has some great engines in xna/monogame and unity.

Good luck with whatever you choose :)
« Last Edit: August 11, 2014, 03:46:10 pm by bottles »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Deciding on a language
« Reply #6 on: August 11, 2014, 06:16:33 pm »
I've never felt that there was a huge gap in learning times between different languages.  [...] If we pretend functional languages don't exist for a moment, most programming languages these days consist primarily of the same C-like syntax and idioms everyone knows already, and most of the stuff that really matters involves making decisions about abstract data structures and algorithms that are mostly language-independent.
I wouldn't say that... C++ for example is definitely one of the most complex general-purpose programming languages. I would even say that it takes considerably longer to learn it properly than other languages with similar application fields, e.g. C# or Java.

Why C++ is difficult to learn has different reasons in my opinion. The language has many features, especially in terms of abstraction mechanisms. Templates are a science for themselves, and even seemingly simple things like overload resolution or name lookup are based on very complex rules. C++ also comes with the philosophy of freedom and zero abstraction overhead, as such many language features can be used incorrectly, and errors are difficult to recognize. On the other hand, library features and idioms mostly prevent such usage, so it's a question of knowing the right tools. Not to forget, a large amount of existing literature and code propagates ancient style and bad habits and thus prevents people from learning modern, idiomatic C++.

What language you choose depends on your personal preference and your exact plans. I'm personally more a fan of statically typed languages, as they tend to scale better for large projects. Script languages are however very useful for prototyping or smaller things; it's also possible to combine both (e.g. C++ and Lua). I like C++ because it doesn't constrain me in any way and allows me to write compact code (which is efficient as a nice side effect). But I don't know whether I would have invested multiple years into learning it, if I had known its complexity from the beginning ;)

D is also a possible choice... it has a similar field as C++, but tries to improve some of its weaknesses. D is not backed by so many libraries, communities and resources however.
« Last Edit: August 11, 2014, 06:18:48 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

dgmulf

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Deciding on a language
« Reply #7 on: August 13, 2014, 12:16:39 am »
I'm glad someone mentioned C#, that's another language I'm strongly considering now. I think I've narrowed my choices down to Python or C#.

 

anything