Thursday, June 27, 2013

Benefits of a "real" IDE

What IDEs do you use for programming? Post in the comments if you would. I'm curious.

I use vi, GNU Emacs, Arduino IDE, Geany and Notepad++ and all have advantages, but the editors in "real" IDEs provide numerous sophisticated time-saving benefits for writing code.

That isn't to downplay the major advantages of integrated debugging provided by the likes of AVR Studio 4, MPLAB 8.x, and IAR (various targets). While each of these environments are lacking in the editor department, their debugging has saved my bacon more than a few times.

But I don't want to talk about debugging, I want to talk about writing code with "real" editors. Why? Let me explain...
I define "real" has having advanced features like these that set it (sometimes very) far above simpler editors:
  • Automatic format correction and indent correction (that's pretty easy)
  • Automatic closing of braces, parens, etc. Getting this exactly right is hard. Geany is close. Eclipse and NetBeans nail it.
    • If you type { the editor inserts }. The best editors put } two lines down, insert your cursort, indented, on the next line so you can just start typing your code block.
    • When an editor closes a paren, the good ones don't add another paren if/when you close it yourself; you can alternatively tab over the close paren
  • Method/function call syntax: don't waste time looking up a header file or javadoc.
    • NetBeans can look up javadocs within the editor.
    • Eclipse displays function call and associated comments as you type.
    • NetBeans can provide a list of Java methods for the class you just typed in.
    • Eclipse can also display method/function call details within the editor as you type. (So can Geany; this is awesome)
  • Eclipse does automatic shading/highlighting of #if and #ifdefs so it's easy to debug those.
  • Autofix fixes problems much faster than you can
    • NetBeans has awesome autofix capabilities for Java; create new variables, import new classes, refactor, etc.
    • Eclipse (C) also has autofix but it's a bit harder to get to
  • Both Eclipse and NetBeans offer some refactor capability. Rename variables everywhere is one I use a lot. Think of the time that saves versus a manual search and replace.
  • Syntax error highlighting in realtime is wonderful. I notice Eclipse has to recompile to clear the errors. NetBeans for Java clears errors as I type which is amazing.
  • File creation from template automatically creates header comments, cool.
  • Double-click to highlight a variable and automatically identify everywhere else it appears in Eclipse. That is seriously cool.
  • Eclipse cut and paste also features indent correction. No more tabbing/untabbing comments as I move them around.
That's just a taste. I bet if you're used to lesser editors and spent a couple hours in NetBeans or Eclipse you will come away amazed at how much happier and more productive you are. Less tedium, more coding.

So then the next question is, what are my options? I need to do a bit more rearch. I can tell you the following:

  • ARM and AVR coding can be done in Eclipse easily, NetBeans slightly less easily. Debugging? Dunno.
  • LPCXpresso uses Eclipse with integrated debugging
  • MPLAB X is based on NetBeans
  • Propeller gcc? Don't know.
  • Arduino? I'm not sure if Command Line Arduino can be used with NetBeans or Eclipse
  • I don't know enough about AVR Studio 5 or Atmel Studio 6

8 comments:

  1. Funny coincidence: I found an article two days ago about using MS Visual Studio Express for programming Arduino; I'm just now getting close to getting it working (okay, I haven't spent more than an hour working on this). Good news is that MS-VS Express is free, but if you can get the "Pro" version, there is an arduino debugger plugin. Here is the article: http://playground.arduino.cc//Code/VisualCPPExpress

    ReplyDelete
  2. Woah, cool tip! I will look at that more closely when I get some time.

    Have you heard of Netduino or any of the FEZ boards from GHI like Panda? They use .NET Micro Framework and hence MS VS Express. It's a pretty neat concept.

    ReplyDelete
  3. Yeah, Netduino is a cool concept and it is an impressive board, but I haven't yet found a good reason to try one. The arduino footprint is limiting (I prefer the mini format for most of my projects -- there is a mini netduino, but it only has a few IO pins).

    ReplyDelete
  4. Whoa! Had not seen the FEZ cerb 40 before. Looks really awesome! Thanks

    ReplyDelete
  5. Huh. You probably don't even consider what I use as an editor to be an actual editor... I use PSPad

    It manages my projects nicely, it has color settings for every possible file format, and previews my HTML instantly. It's also tiny and rocket fast.

    I do all my editing on my Windows machine, no matter if it's a Windows program, a Linux process, Arduino, HTML... everything. If it needs to go somewhere else prior to compiling (RE: A linux machine like a RasPi), I copy the files to the destination with a batch file via SAMBA and run the command line compiler in an SSH window. If it's a Windows program? The same, except I'm running the MinGW command line compiler and I don't need to copy the files. That way my work flow is basically the same no matter what I'm doing.

    Interestingly, PSPad has auto complete for braces, etc. I don't use it. I prefer to complete them myself, I find it faster in that I'm always completing them myself anyway, resulting in double brackets.

    I've posted on your site before as "TeslaFan".

    ReplyDelete
    Replies
    1. Good to hear from you again. Sounds like PSPad is pretty versatile. That's great. Whatever works. I thought it would be helpful to let folks know there are better alternatives than--in particular--the Arduino IDE.

      Delete
  6. The perfect combination for production:
    - MS Visual Studio 2012
    - http://www.visualmicro.com/
    - http://www.jetbrains.com/resharper/

    With this combination, you have all the features you mentioned and many more. Give it a try!

    ReplyDelete