go away spammer

Author Topic: Java or Python, which is better for mcu GUI?  (Read 4514 times)

0 Members and 1 Guest are viewing this topic.

Offline AdminTopic starter

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Java or Python, which is better for mcu GUI?
« on: August 18, 2010, 04:23:53 PM »
I'm considering which language to invest my time into getting good at: Python or Java.

- Generally I'd like a language thats multi-platform: Linux/Windows/Android

- It'll be used for interacting directly with microcontrollers (think of an advanced HyperTerminal), so it'll need to be easy to use with com ports on all platforms.

- I'll be creating GUIs, so it needs to be easy like VisualBasic . . . or easier ::)

My main issue with Java is the memory and processing power it wastes, along with the issues it has with com ports . . . Python however has a much smaller user group, limiting support and available free source code . . .

For those experienced, which should I learn/use?

Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
    • RazorConcepts
Re: Java or Python, which is better for mcu GUI?
« Reply #1 on: August 18, 2010, 04:56:38 PM »
Been using java for years and never figured out a good way to make a real GUI. Their official GUI style code places buttons/objects in weird ways. There is a cardinal system method, where you say button A goes north, text field B goes west, etc, which van be very limited. There are some other ways like placing objects left to right, or wrapping around. Generally i dont like the lack of control on object placement. I wish there was an option like put button C at coordinates 300,150 , but I have not figured out an easy way to do that...

Offline AdminTopic starter

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Java or Python, which is better for mcu GUI?
« Reply #2 on: August 18, 2010, 05:29:30 PM »
Investigating a bit more, appears Python has many GUI creators out there . . . anyone know which is 'best'?

Basically what I want is buttons that I can push that send commands to the serial port. And an easy way to create/modify a program that does that.

This is pyQT, looks good . . .

Qt Designer Tutorial - Part 1

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Java or Python, which is better for mcu GUI?
« Reply #3 on: August 18, 2010, 07:42:24 PM »
Been using java for years and never figured out a good way to make a real GUI. Their official GUI style code places buttons/objects in weird ways. There is a cardinal system method, where you say button A goes north, text field B goes west, etc, which van be very limited. There are some other ways like placing objects left to right, or wrapping around. Generally i dont like the lack of control on object placement. I wish there was an option like put button C at coordinates 300,150 , but I have not figured out an easy way to do that...

Read stuff like http://www.macs.hw.ac.uk/guidebook/?name=Layouts&page=1 and the use of the setLocation method for components for absolute positioning.

You can place things in absolute positions with absolute size but this sucks in practice as it relies on people having a screen resolution like yours (and their mobile phone may not be the same resolution as your computer). With rubber-banded components in Layouts (rather than absolutes) means that you can resize windows and the components adapt to the window size. So its a hassle but also a benefit. Good/correct/flexible GUI design isn't easy in any language!!!

There are lots of layouts to achieve what you are after: GridBag layout is the most flexible but most complex to use.

There are lots of GUI designer apps out there and some IDEs including Eclipse have plug ins to give a VB like drag'n'drop WYSIWYG interface for those who feel more comfortable with that way of working.

@Admin Java doesn't have an inherent issue with COM ports in that they are not directly supported! This is because it can run on Win/Mac/Unix etc and the old serial libs weren't flexible enough to cover all platforms so they were dropped. However: there are 3rd party extension like RxTxComm that work brilliantly and I have used in both my Blackfin console and Gait Designer java programs.  Both of these use 'buttons that I can push that send commands to the serial port'.

Java is actually quite fast and flexible nowadays - for example it is even used by lots of folk for streaming real time media feeds including TV feeds. High band width.

But like all languages - its easy to write bad code that still works. The biggest culprit, being an OO language, is bad object design and wastefull heap usage that requires lots of garbage collection. And that is where the 'skill' lies (as the high $ pay check !) - writing good/efficient code.

Java lets you get stuff going quickly, cross platform, but it will NOT turn your bad program into a master piece!

However: Java is also now quite complex. The standard language is still fairly 'tight' but there are now so many frameworks built on top of it like Hibernate (for databases), Spring (for runtime configurability and more), Struts, Portlets, Grails (for web apps), EJBs (for running different bits of your app on different servers) etc etc. Each being libraries written in Java, on top of Java, to make life 'easier' for those not wanting to re-invent the wheel. All very nice and flexible but a bit daunting for the beginner.

Personally I like Java (I use it professionally for big database applications) because of its Java Web Start technology. This means that my Board Designer, Project Designer and Gait Designer applications can be released onto my server and every time someone runs it then it automatically downloads the latest version if there is one. So if people report bug then I dont have to ask 'what version are you running' etc - nor package an installer for every minor fix. It probably also has the largest reservoir of 'open source' tools/apps of any language.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline dunk

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 1,086
  • Helpful? 21
    • dunk's robot
Re: Java or Python, which is better for mcu GUI?
« Reply #4 on: August 19, 2010, 01:35:29 AM »
My main issue with Java is the memory and processing power it wastes, along with the issues it has with com ports . . . Python however has a much smaller user group, limiting support and available free source code . . .
you know Java is not nearly as bad a resource hog as it used to be.
something about the way it now compiles code... i can't remember the details.
this is also getting better all the time.


i personally get on very well with Python.
with a book or reasonable online tutorial it is one of the quickest languages to learn.
there are very good libraries for everything.
the program structure in python actually encourages you to write readable code. (not necessarily "good" code but a small step towards it...)


my hunch is try a Python "Hello World" because it is easy.
if you like it, keep using it.


if you have any interest in using this for web development it may affect your choice.
Python is very good for CGI scripting on the back end.
Java is used for applets in the front end.



dunk.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Java or Python, which is better for mcu GUI?
« Reply #5 on: August 20, 2010, 06:17:46 PM »
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline tmoney68

  • Jr. Member
  • **
  • Posts: 35
  • Helpful? 1
Re: Java or Python, which is better for mcu GUI?
« Reply #6 on: August 20, 2010, 09:01:23 PM »
Maybe Jython? I havn't played with it at all though.

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
    • Personal Website
Re: Java or Python, which is better for mcu GUI?
« Reply #7 on: August 21, 2010, 12:17:33 PM »
I know I'm priming for a flaming because of it's proprietary nature, need of a runtime engine and cost; but i really like LabView and have written some really nice GUIs that interface with Google Earth and let me plan missions and plot my robot's location and such. Even 3D orientation rendering. All with a extremely small learning curve. (just got to learn what each block does.)

Progress On LabView Google Earth Integration

SAGAR Autonomous Robot Waypoint Mission Interface and Vehicle Video

Lego picked LabView as the programming platform for the current generation of MindStorms NXT and I see why.

I only paid $80 for my copy because they still recognized me as a student user. I know it won't be practical for you, but food for thought none-the-less.




Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
    • Personal Website
Re: Java or Python, which is better for mcu GUI?
« Reply #8 on: August 21, 2010, 12:21:34 PM »
Don't forget about Processing either!

 


Get Your Ad Here