LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Programming languages on Linux? (http://www.linuxquestions.org/questions/programming-9/programming-languages-on-linux-131219/)

Imek 01-03-2004 03:57 PM

Programming languages on Linux?
 
I'm getting into Linux and really trying to learn the ins and outs of it. I also want to do some programming, so I've been toying with learning some languages for Linux. Unfortunately, they're making us learn Visual Basic at school which isn't much use to me. At the moment, I know a bit of C++ and Python, what other languages are good for me to learn for use on Linux?

Also, I understand that the Linux Kernel is programmed in C. If I learn C++, what extra do I need to know to distinguish between C++ and C? how are the two different?

Ok, thanks.

codedv 01-03-2004 04:07 PM

C++ is an Object Orientated Language whereas C is procedure based.

If I were you I would learn C. Its extremely similar to C++ and most Linux/Unix programs are written in C.

Mara 01-03-2004 04:08 PM

You can try C, Perl, shell scripting..

Tesl 01-03-2004 05:29 PM

shell scripting is probably very different to what you have done before, so you could try and learn your way around the BASH shell. Perl is a unix 'glue' language, and so could be useful to look at. I dont like Perl at all myself, but il learn the ins and outs of it eventually.

C++ is an OO language, wheras C is purely procedural based. Syntax wise they are the same, and any C code should compile with a C++ compiler (such as g++). I learnt C++ before really doing much with C, but i dont think it matters too much which way you do it :)

As for other languages to look at, have a look at Java. Syntax like C++, however totally Object Oriented and cross platform :)

EDIT - changed gcc to g++, must have been tired when i wrote that, thanks Strike :)

Strike 01-03-2004 09:11 PM

ahem,
Quote:

any C code should compile with a C++ compiler (such as gcc)
gcc is a C compiler
g++ is a C++ compiler

Oh, and stick with Python. It's immaculate.

teval 01-03-2004 09:26 PM

Try lisp :)

morelli 01-04-2004 03:07 AM

One of the interesting differences between the unix and the Windows world
is that unix users seem to be open to many more general programming
languages than Windows users. I think that under Windows, it's mostly
C++, Visual Basic, and Java, (and Delphi?). (I don't use Windows that
much, so I might be off here.)

First point: programming languages are the battle ground of holy wars.
If you want to stay sane, keep in mind that all the languages in wide use
are in wide use for good reasons, even though they're all flawed.

Java is well supported under Linux. It's a very good language for a lot
of things and for a lot of reasons. It's extremely well documented in files
freely downloadable on the net. It's a very safe language and easy to
debug and maintain. You can pretty quickly get up to speed creating
applications that run under Linux as well as Windows and other
platforms and that do all kinds of nifty things.

The official programming language of the gnu project is C and most gnu
software is written in C. This includes most of the core commands and
software you find in a Linux system. The linux kernel is also written in
C.

C++ is an extension of C that provides object oriented features among
other things. It's a very complicated language -- far more complicated than
C. It provides some features that make it safer (easier to avoid errors)
than C, but introduces plenty of its own pitfalls. C++ is probably more
common than C under Windows, where you have Visual C++, MFC, and
all kinds of fancy component technologies.

On the other hand, C is more popular under Linux than C++. This is even
true of a lot of applications with gui's, as a lot of people just use the bare
bones Gtk gui library, which is written in and designed for C.

Under Windows, the DOS batch language is so impoverished that it's really
a nightmare to work with it. The Linux counterpart are the shell languages
which are usable languages for simple tasks. Bash is the most common shell
among Linux users. As a programming language, Bash is quirky and ugly,
but it's often the easiest way to get some simple
repetitive task done. You can even type a simple bash program in at the
command prompt. For instance,
[robert@lady] for file in *.cc; do mv $file ${file%.cc}.cpp; done
would change the extension of every file with extension .cc to .cpp

I think of perl as a more powerful counterpart to the shell languages. It's
also quirky, but not as bad as Bash. Some people live and breath for
perl and advocate it for everything. Other people detest perl with a
vengence. However, nobody would deny that, with its very extensive body
of libraries, perl can be a powerful tool for a Linux user.

Python is often mentioned in the same breath as perl and regarded as a
classier cousin to perl. It's less quirky, perhaps more of a general programming
language than perl, with some genuinely interesting language features.

There's also a lot of other simple languages. For instance, tcl is common.
I haven't used it.

I've used scsh as a shell programming language, but it's not widely used. It's
based on a lisp variant called scheme. Scheme is a very nice language, with a
very powerful conceptual foundation, so it's a nice alternative to the quirky,
conceptually murky languages more commonly used. The scsh documentation
could use some improvement.

If you use emacs for editing, you'll want to know some lisp. Unfortunately, Emacs
lisp is not a very good lisp dialect in my opinion.

If you want to be more adventuresome, look at some of the less commonly used
but very interesting languages developed by language researchers. For example,
OCaml, Haskell, Scheme, SML, ... These tend to be supported on both Linux
and Windows, but generally better supported on Linux. These kinds of languages
have a very different feel from the quirky, conceptually murky languages commonly
used by most Linux hackers. If you have a theoretical or mathematical bent, you'll
certainly find them more appealing, or at least interesting.


All times are GMT -5. The time now is 09:46 AM.