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.

  • Victorius Gautama

    temen temen yg baik , buka linknya yaaah |——-> http://www.facebook.com/pages/Youthtobe/266715993413481 terus di like deeeh :)

  • Daniel Stoddart

    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.

    • http://www.facebook.com/john.shepherd.77770 John Shepherd

      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.

  • Sabin Bogdan

    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.

    • http://nileshgr.com Nilesh Govindarajan

       @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.

  • Sabin Bogdan

    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.

  • Aboobacker Mk

    Our university(cusat) still prefers turbo c++ :(

  • Aboobacker Mk

    Our university(cusat) still prefers turbo c++ :(

  • Shashaank Areguli

    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.

  • Shashaank Areguli

    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.

  • Saurabh Wankhade

    :) we use Gcc and g++

  • md_rezaurrahman

    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

  • Razik Sally

    can’t you live without Windows?? Obviously no……

  • Chetan Khilosiya

    FYI GCC stands for GNU Compiler Collection. 

    • Nilesh Govindrajan

      I thought I had mentioned that in the article. Weird.

  • Deritchie

    If you swap lines 2 and 3 of the c example, I am fairly confident it will compile correctly.

    • Nilesh Govindrajan

      Yes, you’re right. But this example _does_ compile with gcc, where as it doesn’t with turbo.

      • http://www.facebook.com/john.shepherd.77770 John Shepherd

        That’s because GCC is using the C99 implementation. If you turn this off and use standard ANSI C, this would not be permitted.

  • dilip

    I think the best IDE for C & C++ is Qt Creator on linux and windows
    both… It uses gcc and g++ for compiling C & C++ programms resp. I
    have used Codeblocks earlier, a decent IDE but lacks many feature…
    To know more about how to use Qt Creator for C++, I would refer this
    link
    http://dkrypted.wordpress.com/2012/05/14/best-ide-for-c-qt-creator/

  • Anonymous

    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?

All published articles are released under Creative Commons Attribution-NonCommercial 3.0 Unported License, unless otherwise noted.
Open Source For You is powered by WordPress, which gladly sits on top of a CentOS-based LEMP stack.

Creative Commons License.