Programming Tools for Linux

20
8179
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:

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.

20 COMMENTS

  1. Ugh, I can’t imagine why. Just teach it on Linux, where students can have gcc, vim, tmux, and all the other goodies instead of some IDE.

    • This is a sure way to get them to leave development forever. :-) There’s no reason one needs to use a command line to develop on Linux. It has plenty of fine IDEs and editors that weren’t designed in the era of monochrome terminals. Then again, I tried using Vi on a ancient AT&T mainframe running real Unix when I was a kid and it wasn’t a pleasant experience in that environment either.

      IDEs enable efficient project management and development. Writing code in a text editor is about on par with writing in with a pencil in a notebook. The modern world uses code completion, refactoring tools, context-sensitive help and a variety of other aids to speed and streamline the development experience. Of course, under certain instances the terminal is fine or can even offer more power, but it’s not a general purpose improvement over modern GUI-based IDEs.

  2. Dispose of the crappy IDEs, they’re useless. Teach the students to use a make environment. It may be slower to learn but it’s worth it.

    •  @b558fe61dd2dffc71d4d8e43671fa476:disqus,  @493df827e136056abfe9fa71290e8e79:disqus  Both of you are right. I should have mentioned that in the article. The thing is, people always look for IDEs specially when we’re talking for people who have been using Windows for ages and are making a sudden move into Linux; using command line for Linux n00bs isn’t a joke.

  3. Dispose of the crappy IDEs, they’re useless. Teach the students to use a make environment. It may be slower to learn but it’s worth it.

  4. Most of teachers dnt know linux or nvr seen it.All books r creating windows users.My 2nd p.u cs book has a 2 linux paragraph abt linux that it is opensource.

  5. Most of teachers dnt know
    linux or nvr seen it.All
    books r creating windows
    users.My 2nd p.u cs book
    has a 2 line paragraph abt
    linux that it is opensource.

  6. When I was a fresher we had to code in Borland. But now time has changed a lot.These days we use Codeblocks with GCC :D :D

  7. According to the ANSI C89 standard variables must be declared in the beginning of the block, before the rest of the code. If you run gcc with the options gcc -ansi -pedantic, it will also fail to compile the example. Turbo and Borland C are simply being stands compliant compilers, something that should be commended, not condemned. It doesn’t make any sense to try and use C99 features with compilers from 1994. What did you expect?

LEAVE A REPLY

Please enter your comment!
Please enter your name here