go away spammer

Author Topic: Java vs. Python  (Read 3470 times)

0 Members and 1 Guest are viewing this topic.

Offline LeftHandRoboticsTopic starter

  • Jr. Member
  • **
  • Posts: 14
  • Helpful? 0
Java vs. Python
« on: July 01, 2010, 02:39:00 PM »
Hey guys I had a quick question.  I know almost NOTHING about software and creating software but I found some great tutorials online one the different languages.  Java seems good, but python seems good for video games.  I would hate to have to learn both, so i guess my question is; Would python work fine for a robot, or would Java be better?

~Lefty

Offline klims

  • Robot Overlord
  • ****
  • Posts: 190
  • Helpful? 2
Re: Java vs. Python
« Reply #1 on: July 01, 2010, 11:03:03 PM »
If when you say robotics you mean learning to make a robot that can do stuff on its own(drive around, use sensors etc), I think C would be the most useful language to start with. Most microcontrollers are programmed in C.
Don't know of any myself that can be programmed in Java or Python.

That being said, I don't think its a waste learning any programming language. Some may be more useful than others but its all learning.

Offline emmannuel

  • Full Member
  • ***
  • Posts: 87
  • Helpful? 0
Re: Java vs. Python
« Reply #2 on: July 02, 2010, 01:32:28 AM »
I agree with klims.  Theres no harm learning any language.  I'm a big Java guy myself but I'm pretty sure 99.99% of anything to do with robotics is done in C.  Programming languages are to some people like politics.  Don't get hung up on which one you're learning just read up and and have fun with it.  Most languages can do the same things just have different philosophy on how to do it.

Java can be a bit annoying/complex starting up. I haven't learned Python myself.
Both are object oriented languages while C you don't worry about having to learn how to use objects and just learn programming basics.

Offline dellagd

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 731
  • Helpful? 5
  • Come to the dark side... We have cookies!
    • Exodus Rocketry
Re: Java vs. Python
« Reply #3 on: July 02, 2010, 09:13:45 AM »
not true

there are many different programmable chips out there
AVR chips are in C (most, if not all, of us on SocietyofRobots use AVR or PIC chips)
PIC chips (also C as far as I know)
Then there are BasicStamp (programmed in PBASIC)
Also There are BrainStem (http://www.acroname.com/robotics/parts/S25-GP2-BRD.html if you are interested. I think I saw something about Java in there...)

+tons more.
I havent really heard anything about Python or Java, so I would recommend going with C.
Its the most common and if you use it, you will have more people here that would be able to help you out :D

Innovation is a product of Failure, which leads to Success.

If I helped, +1 helpful pls

I Won!
3rd place! I'm taking $100

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,944
  • Helpful? 99
Re: Java vs. Python
« Reply #4 on: July 02, 2010, 10:37:48 AM »
Also not totally true either:

uProcessors really use "machine code", the Op-codes that the chip itself fetches from program memory that causes the internals to do sometime. Each uProcessor then has an Abstract layer that is called the "Assembly Language" and is different for each make of uProcessor and is considered "human readable". The "Assembler" takes the assembly code and converts it into "machine code" and creates the HEX file that is loaded (programmed) into the uProcessor's program memory space.
Any of the higher level languages, C, basic, etc, are compiled first into assembly language and then linked  and assembled into "machine code". These higher level languages are just another layer of Abstraction that makes it easier to write code.

Any of the higher level languages could be used for any processor IF someone wrote a compiler to translate the high level language syntax into the assembler for that particular processor. I don't know of any compiler for say Python to PIC but it could be done. The common high level languages used for uProcessors is C and Basic.

An exception is the BASIC Stamp, This comes with a BASIC interpreter programmed into a PIC processor. You write code in Basic which is then Tokenized and loaded into the PIC (Stamp). The interpreter reads the tokens and executes machine code to perform the operations. This is why the Basic Stamps are so much slower than a PIC with native code.

Offline dellagd

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 731
  • Helpful? 5
  • Come to the dark side... We have cookies!
    • Exodus Rocketry
Re: Java vs. Python
« Reply #5 on: July 02, 2010, 10:43:00 AM »
I was just listing what chips were normally programmed with (not to argue anymore :P)
Innovation is a product of Failure, which leads to Success.

If I helped, +1 helpful pls

I Won!
3rd place! I'm taking $100

paulstreats

  • Guest
Re: Java vs. Python
« Reply #6 on: July 02, 2010, 03:58:38 PM »
Just to add something else into the mix...

 High level languages generally rely on an operating system, since most high level languages make use of threads, objects and multi - tasking. Trying to do this on a 20 Mhz processor with very limited code space and memory is really too much... (I have a functioning operating system I wrote for PIC's but anything more than 8 tasks really overloads it, or you have to reduce the OS capabilities.)

 Languages like Java not only rely on an operating system but they compile into class files rather than native machine code (AKA operations / assembler for this purpose). This means a device with a Java program also needs a Java interpreter which compiles on the fly needing even more time per operation.

 I havent really looked into Python(never having a need to on top of everything else) but I assume that it is also an interpreted language that compiles on the fly too.? (am I right here?).


I do believe that Object Orientated programming is the way to go but we really need a cost effective development board, with an OS based towards robots and the ports open for ADC and GPIO rather than keyboards, monitors, graphics cards etc...


If you do want to use a computer then find a Microcontroller with USB supports, create a small command interpreter on it and use a computer or a high level development board to communicate with it...

 


Get Your Ad Here

data_list