Python/Java?

Discuss any other topics here
Post Reply
Matte
Posts: 321
Joined: Fri Oct 19, 2007 7:49 pm

Python/Java?

Post by Matte »

What is the most interesting language for me to learn? (not only for use with RF, also for a basic knowledge of programming).
What is the easiest, what one can do the most? What can they create?

etc.

Thanks!
BTW I have knowledge of HTML and basic knowledge of JavaScript.
I can think logical :lol:
dylanwinn
Posts: 84
Joined: Wed Mar 05, 2008 6:15 am

Re: Python/Java?

Post by dylanwinn »

Java does more, but Python is way easier. I went with Python, but if you can find the time to learn a C-type language, then you should go with Java.
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Python/Java?

Post by Jay »

Java and C++ are really different. They are both object-oriented and also different to C, which is a procedural programming language and does not support real OOP (=Object Oriented Programming). In C you build a structure(class) as a compilation of data and then use functions OUTSIDE that structure that access the structure with a pointer.
The syntax of Java is inspired by C/C++, but the concepts that stand behind the languages are really different.
In Java there are no real pointers. That means you cannot do address stuff like in C/C++ (which can be important if you program for consoles, specific hardware etc which have registers that you set to specific values to control the way it is rendered. Or you could set a pointer to the video memory and manipulate the pixels yourself.), but internally, objects are just pointers and you have to create them before you can use them...
In C or C++ you have to keep track of each dynamically created object, in Java there comes the GarbageCollector and does it for you. In C/C++ this would bring a memory leak.

Python is a script language (which can be compiled) from what i know, but Java is a compiled language that runs on a virtual machine. I don't know about Python, but with Java you have some problems writing explicitly for a specific system, but at the same time a Java program can run on different operating systems and processor types at once without being recompiled.

Java is VERY object-oriented, even to the degree that i would call it extreme. It seems, that in Java everything is a class (for example there are classes which encapsulate the primary types like int, char...), whereas it is not this way in C++. I have once heard that you cannot really extend Java, because it so BIG that there is a class for everything.
One thing that i didn't like in Java was that every file was a class and that you had to write a class to get your program to run. Well, it may be the c++ programmer speaking here, in my opinion it makes sense to write a 'program-class' for big programs, for example RF, but for small test programs it's just overkill. Don't understand me wrong, the classes were not big, but i didn't like the overall idea.

If it only came to C or C++, i would go with C++, but C++ or Java is a draw in my opinion. There really is no real 'best' language... it's just that they use different concepts.

Hm. I drifted off a bit... now i cannot say much about Python, since i haven't programmed with it before. I heard that it is object-oriented too, and on top of that it is a script language, which means it is interpreted at runtime, maybe you can do interesting stuff with it because it is a script language.
In simkin for example you can do some REALLY wild stuff because it is a script language. If it was a compiled language all of this would not be possible.

Ok. Now somebody else can say something about Python.
Everyone can see the difficult, but only the wise can see the simple.
-----
Matte
Posts: 321
Joined: Fri Oct 19, 2007 7:49 pm

Re: Python/Java?

Post by Matte »

Thanks for taking the time to put such a big post together, Jay.
I guess I will have a look at Python and Simkin. Isn't S.C.U.R.F. based on Simkin?

So a scripting language, what can it do? Because I don't really know how scripting languages differ from programming languages.
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Python/Java?

Post by Jay »

Well, a programming language uses a compiler to make a program, an exe file (in case of java it uses .class files, which are no real programs, java kind of interprets the generated code after you compiled it), which can run either alone or with special runtime libraries that your programming language needs. The compilation process is there to optimize the speed of your program, but at the same time, this optimization makes the language less flexible. Compiled programs are really fast in comparison to script languages.

A scripting language does not compile the code, or only partially compiles the code. Then a program called interpreter is used that interprets the code you wrote. This of course takes extra time, but it allows something that is called 'indirection' which means that the value of a variable is interpreted as a piece of code.

In case of simkin you are limited to what your implementation of simkin allows. For example, RF uses its own simkin implementation. The base code of the interpreter is the same (the language allows the same things), but the commands we can use are different from other implementations.

That's an overall problem with scripting languages. Think of a programming language as an 'engine' and then a scripting language can be a kind of an 'wrapper' around that language, similar how RF is a wrapper around the Genesis engine. But the scripting language is limited to what has been implemented in code. (and a programming language actually is a wrapper around the pure machine-code, it's just simpler to read and to program than the really cryptic machine-code. During compilation, the code you've written is transformed into machine-code in c++, and to a semi-machine-code in java)

Python and Simkin are nice scripting languages, but with them you are bound to what your implementation allows (not too sure about Python, but with Simkin it's this way). That means different programs using Python or Simkin as scripting languages might be able to do different thinghs and not all scripts might be able to run on all programs using Simkin/Python. For example, a script that is using RFs script commands (RF uses simkin) would not run on some other program which does not support RFs script commands (i don't believe that there is one).

HTML and JavaScript are script languages, because the browser uses an interpreter to interpret the code you've written during runtime. But because there are standards in what a html browser has to be able to do, this is not a big problem.
You already know the basics, i would encourage you to learn a 'real' programming language like Visual Basic, C# or C++ (or Java, but i personally don't like it very much, at the same time the learning curve is not as steep as with c++). As far as i know, Microsoft released free versions of their compilers on their website.
If you want to go into internet programming take a look at PHP and MySQL. I don't know them (Well, i actually don't know nothing about internet programming, not even HTML), but i have heard that they are really powerfull.
Everyone can see the difficult, but only the wise can see the simple.
-----
Matte
Posts: 321
Joined: Fri Oct 19, 2007 7:49 pm

Re: Python/Java?

Post by Matte »

I'll take a look at C++/C# then. Thanks for this information!

EDIT: I took a look at some code of both, and it seemed to be that C# looks more like JavaScript and less hard to learn than C++. But apparently C++ is used more?
What one is the easiest? Or isn't there much difference?

I've also noticed that RF was programmed with C++, so that means that the most interesting thing for me would be to learn C++?

Are there any programs that are made with C#?
User avatar
bernie
RF Moderator
Posts: 1249
Joined: Tue Nov 15, 2005 10:07 am
Location: Ireland

Re: Python/Java?

Post by bernie »

Are there any programs that are made with C#?
NeoAxis is written in c#
c# also requires the program user to have Microsoft .net installed.
Post Reply