On source code tools

jplindstrom on 2004-09-01T21:47:39

This entry started out as a reply to djberg96's entry about Intellisense, but it got kind of out of hand so I decided to post it in my own journal instead. Read his entry first.

Having started using Emacs, I find that I use M-/ a lot. It's word completion wiht the words in your open buffers. I find it very lazy. If it could follow all the "use My::Module", that would be even more lazy. I guess that's pretty much Intellisense. etags/ctags is nice too. It's grep with a twist, and that's why it's useful. We need software to navigate source code. The experience makes it different. And so it may be a crutch, but a crutch that makes it possible to walk straight, and that's better than limping. The Emacs macro ff-find-other-file is indispensible when coding C/C++, and living without it would be like limping backwards. But what if it's not just a crutch? What if it doesn't just make you not limp, what if it takes you up to "normal" and then some? Show of hands, who doesn't like syntax highligting to make it easier to read code? Perl Oasis, which I wrote so I'm probably one of the few users of it, is interesting in that way. It's a code browser/navigator. Looking at a class in Perl Oasis may look like this. And what makes that different is that I get an overview of the source code. So when I'm about to add a new method or property, I can put it at a proper location in the source so it stays organized. I often jump to a method by locating it in Oasis and double-click to enter UltraEdit. Now, when I use Emacs under Linux, I don't have this overview of my code, and I feel I miss something. Searching for "sub mymethod" works just as well, but I don't have a the high-level model of my code anymore. It's just text, what fits on the screen, and I have a less clear picture of where I am. This abstraction thing, to be able to look at things at different resolutions, to zoom in and out, is important. Different resolutions aren't just a trick of eye. The experience makes it different. I wrote a program called SQL Map to analyze all our DDL for tables and T-SQL stored procedures for a project at work. It shows each object DDL syntax highlighted, with all other object names hyperlinked. If you see "exec that_other_proc @param", click that_other_proc to jump to the implementation. SQL Map also uses GraphViz to visualize the relationship between all tables, which procedures call each other and what tables and views they touch. The HTML output of SQL Map soon became the preferred way to understand the system, because it not only presented the code in a good way, it presented the relationships between different parts of the code and made it very simple to jump around in the source. Along the lines of more is different, I would like to state that abstraction is different too. By taking things away, you don't get less. You get relatively more of the interesting things that you really care about. In Perl Oasis, things are stripped away. The source text is removed to reveal the sub routine structure. In SQL Map, things are added. The source text is enriched with syntax and references to symbols. In both cases software is used to enhance the experience of the source. I think that's a good thing. The more the better.


M-x speedbar

simonflk on 2004-09-02T13:08:50

I often jump to a method by locating it in Oasis and double-click to enter UltraEdit. Now, when I use Emacs under Linux, I don't have this overview of my code

My emacs has speedbar (M-x speedbar) that does something similar. To be honest, I've only used it once out of curiosity. It's nice but I don't think I need it.

Re:M-x speedbar

jplindstrom on 2004-09-02T14:46:15

Yeah, I've tried that and I sometimes use it when coding C++, but it's not nearly the same thing.