Tag: ide

  • The impact of environment: how much do IDEs contribute?

    Those who know me will know this is a much-beloved topic of mine. I am setting this stuff down in an attempt to purge some of these thoughts from my brain.

    During a conversation with a colleague yesterday, the idea of language productivity came up. It’s an old argument: sure, you can write less lines of code in say Python than in Java (see my post on this topic), but with a modern IDE, you’ll end up ahead as the IDE will be doing a lot of that typing for you. This forms part of a bigger conversation about the relative power of different languages, the relative merits of various IDEs and the way the brain works, before and after exposure to various models of computation. So, I’ve been maintaining a variety of links to research on these topics, and I’ll try to state my current understanding succinctly in the next couple of paragraphs. I would really value any feedback that you could give me (for the handful of people who actually read this). Although I enjoy reading anecdotes of personal experiences, I would appreciate most if you could point to proper scientific studies on the topic.


    So, this study, from 2000, compared C, C++, Java, Perl, Python, Rexx, and Tcl for a particular programming task: in this case a program to find which words could be spelled with particular phone numbers using the normal keypad letter mappings. They found that the “scripting language” programs were significantly shorter and took less time to write, but did not perform significantly poorer than the compiled languages. An interesting feature is that the compiled languages (C, C++ and Java) required considerably longer programs and took longer to write. The lines/hour for all languages were roughly comparable. They don’t mention which IDEs the programmers were using, but one assumes that at least some of them were using “modern” IDEs. A 2003 interview with Guido van Rossum, highlights this idea of Python requiring less “finger typing”. He’s obviously biased as the creator of Python, but considering that he also wrote the Python interpreter (in C) and has a large realm of experience in various languages, one would think he has had some time to experience the differences.
    Another study, from 2009 may explain a part of this. They found that reading code was largely a function of the number of tokens. This is important, because it implies that less tokens can aid in understanding already written code and have an effect on writing it. Importantly, they also find that simple domain mappings are easier to comprehend than complicated ones.
    I have not been able to find much quantitative research on the benefits of IDEs. Although I acknowledge that environment makes a big difference, I tend to think about code in my head without an IDE, which makes the actual language quite important for me. To some extent one must acknowledge that there is a personal aspect as well – some people prefer a particular kind of approach, as shown in this article about language mavens vs tool mavens, which I’ve linked to before. I’ve slowly been learning Eclipse, and it is quite amazing how much of the mundane Java stuff it can automate. I’m also a great believer in refactoring tools (I use rope, with bindings for Emacs). At the same time it is clear to me that much of the stuff you get in Eclipse could be addressed by streamlining the language a bit.
    Finally, the larger picture about fitting into an environment. This is where the established languages have the upper hand. Popular languages are more widely known, have more books and environments available and have the corporate OK. Also, if the libraries of the operating system you are using have been crafted for a particular language, there is a clear advantage to aligning yourself with that. As a researcher, though, it is often a bit of a conundrum: the real publishable results are more important than the interface, so you find the majority of computational research code has no GUI, and is only lightly coupled to the host OS. This is especially true of parallel code which inevitably has to run on headless cluster boxes.
    I don’t want to make this another post about choosing a programming language, but I will restate my final strategy: use the most expressive language available for prototyping – this will inevitably be a dynamically typed language with a REPL. For me, this is Python. This hooks into the constant lines per hour result of before. When the program produces the correct output and the algorithm is set, re-implement the slow bits in a lower level language. For me this is Fortran, but it could be C++ or whatever has good support for your problem domain. This strategy has placed me a in a poor position to benefit from IDE support. For that, you typically want to do everything in a combination of IDE and well-supported language (this is the classic Java/C++/C# for everything approach).
    Anyone with links to proper quantifiable research on programmer productivity (especially the effect of IDEs)?
  • 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).