Oic. I haven't used OGL w/ C before. I usually use C++ w/ AllegroGL and Classes.
Printable View
Most performance-critical code is written in lower level languages like C or C++, but Abra's question was where she should start. I've said this before and I'll say it again: I highly recommend Python as a first language. Thanks to this excellent tutorial, you can learn the syntax in a day or two. Python is very easy to learn and use, and it produces much clearer, more consistent, more concise, and more bug-free code than any other language (with the possible exception of Haskell) that I have ever used. Python also has a larger application domain than almost any other language. While you could just use it as a replacement for shell scripts, you can also use Python for desktop applications, games, server-side scripting, and web development. The only real downside of Python is that performance sometimes suffers due to the lack of a real compiler, but there are many remedies. The fact that Python is interpreted directly from the source files also means that the development time is drastically shorter than that of a language like Java, C, or C++. Eric Raymond's "Why Python" shows that even expert programmers use the language.
CLI == The **** to me.
C is a great place to start.
how does the fact that a language is interpreted make development time shorter? if i remember right Brainfuck is interpreted, but that doesn't make it's dev time shorter.Quote:
he fact that Python is interpreted directly from the source files also means that the development time is drastically shorter
Python is interpreted directly from the source code, which means that there is no compile phase of the development cycle. With a language like Java, which requires compilation to bytecode before running with the Java interpreter, or a language like C++, which compiles directly to machine language, it can take minutes or hours (in the more extreme cases) to test any changes you make to the source code. It's a tradeoff between development time and execution time.
If memory serves, by the way, Brainfuck just maps to C code. It has nothing to do with interpreted scripting languages.
:rolllaugh:
You are sadly misinformed.
Interpreted languages are known for their slowness. Just look at BASIC. Python is only different in that it can be used for large projects, but is still highly inferior to it's lower-level ancestors.
In what way am I misinformed? I stated that software written in a higher level language is faster to develop while software written in a lower level language performs faster. And please don't say that language x is inferior to language y without establishing specific criteria. Python is obviously better than, say, C++ for certain tasks and worse for others.
Actually, I find Python harder to develop with. There isn't just an IDE to write the code then compile it to whatever you need. 'Tis why I prefer C/C++/C--/C+=; Quicker.
Nope, While brainfuck can be compiled (which can be said about every programming language) it is mostly an interpreted language.Quote:
If memory serves, by the way, Brainfuck just maps to C code.
i've never heard anyone include compile time with dev time.Quote:
or a language like C++, which compiles directly to machine language, it can take minutes or hours (in the more extreme cases) to test any changes you make to the source code. It's a tradeoff between development time and execution time.
No, all eight characters have a one-to-one correspondence with specific C code (see here). Brainfuck "interpreters" exist, but those are just programs that convert brainfuck code into the equivalent C, which would then be passed through a C compiler to produce an executable binary.
Then you've never had a conversation about compile time and development time. :D By development time, I mean the time it takes to development the software. In order to test code, it must be compiled, and that can be an inconvenience. Large software programs can take an hour or so to compile, and that's not so pleasant if you're just fixing a bunch of syntax errors. The whole point of an interpreted language like Python, Ruby, or Perl is to save the developer time at the expense of execution speed. For most tasks, speed of development is more important than speed of execution, but performance is critical for certain kinds of programs. Similar arguments can be made in debates about static vs. dynamic typing, by the way.
Let's try to get away from this rather pointless debate (there are always going to be pros and cons of compiled languages and pros and cons of interpreted languages). The point of my original post was that Python is an excellent first language (see that post), not that everyone should use it for everything (although I've read about some people who do...).
that's like saying that because assembly and machine code have a one-to-one conversion they are the same.Quote:
No, all eight characters have a one-to-one correspondence with specific C code
that would be called a compiler, not an interpreter.Quote:
Brainfuck "interpreters" exist, but those are just programs that convert brainfuck code into the equivalent C, which would then be passed through a C compiler to produce an executable binary.
if you want a brainfuck interpreter here's one
you can also do one in assembly (and pretty much every other language), but i don't feel like typing that muchCode:void parse_brainfuck(char *code)
{
unsigned int ptr=0;
unsigned char memory[1000];
while(*code!=NULL)
{
switch(*code)
{
case '>':
ptr++;
code++;
break;
case '<':
ptr--;
code++;
break;
case '+':
memory[ptr]++;
code++;
break;
case '-':
memory[ptr]--;
code++;
break;
case '.':
putchar(memory[ptr]);
code++;
break;
case ',':
memory[ptr]=getch();
code++;
break;
case '[':
if(memory[ptr]==0)
{
while(*code!=']') code++;
code++;
break;
}
else
{
code++;
}
break;
case ']':
if(memory[ptr]!=0)
{
while(*code!='[') code--;
break;
}
else
{
code++;
}
break;
default:
break;
}
}
}
You obviously haven't done much searching for a decent Python IDE. Actually, as far as I'm aware even python-mode in your standard copy of XEmacs (and GNU Emacs too?) has that option.
And besides, if you want a Python-like language that compiles to executable in one mouse press, download Boo and SharpDevelop.
Boo is the clearest and most sensible language I've come across, and compiles straight to CLI (and thus an exe file).
Assembly is one of the best languages you can learn. Even if you dont program in it, you learn more from assembly than any other language.
Actually speed is rarely an issue today except in the most intensive programs. Most applications are a breeze for modern processors to run. That's why languages like Python, which are easy to use, are becoming more favourable.Quote:
Originally Posted by Seismosaur
Haha I was about to mention brainfuck.
How does not having an IDE slow people down? I find IDE's slow me down. I'll take the command line over most IDE's any day. I can code faster with vim (if it's properly set up), and building is as simple as typing 'make' (assuming you have a good makefile hehe - I actually wrote a magic one that I never have to touch).
Not to sound like an evangelist, but Ruby (http://www.ruby-lang.org/en/) is really neat. There's a link on the site where you can go through an interactive tutorial without having to install anything.
If you go the C/C++ way (which is fine), check out http://cprogramming.com/ for good tutorials that take you through the basics. Good design skills and the likes will come from experience.
Agreed. It also helps with CG since [good] assembly is always the fastest, if you do really low level stuff then you will be using inline assembly.
You must be writing some huge programs if it takes hours to compiler. I have all optimizations turned on and I've never had a program compile for more than a few minutes.
Now I'm not writing full-size apps, but full-size apps are modulated and the modules can be compiled and tested individually, so most of the bugs are out of the system (especially something simple like syntax errors,) by the time that the modules are put together.
XCode does syntax and semantic checking on the fly so if I miss a semicolon or parenthesis it automatically yells at me. It also does debugging without writing tons of tests and can show me all of the variables when an error is encountered, which definitely speeds things up. As far as I know Eclipse, .NET, and Bloodshed all do the same. For apps with a GUI it also does drag and drop of buttons and such.Quote:
How does not having an IDE slow people down?
If you're planning to go to college for CS then you should learn what is taught there. Most colleges teach C/C++/Java and sometimes VB. If you're planning on concentrating in CG then C is what will probably be used. Checking out the OpenGL Red Book might also be a nice idea, the format is the same in every language (for the most part.)
i'm not bashing assembly, in fact it's my favorite language. i'm just saying it's not too useful today and if you want to get a programming job most companies won't ask you if you know assembly.Quote:
Assembly is one of the best languages you can learn. Even if you dont program in it, you learn more from assembly than any other language.
Well you shouldn't do something just so it looks good on your resume. Even if companies don't want it, hell, even if it's not useful at all, learning assembly will help you with in a lot of other aspects of computer science.
As a follow-up, I'm now taking a course in Java, and what I've learned in C is helping. I like this stuff. Anyone know where to get me started on making shweet pixel graphics? Once we get to loops and what I like to call "getkey," I want to make me a simple game of some sort.
SDL is a pretty easy way to go: http://libsdl.org
Cross-platform, too!
I still recommend OpenGL, I know there is an API for Java. Pixel graphics means that you are directly manipulating the buffer instead of using OpenGL's primitives.
Forget getkey, use a listener instead. GLUT has a listener built in called GlutKeyFunc(void keys())
Again, OpenGL is best for C and other procedural oriented languages. For OOP most would use Allegro or DirectX. I've never used either, I've heard bad things about DirectX, but I've heard that Allegro was easy to use.
EDIT: Oh, SDL uses OpenGL :? I guess it's a library for buffer manipulation?
SDL (Simple DirectMedia Layer) is an API container
Very similar to what DirectX is
DirectX is a container,
comprising Microsoft's Direct3D, DirectDraw, DirectInput, DirectSound, Etc. Etc.
SDL is the same, except you can switch & swap between different "inner API's"
A program using SDL will use Direct3D when run on Windows, and OpenGL when run of *nix, for example
Same program, same code
translating to different API calls depending on platform
I know what DirectX is. Technically speaking OpenGL is a package too. When most programmers say that their program uses OpenGL" they usually mean gl.h, glu.h and glut.h, usually OpenAL too. It's not quite as modulated as DirectX, but still a nice package. I wish we had something like DirectDraw :?
It uses DirectX on Windows? That's strange considering that OpenGL has been (mostly) ported to Windows and completely if you use MESA. It looks like it only supports DirectX9 though. Bad news since DirectX 10 has little to none backwards compatibility.
Looks useful though, I might have to look at it closer once I get some free time. I never found OpenGL all that difficult for most things, but things like buffer manipulation is a pain in the ass sometimes. Hence the reason that I want a DirectDraw :P