Programming Tools for Linux

20
8334
Programming tools for Linux

Programming tools for Linux

This article is not so much about the various languages, as the programming tools that can be used to write programs using the languages.

When students first start taking programming courses at various private classes and colleges, the first language they learn is C. This is because C is the most traditional language, whose concepts form the base of every other language. The scenario is changing, with people having discovered the power of Python over other languages. Python has become the first language to be learned, because it has a very user-friendly syntax.

Outdated IDEs

Often, in colleges and programming classes, while teaching C/C++, instructors do so in Turbo C/C++ or Borland C/C++ on Windows XP. When one asks them about various other IDEs (integrated development environments), the response is that we must use Turbo C/C++ or Borland C/C++. This is especially true in colleges, where teachers wield more authority over students, who are “forced” to program in the IDEs mentioned above.

These IDEs had their last release somewhere in 1994-95, and we are living in 2012; it makes absolutely no sense, and it’s absurd to use a program that is 18 years old! Even the standards of C and C++ have been revised more than once to include better features since.

For example, here is an error I have encountered quite often while programming in Borland at college. In a C function, you declare variables at the beginning of the function. Then you write some code, and after that, you find you need another variable, and declare it just after the code you finished writing — somewhat like what follows:

1
2
3
4
int func() {
  foo();
  int y; // this will raise an error with Turbo C or Borland C
}

When you complete the program and compile it, the compiler will give some strange error like “declaration not allowed here”. This is a completely valid piece of code and I have done this a zillion times — but my compiler is GCC, the GNU C compiler. You might think it strange that I’m talking against Borland and Turbo while myself using them at college; yes, it is an unfortunate part of my life that I cannot help. I just avoid coding at college, and do it at home using vim/Emacs and GCC.

GCC for the win!

Coming to programming tools on Linux, the most popular compiler for C/C++ is GCC. GCC is not only a C/C++ compiler, but it supports various other languages like Java, Fortran, Objective-C and so on; however, it depends on your distribution how the extensions/features are managed. You might have to install a separate package for each. GCC is the most widely used compiler and often considered a standard by many people, though I’m not aware if there is some ISO specification on that.

For Java, there are variants available. There is Java 1.6, also called Sun Java, and there’s the updated version from Oracle branded Oracle Java (because Sun Microsystems was acquired by Oracle Corporation). Both are not open source and some distributions recommend IcedTea Java, which is an open source implementation of Java. It is known to be nearly as good as the one from Sun/Oracle. The difference between GCC’s Java support and IcedTea Java or Oracle/Sun Java is that GCJ (GCC Java) is used to compile Java bytecode into binary and link it with libgcj_s.so, so that it can run independently (only libgcj is required on any other system). Otherwise, one needs the Java Virtual Machine to run Java programs.

Editors and IDEs

Just the compiler is of little use; you need tools to write code. I follow the KISS principle — Keep It Simple and Stupid — and hence use simple text editors. Well, my choice is not really as “simple” as it sounds — it’s Vim and Emacs. Yes, both of them! They are powerful text editors, can do syntax highlighting, and if you customise, can do nearly anything. Both have a steep learning curve. You need enough patience and time to master them, but once mastered, they are excellent tools. I feel that the learning curve for Emacs is a little steeper than that of Vim, but it varies for each person.

For just C/C++, you have the CodeBlocks IDE. It works pretty well and I like it; but some people say it’s bad — I don’t know why.

Then you have the NetBeans and Eclipse IDEs, which support many languages, including C/C++. They are basically centred around Java and are themselves written in Java; so they run a bit slow on lower-end machines. Eclipse and NetBeans support various plugins for features while programming, which include things like auto-completion of identifiers, etc. As I stated earlier, I use a simple text editor, so I really can’t talk in detail about these IDEs.