views:

762

answers:

10

So, I got this idea that I'd try to prototype an experimental user interface using OpenGL and some physics. I know little about either of the topics, but am pretty experienced with programming languages such as C++, Java and C#. After some initial research, I decided on using Python (with Eclipse/PyDev) and Qt, both new to me, and now have four different topics to learn more or less simultaneously.

I've gotten quite far with both OpenGL and Python, but while Python and its ecosystem initially seemed perfect for the task, I've now discovered some serious drawbacks. Bad API documentation and lacking code completion (due to dynamic typing), having to import every module I use in every other module gets tedious when having one class per module, having to select the correct module to run the program, and having to wait 30 seconds for the program to start and obscure the IDE before being notified of many obvious typos and other mistakes. It gets really annoying really fast. Quite frankly, i don't get what all the fuzz is about. Lambda functions, list comprehensions etc. are nice and all, but there's certainly more important things.

So, unless anyone can resolve at least some of these annoyances, Python is out. C++ is out as well, for obvious reasons, and C# is out, mainly for lack of portability. This leaves Java and JOGL as an attractive option, but I'm also curious about Ruby and Groovy. I'd like your opinion on these and others though, to keep my from making the same mistake again.

The requirements are:

  • Keeping the hell out of my way.
  • Good code completion. Complete method signatures, including data types and parameter names.
  • Good OpenGL support.
  • Qt support is preferable.
  • Object Oriented
  • Suitable for RAD, prototyping
  • Cross-platform
  • Preferably Open-Source, but at least free.
+1  A: 

The only real alternative if you desire all those things is to use Java, but honestly you're being a bit picky about features. Is code completion really that important a trait? Everything else you've listed is traditionally very well regarded with Python, so I don't see the issue.

Ron Warholic
When learning so many new APIs, code completion is very important.I realize that Python is a very good fit on paper, which is why I chose it in the first place, but all the small annoyances gets to me. This is summed up in the first requirement, which is a bit subjective, I know.
+2  A: 

Looking just at your list I'd recommend C++; especially because Code Completion is so important to you.

About Python: Although I have few experience with OpenGL programming with Python (used C++ for that), the Python community offers a number of interesting modules for OpenGL development: pyopengl, pyglew, pygpu; just to name a few.

BTW, your import issue can be resolved easily by importing the modules in the __init__.py files of the directory the modules are contained in and then just importing the "parent" module. This is not recommended but nonetheless possible.

Pankrat
Thanks for the tip. I'll try it out.Code Completion is a good argument for C++, but I get that for Java as well, along with many features superior to C++ for what I'm trying to do.C++ will most likely be my choice for an eventual final implementation though.
+1  A: 

The text editor (not even an IDE) which I use lets you import API function definitions. Code completion is not a language feature, especially with OpenGL. Just type gl[Ctrl+I] and you'd get the options.

Pete Kirkham
I believe PyDev does this as well. The standard modules have full signatures, but external APIs don't. Go figure. OpenGL especially, is really painful without parameters.When I say language, I actually mean the language, as well as its ecosystem, as those are usually tied together pretty closely.
In SciTE, you get the method name, its parameters (and their types in static languages), and any comments on the same line, if you set them up. So if the language doesn't have static types, then they aren't there, but you should be able to get names somehow.
Pete Kirkham
Actually, if you build the api file from the original header you get the data types too. I don't use Eclipse based tools, many of the assumptions they are based on are false.
Pete Kirkham
+1  A: 

I tried using Java3D and java once. I realized Java3D is a typical Java API... lots of objects to do simple things, and because it's Java, that translates to a lot of code. I then moved to Jython in Eclipse to which cleaned up the code, leaving me with only the complexity of Java3D.

So in the end, I went in the opposite direction. One advantage this has over pure python is I can use Java with all of Eclipse's benefits like autocomplete and move it over to python when parts get unwieldy in Java.

Paul
Java3D is more of scene graph API though. Java OpenGL (JOGL) is just a thin wrapper, and so is pretty much identical to Open GL code in any other languages.Jython might be a good middle-ground between Java and Python though. I'll have to try that.
+1  A: 

It seems like Pydev can offer code completion for you in Eclipse.

Claudiu
Partially, I would say. External APIs only show up with method names, so I still have to look it up for the parameters. This is especially painful with OpenGL.
+7  A: 

It seems you aren't mainly having a problem with Python itself, but instead with the IDE.

"Bad API documentation"

To what API? Python itself, Qt or some other library you are using?

"lacking code completion (due to dynamic typing)"

As long as you are not doing anything magic, I find that PyDev is pretty darn good at figuring these things out. If it gets lost, you can always typehint by doing:

assert isinstance(myObj, MyClass)

Then, PyDev will provide you with code completion even if myObj comes from a dynamic context.

"having to import every module I use in every other module gets tedious when having one class per module"

Install PyDev Extensions, it has auto-import on the fly. Or collect all your imports in a separate module and do:

from mymodulewithallimports import *

"having to select the correct module to run the program"

In Eclipse, you can set up a default startup file, or just check "use last run configuration". Then you never have to select it again.

"before being notified of many obvious typos and other mistakes"

Install PyDev Extensions, it has more advanced syntax checking and will happily notify you about unused imports/variables, uninitialized variables etc.

truppo
When I say Python, I refer to the language and the ecosystem, so yes, you are correct in that it is not so much the language. As for the bad API documentation, this is mainly the PyOpenGL docs. As usual for python docs, data types are not listed, which leaves me to guess what it wants at times.
I find that PyDev is not very good at figuring out the data types, but that's a neat trick with typehinting. It still is a hassle in most situations though, but might come in handy.And thanks for the other tips as well. It really helps.
+1  A: 

I started off doing OpenGL programming with GL4Java, which got migrated to JOGL and you should definately give it (JOGL) a try. Java offers most of the features you require (plus Eclipse gives you the code completion) and especially for JOGL there are a lot of tutorials out there to get you started.

Sebastian
I certainly will.
+1  A: 

Consider Boo -- it has many of Python's advantages while adopting features from elsewhere as well, and its compile-time type inference (when variables are neither explicitly given a specific type or explicitly duck typed) allows the kind of autocompletion support you're asking about.

The Tao.OpenGL library exposes OpenGL to .NET apps (such as those Boo compiles), with explicit support for Mono.

(Personally, I'm mostly a Python developer when not doing C or Java, but couldn't care less about autocompletion... but hey, it's your question; also, the one-class-per-module convention seems like a ridiculous amount of pain you're putting yourself through needlessly).

Charles Duffy
Boo and Tao looks interesting. I'll have to look into that. One-class-per-module is obviously something I have from Java, and certainly a habit I can change. But it bothers me that it doesn't allow this, for no obvious reason, when package namesapces should be more than enough to avoid pollution.
+1  A: 

I don't understand why nobody has heard of the D programing language?

THIS IS THE PERFECT SOLUTION!!!!

A: 

Haniff,

I'm curious if you can expand on why D is the perfect solution. I've been intrigued by D for a while, and while I find myself in Phears's position of looking for a simple solution to OpenGL prototyping, I'm not convinced that 'D' is actually the solution. In my opinion, D needs to gain a lot more traction from the general development community in support for IDEs and ease of installation before it can really be consider a viable tool. Right now, its fun the play with, but the moment I have to get serious about programming, I have to abandon it for a more complete and robust tool-set.

Kyle