Perl/python over c/c++

could someone please explain when perl and python should be used and when c and c++ should be?

Perl and Python allow you do some things more simply than C/C++. For example, to concatenate a couple of string values in Perl, you would write something like:

$fullname = “$firstname, $lastname”;

In C, I don’t even feel like writing it, but it would be something like:

strcpy(fullname, firstname);
strcat(fullname, ", ");
strcat(fullname, lastname);

What I haven’t showed is the extra code you have to write in C to guard against error conditions like buffer overflow, which could be dangerous security problems in the wrong place. Also allocating and deallocating memory for dynamic variables like strings. Memory management is automatic in Perl and Python and similar languages. It’s slightly better in C++, you can use classes to hide some of the ugly low-level operations, but still not as easy as a language as Perl or Python.

The cost of this is Perl and Python code might be less efficient. But in many situations, they are fast enough, and the ease of writing programs that don’t crash or have dangerous bugs is more important.

What shall be the benefits be for learning python/perl over strengrhening c/c++ in the same time.
I also intend to use GTK+.

I would say learn both, you can’t lose by having more languages under your belt. But if you are a newbie, start with a language where you are less likely to shoot yourself in the foot, like Python. Otherwise you will be spending a lot of time chasing bugs in C or C++ and not enough time understanding how to write algorithms.

I believe there are bindings to GTk+ from Perl and Python so you can still access them from there.

i have been using c and c++ for more than years.Seem to reeach stagnation.
How easy is it to migrate to Python/PERL.
How is the usability as compared to C/C++.
How much is the demand.

I never consider learning a new language as a migration. You can carry some concepts over but you need to learn the ins and outs of the new language.

I consider Perl and Python easier to use than C/C++ if only because you don’t have to write so much to get a program working.

Sorry, no idea about job market.

How easy is PYTHON for designing of interfaces and for serial port access as compared to c/c++/Java

GUIs? As I said there should be GTk+ bindings for Python.

I’m pretty sure there are modules for serial port access. Most of these higher level languages come with the ability to interface to libraries written in C.

Thanks,
Is there much difference in performance in GUI’s written in C and Python especially if serial port access is needed.
how do these compare with Java for the same tasks?

With GUIs, not much difference because most of the time the computer is waiting for the human to do something, and besides the innermost parts of the GUI are in C.

Java is almost as verbose as C, I would even say bureaucratic, but does have have the advantage that it makes it much harder to shoot yourself in the foot. You might feel like shooting the computer after you have run through all the hoops that Java makes you. :wink:

Performance of Java should be similar, but the memory footprint will be larger because you have to run this big Java runtime.

Thanks,So what will you recommend for:Develop GUI using GTK+ ,Glade for uav Ground station - openSUSE Forums
Shall i go with c/c++ or move to PYTHON?

go with C/C++

Sure why not? Serial data is actually quite slow compared to things people have done with Python, even bittorrent clients and that sort of thing.

One advantage of Python, Perl etc, is that they can insulate you to some degree from the OS platform. You will find that it will be easier to create programs that will run unmmodified or very slightly modified between Linux and Windows. And you don’t have to get a C compiler for Windows (even though you can use gcc ports like MinGW).

I once wrote a CLI program to grab serial data from a GPS dongle. It ran unchanged on both Linux and Windows, the only thing that had to be supplied was the name of the port, /dev/ttyS0 for Linux and com3: for Windows.

serial data being available quick is one factor of prime importance.
you mean it will be slower as compared to c.will it be faster as compared to Java.
The application being real time is of prime importance.It has to be quicker or almost as good as in Java atleast.
Are tutorials/help available for Python GUI programming?

I don’t think your computer will have any problems keeping up with the serial data or the user at the interface even if you write it in Python or Java.

PS: Try googling “python gtk+ tutorial”

sir,
what i meant was will there be any difference if i acquire data serially through c or if i do through Python.
will it be significant considering gps values recieved will be causing map to move.
What shall be my approach to development of this application.

You will probably find that the serial interface module in Python is actually written in C and is just as fast as C because, well, it is C. What your Python program will get from the module are strings. GPS data is actually quite slow, I believe it’s 9600 baud and one text line every second or something like that. So no problems there.

Thanks,
So you recommend i shift to Python.
PyGTK seems a good choice.
Any suggestions for the plan of action i should take considering i am a newbie to linux programming.for making my application

  1. Read
  2. Write some programs
  3. Debug
  4. Goto 1