Tag: editors

  • Choosing an IDE – part 2, Eclipse

    I have been using Eclipse for some project editing and a couple of things have improved since the last time I looked at this. I have gotten a faster laptop, Eclipse Ganymede has come out and Pydev has improved hugely due to the commercial arm merging with the open source one.

    The good bits

    Editing python files is easy and efficient. The discovery of interpreters and installed modules is good and the type inference (which is the hardest part of getting Python editors to work well) is quite good — better than Netbeans.

    The strange bits

    (things I think aren’t broken as much as I just don’t understand why it’s done that way):
    Why is it that, when I edit a file in another editor, then open Eclipse to that project, it does all the checking that allows it to say ‘this resource is out of sync’, but that I have to follow the instructions “Go to File|Refresh”. Surely it should just refresh itself, or at least make the action clickable in the message. Why doesn’t it just load the file as it is when it opens?
    What is up with workspaces? I understand (kindof) what they are, but what are the advantages of having workspaces rather than just storing the project information in a file in a directory that I can sync and use on another machine, or zip up and send someone without using the IDE?

    How does my workflow fit into the “Project” mold? Let’s say I have my PhD, which is a real-world project. Normally I would have a PhD directory and bang stuff related to my PhD in there. Now, there’s the thesis document itself which is written in LaTeX, which I can edit using TeXlipse. There’s also loads of programs written in many different languages, many with some levels of support in Eclipse. What do I do? What seems to make a bit of sense is to create a PhD workspace and then have projects for each of the programs so that I can edit them in the right mode and have all the right compile options and whatnot. If I just have one big PhD project, how do I tell Eclipse to change behaviour based on the file I’m editing like Emacs does? I mean, if I have some Fortran sources in front of me, I probably want to compile them when I click on the play button. If I have a Python script open I probably want to run it. I guess this is from the use of Eclipse to edit “Applications” — single, well-defined programs that consist of many files that all end up going into the application and where there is a clear build target to build and run. Perhaps with some tests. My projects just aren’t like that.

    The bad bits

    Refactoring (one of the big reasons I want to use an IDE) is broken for me. Many simple things broke in strange ways. “Extract variable” would place the variable definition inside a function defined earlier in the file, which would break everything if I did it. It’s still better than Netbeans, because the Python plugin for Netbeans has renaming as the only refactoring option. On the other hand, the rope support in Emacs means that refactoring just works.
    Syntax highlighting is also strangely limited. I have grown very used to editing stuff with syntax highlighting and support for code formatting. Python is ok in Eclipse, but Makefile syntax is not supported (edit: Makefiles are supported by installing the C/C++ dev tools), neither are bash or awk, which I use quite a lot.
    I am also very annoyed that stuff isn’t indented as I type, but rather that I have to do periodic “clean my code” up formatting (even if it’s a single key). I have become spoiled by Emacs, which can usually do the right thing when you press tab (who inserts a real tab in code ever anyway?). So your code always looks pristine. I don’t know if it really boosts my productivity, but it’s nice to have.
    The last thing has to do with how I manage my files on my laptop and my desktop. I sync all my files to my destop when I get to work and sync back to my laptop when I leave. This is important functionality that has to work without me holding its hand. I use unison, which never breaks — I have been using it daily for almost 10 years and it has not failed me in that whole time. The information that Eclipse stores in the workspaces just doesn’t translate all that well between multiple machines. I am guessing this is because I have different versions of Eclipse running on my Mac and on my Linux box (because I haven’t upgraded my Linux box). It’s not really Eclipses fault, but it’s annoying none the less.

    The verdict

    I get the persistent idea that I’m doing it wrong — that if I just knew a couple of tricks in Eclipse it would all start to come together, and I must say I enjoy the passive information stuff a lot (the documentation pops up when you start typing, there’s autocompletion of methods, there’s a lot of highlighting that lets you know there are problems in the code. That’s all great, and I would even consider doing my next project in pure python just for those benefits, which is what I suppose drives the one language for everything mentality I see so much these days, but for my existing code base, I’m not going to get the benefits without a lot of swearing using Eclipse.
    If anyone reading this has used Eclipse (or another IDE I have not tried yet) and is thinking “Geez, he should just do this or read that”, pleas post a comment. I read manuals. I figure stuff out. I can really see how Eclipse can help if you plan to write a Python program that’s all in python all the time, but if there are other languages in there, it becomes less useful.
  • Choosing an IDE – part 1, The Problem

    As I have mentioned before, I am a cli guy. I honestly cannot imagine getting through a day without using the terminal. Drag and drop is all well and fine, but wildcard support and iteration in the shell is hard to do in finder (or explorer or nautilus or konqueror etc). That being said, I can see the benefit of many of the things that a modern IDE supplies. I am a big fan of Emacs, but the bells and whistles are very alluring.

    I have some specific and interesting needs due to the variety of tools I have used to cobble together my solutions to problems that I have had in the past. Domain specific languages have filled many needs in these problems, so I need a lot of different syntaxes highlighted.
    As an example of a more or less typical project I will describe my project assignment tools. The problem is assigning projects to students for our project subject. The idea is that each lecturer comes up with a couple of project proposals, the students choose their top 10 (in order) and a program then matches projects to students by minimising the “unhappiness” while obeying constraints on how many students each lecturer should get etc.
    The process uses the following components, held together by a Makefile:
    • To allow the students to specify their projects, we use an Excel spreadsheet that verifies that their choices are valid etc. They fill in the project selection spreadsheet and e-mail it to us.
    • A Python script reads and compiles these spreadsheets into a table
    • A second Python script converts this table into a MathProg data file
    • GLPK is used to solve the problem (specified using MathProg)
    • Unix tools (grep, sed, awk, join, tr, xargs) are used to massage the run results
    • The massaged results are processed by python to generate an HTML file
    • The HTML file is coloured using CSS
    The parameters of the optimisation will be tuned and the optimisation re-run many times. I will also need to answer many questions about specific students based on names or student numbers, which is easily obtained by grepping the intermediate results generated by the above process. These are the reasons why a single Python program doing the above would be a lot larger than the current files are: I would need to implement persistence and memoisation to avoid rerunning lots of code (which is currently handled by make), in addition to coding querying interfaces to allow queries of the results.
    But back to IDEs. My ideal IDE does not force me to use one language for everything. It supports my use of domain specific languages by at least colouring the code, but ideally providing intelligent indentation, bracket matching and language help. It allows complex code refactoring and is aware of scope and different senses of variables. A debugger is a plus, but because I mostly use dynamic languages, I find I use the debugger infrequently. A last hurdle is that I either need the same program on both of the platforms I use (mac and linux) or use a scheme for projects that doesn’t break when the project is edited by another program (plays well with others).
    Much of what I’ve described is delivered by Emacs. It has code highlighting, tabbing and bracket matching for almost every language ever developed. It also has debugging and refactoring for python via interaction with pdb and rope, although I will admit it’s not as slick as some modern IDEs.
    After hearing a lot of people rave about the advantages of IDEs I have decided to give them another shot. So far I have installed Eclipse and Netbeans, as they both run under Mac and Linux. I will be posting some of my experiences here. Please leave a comment if you have some suggestions I should try out. I am really keen to boost my productivity, so I won’t shoot down any suggestions out of and (except that I have tried vi and didn’t like it that much).