ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.