Click to See Complete Forum and Search --> : good language?


hardigunawan
01-22-2002, 10:47 AM
Can you recommend me a good programming language (not web-based)? Here's my priority:

1) Easy
2) Portable from Linux to Windows
3) Many controls/widgets that I can just use

All I can find is Tcl/Tk, Perl and Python. From what I glanced through, it's not easy for Tcl/Tk to do advanced GUI, such as database application. And for Perl, I've not seen one that can create GUI. And I know nothing about Python.

Can anyone recommend?

Stuka
01-22-2002, 11:47 AM
Ironically enough, Perl and Python both use Tk for GUI work, just like Tcl. There has been some work done on Win32 GUI stuff through Perl, and I THINK that there are Perl and Python bindings for GTK. Some of the local Python zealots are sure to weigh in soon (/me ducks).

Gnu/Vince
01-22-2002, 12:12 PM
/me comes, makes a big "Ruby and Python!" graffiti on the wall and runs away!

[ 22 January 2002: Message edited by: Gnu/Vince ]

inkedmn
01-22-2002, 12:44 PM
/me runs up and underlines and circles Vince's "Python" tag on the wall and points proudly...

kmj
01-22-2002, 12:50 PM
Python is:

1) easy
2) portable
3) (has) a few quality graphics API's available to it:

For starters, there's Tkinter, which is Python's Tk tie-in, but built ontop of that, there's Pmw (Python MegaWidgets) which extend the capabilities of Tk, so that you can accomplish pretty much any GUI task you need doing. Also, Python has PyQT, which lets you access QT (a great widget set!) through python, to write any kind of advanced GUI app you might want to. I'm sure there are ways to access other GUI API's via python, also. Finally, there's JPython, which allows you to compile python into java bytecodes and leads me to suspect that you could take advantage of Java's Swing library through python (though I have no real evidence of that.) ..update - a quick search leads me to believe the following product (a uml development tool, apparently) was written with JPython and Swing.
http://www.objectdomain.com./

Take a look at python. Try it. Read the tutorial, do some simple apps in it. Give it a week or two; you'll be hooked. I've never seen an easier, cooler, more aesthetically pleasing language.. Only drawback: it's high level, so don't write your OS or whatever in it.

klamath
01-22-2002, 10:29 PM
I'm the maintainer of Ruby-GTK (http://ruby-gnome.sf.net), so I know there are definately Ruby GTK+ bindings :) You can also use the Glade UI tool (a visual tool for putting together GTK+ UIs) with Ruby, which is cool.

As for which language, I like Ruby the best. Check the archives for some extended discussion.

it's not easy for Tcl/Tk to do advanced GUI, such as database application

Why is a "database application" an "advanced GUI"?

debiandude
01-22-2002, 11:00 PM
I personally like Perl GTK+ bindings. Its really easy. Here is a sample:

#!/usr/bin/perl -w

use Gtk;
use strict;

set_locale Gtk;
init Gtk;

my $window = new Gtk::Window("toplevel");
my $button = new Gtk::Button("Hello World");

$window->signal_connect( "delete_event", \&destroy );
$button->signal_connect( "clicked", \&destroy );

$window->set_usize(100,50);
$window->add($button);
$window->show_all();

main Gtk;

exit(0);


sub destroy()
{
Gtk->exit(0);
return 0;
}


[ 22 January 2002: Message edited by: debiandude ]

hardigunawan
01-22-2002, 11:59 PM
hmmm...shouldn't say that database application is an advanced GUI application.... sorry :P

I'm used to programming GUI in Windows with VB and Delphi. I've found some Tcl/Tk book and glanced through them. All of them doesn't have controls such as datagrid, calendar, etc. So I thought a database application would be an advanced one :P

I'll research more on Python and Ruby. Perl seems to be a good and reliable language (from the count of people using it). But I might give it a pass, since I've seen from other people's code, it is a bit hard to understand for a beginner :) I'm slowly learning perl though, but not using it for the current application :)

Thanks :)

Gnu/Vince
01-23-2002, 12:04 AM
Here's a most useless Python script:


#!/usr/bin/env python

import sys, string, os

if len(sys.argv) < 2:
print "Usage: %s <string>" % sys.argv[0]
sys.exit()

message = sys.argv[1]

banner = os.popen("banner -w 40 %s" % message)
banner = banner.read()
banner = string.replace(banner, "#", "*")
banner = string.replace(banner, " ", "#")
banner = string.replace(banner, "*", " ")
print "#"*40
banner = banner.splitlines()

for i in banner:
print string.join(i.splitlines()) + ("#" * (40 - len(i)))

print "#"*40




and of course, the Ruby version :)

#!/usr/bin/env ruby

if ARGV.size < 1 then
puts "Usage: ./reverse.rb <message>"
exit
end

message = ARGV[0]

banner = `banner -w 40 #{message}`
banner.tr!('#','*')
banner.tr!(' ','#')
banner.tr!('*',' ')
puts "#"*39
banner.each_line {|x|
print x.chomp + ("#" * (40 - (x.length))) + "\n"
}
puts "#"*39

jemfinch
01-23-2002, 03:39 AM
Originally posted by hardigunawan:
I'll research more on Python and Ruby. Perl seems to be a good and reliable language (from the count of people using it).


Windows seems to be a good and reliable operating system (from the count of
people using it).

:-D

As I'm sure you've found out (you're on this forum, aren't you?) the best things
in the computer world are almost universally not the most popular.
What's true for operating systems is also true for programming langauges. Perl
is the most popular *nix scripting language, but it's by far not the best
or the most reliable.

Aside from that, Python is nearly as universally available as Perl and growing
even faster. With the advent of Perl 6, there's sure to be a mass exodus to
other programming languages, and Python is really the best of all the
alternatives. Python is readable, as maintainable as a scripting language of
its type can be expected to be, portable, and fast.

Be careful not to confuse popularity with quality. Too many people prefer
the establishment to quality for popularity to be an adequate metric.

Jeremy

hardigunawan
01-23-2002, 05:39 AM
HAHAHAHA....that's a good one! :D Substituting "Perl" with "Windows" really opens my eyes on quality and popularity. Thanks! I'll take note of your advice :)

Python is the way for me to go then!

kmj
01-23-2002, 08:18 PM
Originally posted by hardigunawan:
<STRONG>

I'm used to programming GUI in Windows with VB and Delphi. I've found some Tcl/Tk book and glanced through them. All of them doesn't have controls such as datagrid, calendar, etc. So I thought a database application would be an advanced one :P
</STRONG>


Speaking of popularity; the only reason something like a "datagrid" control exists for windows is because of it's popularity, I would think. The win32 api doesn't contain one, so it must be a custom class designed by a 3rd party. (or maybe MS supplies VB controls for things they don't have in C++; wouldn't surprise me.) Or maybe delphi does it; I don't even know what delphi is really.

Although Python/Tkinter/Pmw may not contain a pre-built datagrid widget, but it probably wouldn't be hard to build. Also, Qt is as advanced as any other API for linux.


<STRONG>
Perl seems to be a good and reliable language (from the count of people using it). But I might give it a pass, since I've seen from other people's code, it is a bit hard to understand for a beginner :) I'm slowly learning perl though, but not using it for the current application :)
</STRONG>

Lol; generally, Perl code is hard to understand for the guy who wrote it! :)

Dru Lee Parsec
01-23-2002, 08:58 PM
DLP saunters in, scribbles his obligatory Java Rules! on the wall and saunters out.

It's free, it's object oriented, it works in Windows and Linux, there's lots of tools, libraries, free tutorials, free on-line books etc. yada yada yada.

debiandude
01-23-2002, 09:11 PM
You would all agree that by looking at Chinese it looks pretty complicated to learn, am I right. However do you think its that difficult for people who have been speaking Chinese?

Well just like Chinese, Perl has a learning curve, which dosn't make it a bad langauge. To me Perl does not look like line noise or whatever else its been compared to, it looks like code that I can understand.

Oh and I've tried python and I agree its a nice laguage but I just don't see the point in learning it when I already could do everything I want nearly as simply and quickly with the tools I already have.

[ 23 January 2002: Message edited by: debiandude ]

klamath
01-23-2002, 10:30 PM
Lol; generally, Perl code is hard to understand for the guy who wrote it!

No, that's definately false. Perl code can definately be readable -- if you write it with the intent of being readable (alternatively, you can just hack stuff together if it's a throw-away script). Lots of people abuse C++ horribly -- does that make C++ a bad language? (I'd argue it's a bad language, but for different reasons :) ).

For doing web development, I'd say Perl is still far and away the best choice -- it completely blows Python out of the water, for instance.

jemfinch
01-24-2002, 02:17 AM
Originally posted by klamath:
For doing web development, I'd say Perl is still far and away the best choice -- it completely blows Python out of the water, for instance.

No, it doesn't.

Jeremy

jemfinch
01-24-2002, 02:51 AM
Originally posted by debiandude:
You would all agree that by looking at Chinese it looks pretty complicated to learn, am I right. However do you think its that difficult for people who have been speaking Chinese?

Well just like Chinese, Perl has a learning curve, which dosn't make it a bad langauge. To me Perl does not look like line noise or whatever else its been compared to, it looks like code that I can understand.


Programming languages aren't natural languages. Natural languages have
inflection and tone and facial expression with which to convey meaning. Natural
languages don't have to explain to a machine exactly what the machine
should do. Natural languages are entirely inadequate for programming. That's
why we have programming languages. To try and make a programming language like
a natural language is a step backward. Natural languages lack the
consistency and strict definition needed to command a computer to do our
bidding.

Learning curve matters little. A programmer spends so much more time
programming in a language than learning in it that learning a more productive
language is almost always more efficient in the long run than staying with a
less productive language. Aside from that, Perl doesn't have a very steep
learning curve -- enough people of average intelligence know and use it that it
surely can't be that hard to learn.

The measure of a programming language is its ability to aid the productivity of
the programmer. Studies have shown that programmers write approximately the
same amount of code in a given time unit in whatever language they program,
whether it's assembly or Perl. Studies have also shown that the most expensive
part of software development isn't the first act of coding, it's the maintenance
that goes on afterwards. Thus, the best language for a particular project is
the one that makes programmers most productive and reduces necessary maintenance
as much as possible for that project.

Perl, in a very small domain consisting of tiny shell-like scripts and filters,
is more productive than any other language. It isn't, however, in any situation
I've seen, more maintainable than the myriad other languages that can be used in
its places.


Oh and I've tried python and I agree its a nice language but I just don't see the point in learning it when I already could do everything I want nearly as simply and quickly with the tools I already have.


Like the aborigine who doesn't understand how a gun would help his hunting...

Jeremy

debiandude
01-26-2002, 01:10 PM
Like the aborigine who doesn't understand how a gun would help his hunting...


I agree that a gun would help my hunting by making it faster and easier;however, I don't see python making my programming any faster or easier.

kmj
01-26-2002, 03:11 PM
<STRONG>
Oh and I've tried python and I agree its a nice laguage but I just don't see the point in learning it when I already could do everything I want nearly as simply and quickly with the tools I already have.

[... then later...]

I don't see python making my programming any faster or easier.
</STRONG>

While you may have tried python, you obviously haven't used it extensively, otherwise I think you might see it doing just that. Here's some comments by ESR on why he decided to use python over perl... Why Python? (http://www.linuxjournal.com/article.php?sid=3882)

I like perl, I've used perl, I still use perl; but you cannot take away python's inherent advantages due to it's cleanliness. Anyone who doesn't see this advantage is someone who hasn't had to maintain others' code.

And I don't buy the learning curve argument; perl wasn't hard to learn at all. I'm not trying to make you learn python, by the way; I agree that if you've got something that works fine for you, you don't have to go out and try to find something better. That doesn't mean python isn't better, though (I'm not saying it is here, btw, just making a point); you aren't in a position to declare which is better until you've really gotten to know both of them.


klamath - why does perl blow python out of the water in web development? And I still maintain that due to the syntactical differences perl (along with c/cpp/java) is harder to read than python; considering reading python is like reading pseudocode.

debiandude
01-26-2002, 06:10 PM
Let me perhaps clarify what I am saying. The analogy I made with Chinese and Perl and the learning curve was inaccurate. I ment to say that when you look at Chinese it looks different because it has all funky characters. The same goes with Perl. That in it self does not make the langauge any more difficult it just turns some people away from it.

Seconly on the whole python/perl issue. I have tried both. I have not used phython nearly as much as I have used perl. With that said, I do like python. However I like perl more. I just don't see the necessity to switch. Perhaps some day I will. But not now.

See when I first started programming I used pascal. Then when I first saw C I knew how big of an improvment it was and completly dropped Pascal and went into C.

I just didn't have that with python and perl. I learned perl and then decided to try python but I just didn't have the same revelation, that I needed to switch, like I did with C.

If their is any language that I see myself using the future, it would probably be something like O'caml. I have toyed with it and really like it.

[ 26 January 2002: Message edited by: debiandude ]

I Love NY
01-28-2002, 10:24 AM
Originally posted by debiandude:
<STRONG>You would all agree that by looking at Chinese it looks pretty complicated to learn, am I right. However do you think its that difficult for people who have been speaking Chinese?
</STRONG> It's as hard as heck. even chinese people admit it. I've lived in china for 6 years now, and I still suck at characters =) They're hard. Compared to them, Perl is a breeze.. so learn Chinese first :D

kmj
01-28-2002, 12:15 PM
Online Book:
GUI Programming with Python: QT Edition (http://stage.linuxports.com/projects/pyqt/)

Seems topical.

paully1
01-30-2002, 12:33 AM
All languages have strengths and weaknesses. I recently read an article called 'Most software stinks!' every programmer should read it! People should spend more time designing good, efficient, maintainable software and not worry about todays hot new language, that kind of thinking is sort of juvenile. This isn't an attack just an opinion.

paul

[ 29 January 2002: Message edited by: paully1 ]