Slashdot Mirror


Source Code Browsing Tools?

Marco Sanvido asks: "I often look at source code (especially C, but this question is valid for other languages as well) and I have a really hard time in understanding how it works. Documentation is often missing or quite outdated, and the only way to see how the program works is to try to understand the source code. Which tools do you prefer to use for browsing and studying source code? So far I have used LXR for Linux, Eclipse for java, and CScope, but I'm not sure that these tools are the best solution." It's tempting to flood this question with answers for your IDE, but the key thing here is _browsing_, not _development_. What decent, lightweight programs would work well as source code viewers?

165 comments

  1. A couple of options by plover · · Score: 5, Informative
    If you're looking for really lightweight, run the code through a prettyprinter first. Pick the style you can most easily read. For example, I personally don't like K&R style, but that's entirely up to you.

    If you're looking more for documentation of existing code, doxygen is great. It produces click-to-follow hierarchies, graphical pictures of trees, and can will intelligently display some of the comments it encounters. It can produce output in html, LaTeX, rtf, PS, PDF, and even man pages. And I know from experience that it can handle some pretty massive projects.

    --
    John
    1. Re:A couple of options by diverscuba023 · · Score: 2, Interesting

      The only problem with doxygen is the amount of time it takes to generate the documentation for an entire project. I had one project it would take almost 48 hours to produce the documentation for and it could not generate the graphs for two of the hiearchies since they were too big. The source code was only about 500K lines.

    2. Re:A couple of options by Blakey+Rat · · Score: 1

      doxygen chokes on the complex macros used in the legacy C modules of my C++ application. Does anybody know of any tool similar to doxygen, but better at parsing C?

  2. Graphical Displays by Anonymous Coward · · Score: 0

    I personally would like to see tools for visually displaying objects at runtime in an animated graphical display. It would be a quick way to figure out a large code base rather than having to read all the code.

  3. The only option by Frogbert · · Score: 3, Funny

    Real programmers use "type".

    1. Re:The only option by Alfred,+Lord+Tennyso · · Score: 5, Funny

      Actually, real programmers use cat.

    2. Re:The only option by popeyethesailor · · Score: 4, Funny

      Um no. They may grep, sed, awk, diff, tr, tail,head or more; but they never cat.

    3. Re:The only option by Catastrophator · · Score: 3, Funny

      Bah! Real programmers program with the switches on the front panel! Damn whippersnappers... And get of my lawn!

    4. Re:The only option by Anonymous Coward · · Score: 0

      heheh, close but no cigar :)

      I build software on-the-fly using [url="http://fabrice.bellard.free.fr/tcc/tcc-doc.h tml#TOC3"]tcc -run[/url],

      including my build workstation! Hell, it's 9 times faster than gcc too!!

    5. Re:The only option by martin-boundary · · Score: 1

      Actually, real operating systems use cat.

    6. Re:The only option by shenanigans · · Score: 2, Funny

      Bah. Real programmers use hexdump.

    7. Re:The only option by Richard+Steiner · · Score: 2, Funny

      Real programmers don't work on toy platforms (like UNIX) at all. :-) We use tools like ED, DOWNDATER, IACULL, and LISTER to generate CCFs in a proper format which our compilers understand (not that "diff" crap), use SGSs written in SymStream to control our product compiles, read dumps in octal (hex is for long-haired bean-sprout-eating UNIX freaks and peecee weenies, and interactive debuggers are for slopeheads who lack the mental capacity to write real programs), and don't use formal change management. Real programmers can keep track of potential merge errors and fix them manually if one occurs at GEN time, and we drink Mountain Dew, not that hot smelly crap made from beans.

      --
      Mainframe/UNIX Bit Twiddler and long time Windows/Linux Hobbyist.
      The Theorem Theorem: If If, Then Then.
    8. Re:The only option by Bastian · · Score: 3, Funny

      And get of my lawn!

      Real programmers know that forgetting even a single byte in any stream of data can turn it into gibberish or worse.

    9. Re:The only option by marcosdumay · · Score: 1

      I less. does that make me not real?

    10. Re:The only option by Anonymous Coward · · Score: 0

      You are confused. cat > foo.c is not a useless use of cat. How do *you* do that, tr a a > foo.c?

    11. Re:The only option by Autonomous+Cow · · Score: 2, Funny

      Indeed. But a real UNIX hacker can unplug the monitor, cat the source files to /dev/dsp and listen for bugs in the system. And he knows from the tune whether its compiler errors or silly warnings designed for people who think lint-clean does not imply a wool suit.

      --
      The Autonomous Cow. Moo.
    12. Re:The only option by AttilaDHun · · Score: 1

      How about "vi" in case one needs to add that missing semi-colon? ;-)

    13. Re:The only option by Chrax · · Score: 1

      Jesus, haven't you heard of sed?

    14. Re:The only option by Chrax · · Score: 1

      Old hat. A *real* hacker reverses the polarity on his speakers, and whistles his source code.

  4. OpenGrok by Lucractius · · Score: 4, Informative

    the opensolaris code browser is built off a bunch of open source stuff.

    OpenGrok
    its incredibly easy to use, and makes things very easy to read. and is now packaged for your enjoyment.
    and available at http://www.opensolaris.org/os/project/opengrok/

    --
    XML - A clever joke would be here if /. didn't mangle tag brackets.
    1. Re:OpenGrok by Anonymous Coward · · Score: 2, Interesting

      That looks very interesting but the requirement page lists a servlet container, such as Glassfish or Tomcat, just to use it. Is there a way to use it without installing Tomcat or Glassfish or is it primarily a web app? I have no interest in any of the online functionality it offers and requiring a servlet container seems to be overkill for my needs. Running Tomcat or Glassfish in the background simply for this application definitely removes it from being a "lightweight" option.

    2. Re:OpenGrok by Lucractius · · Score: 1

      while the above post was anonymous and probably not seen by many. it asked if there was a way to run this on a more local/lite deployment. i dont know myself, ive already got a tomcat box lying round for testing so it wasnt hard for me. But if you dont have a servlet container available. theres a few non tomcat options

      http://servlets.com/engines/#embeddable has a list of quite a few. and from the list

      http://jetty.mortbay.com/jetty/index.html seems to be the best candidate. (though it quotes no resource figures)

      --
      XML - A clever joke would be here if /. didn't mangle tag brackets.
    3. Re:OpenGrok by Doctor+Memory · · Score: 1

      It's a web app. If you're not using any currently, then this isn't for you. Personally, installing & configuring Apache and Tomcat (and PostgreSQL) is just part of my default install ritual, but I realize lots of people don't want to leave a dozen or so extra processes lying about (exp. when one of them is a JVM sucking down 70-100K of memory).

      --
      Just junk food for thought...
    4. Re:OpenGrok by creepynut · · Score: 1
      (exp. when one of them is a JVM sucking down 70-100K of memory).
      This is why I don't use Java! My computer's only got 640K of memory!
    5. Re:OpenGrok by funfail · · Score: 1

      If it's only taking 70-100K, it must be a KVM.

    6. Re:OpenGrok by Anonymous Coward · · Score: 0

      It needs tomcat if you want to host your source code on a server,
      otherwise it comes with a standalone cscope like GUI to search the code

  5. Same difference by Anonymous Coward · · Score: 0

    Personally I use vim/vi for both, but then I guess I'm old school :-)

  6. Nothing Can Beat a Good Editor by justanyone · · Score: 2, Insightful


    Nothing Can Beat a Good Editor

    As much as we might like to use some special purpose tool for this purpose, most of the time that I'm looking at code I'm not entirely sure if I'm going to be editing it or just peeking. Thus, it's silly to be in one program when I need another. And, the added "system weight" of running a "heavy" editor vs. /bin/less or vi or emacs is silly, when I don't want to remember all their key combinations for moving around the file - top, bottom, page up pagedown, etc.

    Syntax highlighting is THERE in an editor, and I don't have to restart if I change my mind about changing the file.

    http://ultraedit/com/ is a GREAT editor for Windows, or Jedit or Eclipse for Win or unix.

    1. Re:Nothing Can Beat a Good Editor by plover · · Score: 4, Informative
      For windows, I've completely replaced "notepad.exe" with "notepad2.exe" And when I say completely, I mean I crawled through my system registry editing every occurrance of "notepad.exe" to "notepad2.exe". Shell opens, file associations, defaults of every sort use it. I love it. And unless someone using the computer is particularly observant, they don't even notice it's not the original notepad.

      It has a very simple interface that looks like the original notepad, it does syntax coloring for two dozen different languages and file formats, shows bracket matching, adds line numbers, word wrap features, support for UNIX- and mac-style line terminations, regexps, and is in general what notepad itself should have been back in the 1990s. Plus, it's freeware. What more could you want?

      --
      John
    2. Re:Nothing Can Beat a Good Editor by cerelib · · Score: 1, Flamebait

      Okay, I almost started laughing when you said " a "heavy editor" vs ... emacs". I view emacs as quite a heavy editor, especially vs something like vi/vim. It has features for mail and news for crying out loud. Hell, I used to use Emacs, but have switched to vim. I switched partly because it was much lighter, even the gui. You really start to see it if you run it remotely using X.

    3. Re:Nothing Can Beat a Good Editor by JPyObjC+Dude · · Score: 1

      I love UltraEdit as well when I have to windoze my way through code.

      Treepad is not that bad as an alternative though. It is missing the nice compact search and replace dialog but otherwise is very feature rich.

      JsD

    4. Re:Nothing Can Beat a Good Editor by b17bmbr · · Score: 2, Informative

      or, you could have copied the executable to C:\windows and renamed it notepad.exe. it sucks that windows doesn't use symlinks though. would make it a whole lot easier. but then again, isn't that the point of windows, making what need to do impossible, everything you don't want to do easy.

      --
      My problem? I was perfectly gruntled, until some numbnuts came by and dissed me.
    5. Re:Nothing Can Beat a Good Editor by corychristison · · Score: 1
      I really like metapad when I am stuck with Windows[mostly at school]

      I can't stand syntax highlighting. Although, I think that is mostly because it looks terrible and is mostly unreadable when you use a dark background. :-)

    6. Re:Nothing Can Beat a Good Editor by Anonymous Coward · · Score: 1, Interesting

      Vim is not much lighter then Emacs, strictly speaking it actually is an emacs (not by keyboard layout, but by programability). They both are light compared to the IDEs of today.

    7. Re:Nothing Can Beat a Good Editor by willie150 · · Score: 1

      Unless you really try, windows file protection (under XP at least) wont let you do that. Talk about making what you need to do impossible.

      --
      Better to stay silent, and let people think you're an idiot than to open your mouth and remove all doubt
    8. Re:Nothing Can Beat a Good Editor by Eideewt · · Score: 1

      Doesn't Emacs weigh in at about six times Vim's size?

    9. Re:Nothing Can Beat a Good Editor by Anonymous Coward · · Score: 0

      I've been waiting for a syntax highlighting implementation that would be based on more subtle typographical hints, such as italics, weight, and minor typeface changes. Syntax highlighting shouldn't have to jump on your face, minor cues would be much less distracting and pleasant to use. Anyone know of something along these lines?

    10. Re:Nothing Can Beat a Good Editor by Matilda+the+Hun · · Score: 1

      I prefer Crimson Editor myself, even though the author's gone to ground and the project hasn't been updated in awhile. Syntax highlighting for a bunch of languages, plus customizable color/italic/bold combinations for displaying keywords and whatnot.

      --
      Tluin natha Linux xxizzuss uriu olt bwael mon'tun.
    11. Re:Nothing Can Beat a Good Editor by dolmen.fr · · Score: 2, Informative

      Notepad.exe is both in %WINDIR% and %WINDIR%\System32 and as the other poster pointer, it is a hard task to replace them in XP due to system file protection.

    12. Re:Nothing Can Beat a Good Editor by dolmen.fr · · Score: 1

      The problem is to keep character alignment when using differents fonts/weights. Often different weights with fixed font break display.

      If you still want to use it, in vim/gvim you can use bold/underline/undercurl/reverse/inverse/italic/st andout. See :help attr-list

    13. Re:Nothing Can Beat a Good Editor by BaronGanut · · Score: 0

      why didn't you just replace the notepad.exe file with the new one? Would save you some work i guess :p

      --
      Mohahah!
    14. Re:Nothing Can Beat a Good Editor by Anonymous Coward · · Score: 1, Informative
      ATTRIB -S %WINDIR%\NOTEPAD.EXE
      I've not really used XP, but if the guy can edit the registry then I'd wager he can do the above. Am I missing something here?
    15. Re:Nothing Can Beat a Good Editor by shyster · · Score: 1
      or, you could have copied the executable to C:\windows and renamed it notepad.exe. it sucks that windows doesn't use symlinks though. would make it a whole lot easier.

      Well, symbolic links are out (unless you want to link to a directory, then you can use junctions, but a hard link is available and should work.

    16. Re:Nothing Can Beat a Good Editor by Council · · Score: 1

      I used Metapad for a couple years, but discovered it had certain problems where it would insert a junk character at the end of files unexpectedly. This was really bad as I was using it to edit code, so I had to switch to WordPad.

      --
      xkcd.com - a webcomic of mathematics, love, and language.
    17. Re:Nothing Can Beat a Good Editor by cerberusss · · Score: 1
      What more could you want?

      Command mode.

      --
      8 of 13 people found this answer helpful. Did you?
    18. Re:Nothing Can Beat a Good Editor by cronot · · Score: 1

      Not really. When I need to install metapad, I just make .BAT file that has something like:
      copy /y metapad.exe c:\windows\system32\dllcache\notepad.exe
      copy /y metapad.exe c:\windows\system32\notepad.exe
      copy /y metapad.exe c:\windows\notepad.exe

      place that batch file on the same directory as metapad.exe, and run it. That's it. Windows will complain that "system files" were replaced and ask for the install CD to recover, just cancel an go on your merry way. Far easier and quicker than editing a bunch of registry keys.

    19. Re:Nothing Can Beat a Good Editor by Hack'n'Slash · · Score: 1

      Notepad++: Tabbed text editor! I used to use gvim, but I've found Notepad++ to be much easier for quick edits. (Then again, I'm not a vi ace.)

    20. Re:Nothing Can Beat a Good Editor by Jerf · · Score: 2, Informative

      emacs used to be a heavy editor. But "heavy" is a relative term. In an era where people will open Eclipse to edit a file, is emacs really heavy anymore? Probably not. Most of the features people will complain about like news reader, etc., are loadable modules anyhow and who cares what modules the program might load?

      On my personal system, emacs in text mode loads before I'm ready to edit the file, which is all I can ask for, and it's still the fastest XWindows editor I can open. It may be "heavier" than other editors based on GTK or QT, but it seems GTK and QT aren't necessarily "light" themselves, so my emacs will be up way before even lightweight things like GEdit.

      I think calling emacs "heavy" now is just inertia from the era of 1MB machines. If emacs is heavy, than so is damn near every app I run and that's not a very useful definition if it never distinguishes between anything.

    21. Re:Nothing Can Beat a Good Editor by after+fallout · · Score: 1

      I use PsPad because I can turn off coloring and just use bold and italics (and some other non color modifications). It is really nice when I need to print out the code to hand it in.

      http://www.pspad.com/

    22. Re:Nothing Can Beat a Good Editor by Bastian · · Score: 1

      Pardon me if I'm being ignorant here, but I thought the only reason vim doesn't normally have all these features is that not as many people write scripts for it. I know vim is just as extensible, so criticizing emacs for having such a large library of plug-ins (or even for including more of them out of the box) strikes me as being rather silly.

      Now, if you're wanting to be a badass who uses an old version of vi that doesn't include decent scripting support, that's different. But me, I'm a programmer and I like my syntax highlighting and whatnot.

    23. Re:Nothing Can Beat a Good Editor by Anonymous Coward · · Score: 0

      I used nlite to replace the cab file containing notepad with one containing notepad++ on my installation CD.
      M$ should have done this years ago.

    24. Re:Nothing Can Beat a Good Editor by Anonymous Coward · · Score: 0

      I agree with you, the only thing I differ is that I actually use gVim on Windows whenever I am stuck with windows (that is, 8 hours a day, at work...)

    25. Re:Nothing Can Beat a Good Editor by fbg111 · · Score: 1

      There's also Notepad++ and TextPad, both similar to Notepad2.

      --
      Flying is easy, just throw yourself at the ground and miss. -Douglas Adams
    26. Re:Nothing Can Beat a Good Editor by xonen · · Score: 1

      offtopic=100%
      it sucks that windows doesn't use symlinks though

      It comes with vista:
      http://msdn.microsoft.com/library/default.asp?url= /library/en-us/fileio/fs/symbolic_links.asp
      http://blogs.msdn.com/junfeng/archive/2006/04/15/5 76568.aspx
      just another small tiny step towards compatability. or just another argument that unix is superior.

      --
      A glitch a day keeps the bugs away.
    27. Re:Nothing Can Beat a Good Editor by Anonymous Coward · · Score: 0

      Not really. When I need to install metapad, I just make .BAT file that has something like: [snip]

      The problem with approaches like this is that a Service Pack or patch may replace the "custom" notepad.exe with an updated standard MS executable. Rooting it out of the registry is more work, but also more likely to be a permanent solution.

      - T

    28. Re:Nothing Can Beat a Good Editor by Anonymous Coward · · Score: 0

      I too have tried that but I find Notepad++ to be a far better notepad replacement.

    29. Re:Nothing Can Beat a Good Editor by plover · · Score: 1
      Ever have a service pack replace Notepad? Ever go to a coworker's desk, type "notepad" and get some weird-ass editor in its place?

      Notepad2.exe is a "close" replacement, but not identical. I wanted the path of least surprises: if you type notepad, you should get exactly notepad. If you click "Open as" and pick notepad from the list, you should get exactly notepad. But if you accept the default editor on my machine, you'll get a decent replacement. And I have a copy named "n.exe" for quick typing in the command shell.

      --
      John
  7. Krugle by WeAzElMaN · · Score: 2, Informative

    If I'm looking at third-party code (instead of my own), I like to use Krugle. It's still in beta and I was lucky enough to get a beta invite, but it's an extremely powerful tool for searching through repositories and documentation.

  8. LXR by ashridah · · Score: 2, Informative

    I've always considered stuff like LXR (linux cross reference) to be good for this kind of thing.

    LXR's claim to fame is that it started out being a cross-referenced browser for the linux kernel source code, but since it was released, the newer versions has moved towards becoming more of a general source browser. (might need to use cvs, don't know if a proper release was made)

    It does neat tricks like processing source code, building function/variable/header/etc line references for usage, definition, declaration etc, and cramming them into a db for retreival. It can also handle interfacing with CVS to pull source code directly from a CVS server, which is interesting. Also handles full text searching too, if you get glimpse or whatever.

    Of course, the interface to LXR is a web browser, which makes it less than ideal if you consider that it isn't integrated into an IDE, but for the purpose of tracing/searching large amounts of code, it's still pretty useful.

    ash

    1. Re:LXR by schngrg · · Score: 1

      I really fell in love with LXR when I used it to dig in Mozilla source code. It works really well for large code bases.

      I can't say if this is the best because I havent looked at many other options, I just use MS VisualStudio for most of the development and it has nice browsing features.

    2. Re:LXR by nacturation · · Score: 1

      LXR, how unique! Just like the submitter put right there in his question!

      --
      Want to improve your Karma? Instead of "Post Anonymously", try the "Post Humously" option.
    3. Re:LXR by ashridah · · Score: 1

      Of course, but he asked if there was anything better. You may as well assume my post is a vote in favour of LXR.
      It certainly helped me a lot while i was wading through the kernel source, and it does support non-kernel sourcecode in more than just C nowadays.

      ash

  9. codeviz by meowsqueak · · Score: 4, Informative

    You can make some useful call graphs with codeviz + graphviz. I sometimes find this useful for tracing the heirarchy of abstraction through a set of C source files.

    http://www.csn.ul.ie/~mel/projects/codeviz/

  10. SlickEdit by the_skywise · · Score: 1

    Yeah I know we're not supposed to discuss IDE's. But its class browser (which can handle multiple languages) can greatly simplify trouncing through a code base.

    1. Re:SlickEdit by fizzycyst · · Score: 1

      My experience with SlickEdit was not so good. I work on a medium sized project (500 kLOC C++) with namespaces and SlickEdit gets totally confused...

    2. Re:SlickEdit by the_skywise · · Score: 1

      It depends on how you're using namespaces. If you're doing a
      "using namespace fred" in your .cpp file for your class definitions then that will give SlickEdit fits (at least with version 7 or lower... we since exorcised that code fromm our project so I'm not sure how the newer versions react to it.)
      Otherwise, I've had little complaints with its namespace handling in the most recent versions, including nested namespaces. I'm not saying it's code interpretation is perfectl mind you, but I've yet to find an IDE that doesn't have interpretation problems with something or another. I use Visual Studio .NET with Whole Tomato's Visual Assist and it's interesting to see what SlickEdit or Visual Assist will recognize or omit.

  11. One excellent option... by dracken · · Score: 2, Informative

    ..is Redhat Sourcenavigator . You can look at class hierarchy, static call graphs, jump to function declarations/definitions/callsites. Try it out.

    1. Re:One excellent option... by antime · · Score: 1

      It's a nice tool, but unfortunately at least the Windows version is rather unstable and it seems that development has stopped completely. (Yeah I know, open source, DIY, blah blah.)

    2. Re:One excellent option... by multipartmixed · · Score: 1

      I had the same experience under Solaris.

      I suspect that if it's stable anywhere, it's under Linux.

      --

      Do daemons dream of electric sleep()?
  12. JEdit by ChaseTec · · Score: 2, Interesting

    I needed an easy to use C source code browser because I'm porting an old bbs game to Java. JEdit fit the bill perfectly. Out of the box it's not much more then a text editor with syntax highlighting(130+ languages). It has a feature call HyperSearch that can be used for search through single files or multiple files and have a little box of hyperlinked results. It has lots of plugins to extend it's funtionality but nothing extra to get in the way when you first install it. Check it out at jedit.org. The only thing some people might take issue with is that it requires Java.

    --
    My Hello World is 512 bytes. But it's also a valid Fat12 boot sector, Fat12 file reader, and Pmode routine.
  13. Notepad by jarg0n · · Score: 1

    Notepad

    --
    Error 2101: all your sig are belong to us
  14. gdb by Bastian · · Score: 4, Interesting

    I'm actually a fan of using a debugger to step through code I'm trying to understand. I can let it keep track of the call stack for me and it saves me from having to manually surf around multiple source files to figure out where the next function I need to look at is.

    It's not a good way to figure out how every nook and cranny of the code works, but it's great for an initial scan-through to see the overall structure of a module. And if you are at liberty to throw in an embeddable scripting language (I use F-Script) you can poke and prod at anything you want with ease.

    1. Re:gdb by vandalman · · Score: 1

      That is a great idea! I'll have to try that, thanks for the tip.

      --
      Devise, Repair, Solve, Build
    2. Re:gdb by Hast · · Score: 1

      Do you know of any way of putting traces from a debugger back into the source browser?

      For me the holy grail would be to have a system similar to Doxygen which would allow me to "load" a trace from a debug session and use that to step around in the code.

    3. Re:gdb by Bastian · · Score: 1

      I really don't. It's never occurred to me. I use XCode's gdb interface, which doubles as an editor. I just make my notes in the actual source as I'm stepping through with the debugger.

      Which reminds me; I don't know if other development environments do this, but XCode's "patch" feature is also really killer for figuring out what's going on. If you want to force the execution to go down a certain path, you can always break just before the conditional, comment it out, click patch, and continue without having to restart the debugger session.

    4. Re:gdb by marcosdumay · · Score: 2, Interesting

      Use GDB inside of Emacs (M-x gdb) That way, you have an entire buffer to navigate through the code, while the debugger output is displayed on another buffer. And, yes, the code buffer is always actualized to the running instruction when the debugger beaks.

  15. SciTe by stony3k · · Score: 2, Informative

    I prefer to use SciTe - it's really lightweight - supports code folding, syntax highlighting and it's open source.

    --
    Freedom is not worth having if it does not include the freedom to make mistakes. - Mahatma Gandhi
  16. Source Insight by Anonymous Coward · · Score: 2, Interesting
    1. Re:Source Insight by eegreg · · Score: 1

      I have looked into many alternatives for browsing code, but nothing comes close to Source Insight. (unless you are willing to spend more than the $150 Source Insight costs). I think it is not popular because it is not a good IDE: I don't know anyone who uses is as an editor. I believe there is a free trial version.

    2. Re:Source Insight by Anonymous Coward · · Score: 0

      I have to give this another nod. A lot of people at the company I work at swear by source insight. We don't use it for development, but it's very powerful for understanding the execution path through code.

  17. Not really a browser, but helpful by Klowner · · Score: 2, Informative

    I've found Doxygen to be pretty handy, it'll output to a bunch of HTML files and even create nifty relationship graphs for OO languages like C++

    http://www.stack.nl/~dimitri/doxygen/

  18. cscope by addaon · · Score: 1

    You mentioned scope... what exactly doesn't it do that you'd like? Other than the time to build to source database (minutes for large projects, amortized heavily if you're only reading), it seems perfect to me.

    --

    I've had this sig for three days.
    1. Re:cscope by ZMerLynn · · Score: 1

      Agreed. I really like cscope, and it works well with emacs (just dig up cscope-mode.el). The time to create the database is large, but the search capabilities it gives are wonderful.

    2. Re:cscope by javax · · Score: 1

      cscope! Mod parent up! :)

    3. Re:cscope by bhima · · Score: 1

      I use cscope from within VIM... I'm pretty sure it's compiled by default in the available binaries... but I'm not sure.

      Anyway it works really well and I like VIM for the rest of my devleopment anyway so no extra tools are really needed.

      --
      Nothing in the world is more dangerous than sincere ignorance and conscientious stupidity.
  19. Re: Pretty Printer by eikonoklastes · · Score: 1

    Here's what I use:
    a2ps -o output.ps --prologue=color SOURCECODE.c
    lpr output.ps
    I love it.

  20. FishEye by pajama · · Score: 2, Interesting

    If you develop in Java you could try FishEye:
    http://www.cenqua.com/fisheye/

    1. Re:FishEye by Anonymous Coward · · Score: 0

      Actually FishEye is useful for code in any language (but it only seems to work with code in CVS or SVN). It just happens to be implemented in Java.

  21. A query language for browsing by mmacdona86 · · Score: 2, Interesting

    To plug a personal project of mine--
    Browse-by-Query is a database for code with a query language specifically designed for finding things in code.
    I was dissatisfied with fixed-function browsers, so I developed this.
    Use expressions more powerful than regular expressions to search through and understand your codebase.
    Works only with Java now (there's a standalone version and Eclipse plugin) but I hope I (or someone else) will extend it to others.

  22. Notepad++ by hotarugari · · Score: 1

    Notepad++ is opensource, available on most platforms, allows tag/function/logic expansion, has preset color coding for most all popular languages. The find/edit capabilities are comprable to Dreamweaver's allowing regular expressions if your into that thing. It does color labeling to find snippets you ran a find on, of you can do the traditional up and down find. If anything, if has too many features.

    It is what you would expect the microsoft people to produce if they were trying to sell notepad/wordpad on the featuresets like they used to in order to engulf the market.

    1. Re:Notepad++ by Southpaw018 · · Score: 1

      Let me second that. I used to use Ultraedit until they triple billed me and wouldn't fix it (I eventually had to do a chargeback). When I went looking for a replacement, I tripped over Notepad++ and have never looked back.

      --
      ACs are modded -6. I don't read you, I don't mod you, I don't see you. Don't like it? Don't be a coward.
    2. Re:Notepad++ by mvdw · · Score: 1

      If by "available on most platforms", you mean, "available on windows only", then I would agree with you.

  23. Understand for C++ by barries · · Score: 2, Interesting

    We use Understand for C++ (link is to the index of all "Understand for..." family members) when reviewing and designing formal unit tests for our clients' code. It's extremely useful for manual static analysis: understanding structure and inter-relatedness, so to speak.

    However, to understand dynamic behavior you should look at various tracing options, even the lowly printf(), or try stepping through in a debugger. The larger, more complex and the more object-oriented the code, the more important understanding the dynamics are.

    Anyway, Understand for C++ is much more interactive than any of the free comment extraction or cross reference tools and the database has a Perl API, though we've not had a chance to use it. It's worth the price if your doing this as part of your job.

    - Barrie
    1. Re:Understand for C++ by Merlin42 · · Score: 1

      I use Understand for Fortran quite regularly and I really like it. The GUI has lots of little anoying quirks ... but those anoyances are more than made up for by the real meat of the program which realy does help you understand your code. Plus their support is _very_ responsive, every bug report or feature request I have submitted has been dealt with in 2 weeks or less. Also, they put out a new build every monday.

    2. Re:Understand for C++ by s31523 · · Score: 1

      The Understand Tools rock! I have used the C++ and the Ada version. My projects are typically very large (300KSLOC) and have code that is coupled all over the place. The mapping tools are very good and reports generation helps document things we need to document for design documents. We use Rationale Apex for Ada, but I always download the source to my PC and use understand because it just does a better job.

  24. Emacs by sdfad1 · · Score: 2, Interesting

    I know you said no IDE's, but if you merge well with Emacs, it can do the work too. Emacs is not exactly a heavy weight, depending on how you install it (it's often built into your distro anyway). It uses this thing (I don't really know it that well to be honest) called tags - ctags or etags.

    Basically you run etags (check your man pages) from the command line that will parse through your source files and create a lookup table in a file (name TAGS by default I think). While browsing the source file, you just have to position the cursor at the right symbol, and press M-. (that's usually Alt-DOT) and it'll take you to the function definition. (vim has a similar thing)

    I haven't used it too much, since I'm a Lisper, and the Slime development environment (Emacs addon mode) for Lisp has a similar thing (and it doesn't need to create any tables beforehand) that also provides a "stack-like" functionality. That means you can jump to the function definition, then pop back to where you were. This can be handy for quick detours just to lookup small functions for example.

    The advantage here is that you have the all the files locally, so it's faster than browsing through a web interface (html-ized source files, like the Sourceforge CVS frontend - I still use that a lot, and it is SLOW), and you can also edit the source (just a bonus).

    1. Re:Emacs by toybuilder · · Score: 1

      I second the recommendation for etags for Emacs users. It's a good way to dig down through code and then pop back up.

    2. Re:Emacs by ObsessiveMathsFreak · · Score: 1

      Don't forget some of the other features of EMACS too.

      First and foremost, syntax highlighting. I don't know a single program that highlights syntax as well as Emacs. Get your colour scheme right and code won't be the same without it. You can visually "see" the code structure at a glance without even having to read the words. Emacs indenting is also superior, and really helps when making out the overall structure. There's even a code folding option now, so you can finally collapse sections. Very useful at times.

      That said, I would only use emacs when browsing individual files. For an overall project structure, something like doxygen is the way to go. If only Firefox had an Emacs plugin, you could get the best of both!!!

      --
      May the Maths Be with you!
    3. Re:Emacs by martin-boundary · · Score: 1

      Try the Emacs Code Browser (http://ecb.sourceforge.net/) and Doxymacs (http://doxymacs.sourceforge.net/).

    4. Re:Emacs by chthon · · Score: 1

      Though I like Emacs and currently use it, I find the standard syntax highlighting of Vim superior.

      Maybe it is because I mostly use Perl.

      Two things stand out.

      emacs only highlights variables in Perl when they are declared, and does not to highlighting on @ and % variables. In Vim all variables are highlighted anywhere.

      The other thing is POD documentation. In Emacs one has to reload the file for POD sections to be highlighted, when in Vim they are highlighted from the moment you start a '=pod' section.

    5. Re:Emacs by chthon · · Score: 1

      And emacs misses folding.

      Once there was an elisp folding package, but last time I searched, it was nowhere to be found.

    6. Re:Emacs by holle2 · · Score: 1

      Usually the folding-mode is available to both, gnu emacs and xemacs. See folding.el for details. Though it does not fold source right away as other folding tools do, it can be told to fold anything you like. The command folding-foldify-region inserts begin and end fold-marks into the current buffer. Those are usually pre-defined for C/C++ etc. and look like this:

      // [[[

      // ]]]
      respectively
      /* [[[ */

      /* ]]] */
      Comment style can be tweaked by setting folind-mode-marks-alist accordingly.

      The nice part about this is, that you control what the editor folds and what not as well as you can enter some text prefixing the [[[ like this:

      // Some block I wanted to fold [[[
      When folded in emacs it looks like this:
      // Some block I wanted to fold [[[...
      thus giving you the opportunity to add your own comments and messages to a block.

      Yes, I am missing some sort of magic extension to the folding-mode, like add little +/- signs in the first column to automatically calll folding-foldify-region, but then again:

      1. bind the lisp function mark-paragraph to something you like, unless it is already bound (M-h)
      2. learn the shortcut for folding-foldify-region (C-c @ C-f) as well as the shortcuts for folding-shift-in (C-c @ >) and folding-shift-out (C-c @ <) or you can use the right mouse button to toggle the fold (folding-toggle-show-hide: C-c @ C-q)

      The plus here is that you can operate the folds without using the mouse.
    7. Re:Emacs by Just+Some+Guy · · Score: 1

      Have you discovered cperl-mode yet? It's like perl-mode but done right.

      --
      Dewey, what part of this looks like authorities should be involved?
    8. Re:Emacs by chthon · · Score: 1

      All my previous gripes are based upon CPerl mode.

    9. Re:Emacs by chthon · · Score: 1

      I finally found it at EmacsWiki.

    10. Re:Emacs by jgrahn · · Score: 1
      Though I like Emacs and currently use it, I find the standard syntax highlighting of Vim superior. [...] emacs only highlights variables in Perl when they are declared, and does not to highlighting on @ and % variables. In Vim all variables are highlighted anywhere.

      You may be right about vim's syntax highlighting being better overall, but you are wrong about perl. My emacs highlights @foo and %foo well enough; they get colored and, IIRC, underlined.

    11. Re:Emacs by jrockway · · Score: 1

      Yeah, if he's using cperl-mode, he's using it wrong. It does a great job figuring out tricky things like $@foo[bar]->{baz}, etc., as well as the usual %hash, @array, $scalar (and $hash{foo}, $array[0], $#array, etc.)

      --
      My other car is first.
  25. Re:SciTe - no by eyal · · Score: 1

    ...and also totally irrelevant to this discussion. The question was about source browsing tools, not about source editing tools. The "find" and "find in files" functions that SciTe provides don't really count as browsing tools.

  26. Slicing, anyone? by babble123 · · Score: 1

    This is a question, not a recommendation: Does anybody out there using program slicing tools? Or any of the other "program understanding" tools that people doing software engineering research seem to spend a lot of time developing?

  27. How dare you... by tanveer1979 · · Score: 1

    think beyond ed

    --
    My Aurora : http://www.youtube.com/watch?v=o91ZsGwJYyg
    FB : https://www.facebook.com/TanveersPhotography
    1. Re:How dare you... by Per+Wigren · · Score: 2, Funny

      Hey, we weren't supposed to talk about IDEs!

      --
      My other account has a 3-digit UID.
  28. ViewVC is handy... by tcopeland · · Score: 1

    ...if your code is in a CVS or Subversion repository. It uses enscript for syntax highlighting which works pretty well for a variety of languages (for example, Ruby).

    I agree with some of the other folks here, though - a good IDE makes an excellent code browser. IntelliJ IDEA is awesome if you're working with Java code...

  29. Re:Emacs (and V) by Drubber · · Score: 1

    One great thing about Emacs is that a directory browser is built-in. It doesn't use the native operating system's file/directory browse dialog by default (although it's there in GUI builds). The browser is in the same window as the editor. This means you don't have to use the mouse and click on five things to open a file.

    You can navigate from one directory to another just by pressing the up/down keys and enter. For example, pressing enter on the '..' line moves you up one directory. You can then 'close' the directory as if it were a text file and you're back where you started from. This makes traversing directories and files a very quick process, with stack behavior--all from the keyboard.

    Of course, it comes with the attendant price of the Emacs learning curve. One mitigating factor is that directory browsing is often covered early in the tutorials and if that's all you're using it for, it shouldn't be too painful.

    I learned Emacs because I needed to master an editor on Linux (I came from the Windows world). I can't live without it. Even though I'm back on Windows most of the time these days, I pop out of my "latest and greatest" Visual Studio 2003, 2005, ... be-all-and-end-all IDE dozens of times a day to use Emacs. It's just faster when all I want to do is find a file and search through it or edit it.

    On a seprate but related note, I use V 2000 http://www.fileviewer.com/. It's faster than any directory/text-oriented file browser than anything I've used (even Emacs). It saves a couple of keystrokes for each file, compared to Emacs, and they add up. I've used it for years and love it.

  30. useful tools by TehBlahhh · · Score: 1

    find, grep, less, and cat. Seriously, if a combination of that doesnt find what I'm after, and cant display it, there is something wrong.

    1. Re:useful tools by chrism238 · · Score: 1

      I agree, but also have a serious question. I love using vim for this purpose, because of its coloured syntax highlighting. Does anyone know of a tool, ideally a modified copy of less, that supports coloured syntax highlighting *in a paginator*?

    2. Re:useful tools by mvdw · · Score: 1
      I found this tip on vim.org: http://www.vim.org/tips/tip.php?tip_id=121.

      I haven't tried it, so don't know whether it's any good. I seem to remember a while ago I stumbled on something else which does exactly what you're referring to, but can't find it in my bookmarks or history.

  31. Understand from Scitools by Flu · · Score: 2, Informative
    I regulary use Understand C/C++ from SCITools (is available for Java and other languages) to browse source code (in my case, embedded sources that is supposed to be compiled using the Keil compiler). It's "right-click, for information" attetude makes browsing around a breeze. The reason is that it builds an internal database when loading the project (which takes a second or a few, depending on the size of the sources), and once built, the interface is astonishingly fast!

    One of the things I like most, is that it also colours all parts of the code that is #ifdef'ed out. Another thing is that the information windows for any token displays all kind of information: calls, callees, references, uses (including sets/get/modifies), used locals, used globals, exposed globals etc - all of which in a tree view, so it is very easy to decide what's important and what's not.

    It is possible to use it as an editor as well, which I do, but as such it isn't perfect.

    Also, importing a completely new project requires almost no intervension - it will simply prompt for where any missing #includes are located and add them to the searchpath, so just setting it up for a quick test is done in no-time.

  32. OpenGrok by nayaniabhishek · · Score: 1

    http://www.opensolaris.org/os/project/opengrok/ is the best that I've used till now. Easy to setup and quite fast to use.

  33. jGRASP - code browser & more... by CaptThunderbolt · · Score: 1

    Try jGRASP (http://www.eng.auburn.edu/department/cse/research /grasp/). Some good points below. 1) IDE front-end to compilers. 2) Generates CSD (source code visualization). 3) Runs on all platforms that use JVM. 4) Supports Java, C/C++, Ada, VHDL & Objective-C. 5) In-built debugger for Java.

  34. ctags! by wkr · · Score: 1

    Is there anything better? Run ctags recursively over your code base, and then use your favorite editor (vim, right?! or emacs, if you must[1]) to follow paths through your program logic, jump to variable definitions, and all kinds of other fun stuff. It keeps a stack, so you can pop back up to a higher frame and recurse down another path, ad nauseum.

    It supports 33 languages, and is used on all 7 continents (don't know why that matters, but hey, it's on the home page).

    http://ctags.sourceforge.net/

    [1] I had to.

    1. Re:ctags! by Anonymous Coward · · Score: 0

      "recurse down"? wtf, man, wtf.

  35. Try PSpad. It's free by fluor2 · · Score: 1

    Try PSpad. It's free. www.PSpad.com

  36. Re:Emacs (and V) by tetabiate · · Score: 1

    I like Emacs a lot and use it each time I have to code but for most activities like modifying a file or to writing scripts I prefer gvim. Emacs takes ages to start and its UI is not consistent with most desktop environments. Unfortunately, the port to modern widget toolkits like GTK never worked nicely. In marked contrast, the Windows version is really nice but I hardly remember the last time I booted on Windows.

  37. Browsing by dodobh · · Score: 1

    This depends on what you want to do.

    If you are looking for this in relation to debugging a known bug, ctags + vim (or etags + emacs) is the way to go. This also applies in case you just want to learn the code.

    If you are looking for this to audit the security of a program, then you need to follow code paths. While ctags will help you there, I don't see much stuff which is capable of showing flow paths in a program.

    --
    I can throw myself at the ground, and miss.
    1. Re:Browsing by kikibobo · · Score: 1

      ctags + cscope + vim is REALLY the way to go (IMO).

      Here's a great introduction: http://www.vim.org/scripts/script.php?script_id=51

      I've tried a lot of solutions; if you're inclined to go the Vim Way, then tags is great, cscope + tags is even greater.

  38. SourceNavigator by schlenk · · Score: 2, Informative

    You could also take a look at SourceNavigator at http://sourcenav.sourceforge.net/index.html.

  39. Vim too by dolmen.fr · · Score: 1

    I'm using Vim 7.0 too with a 'tags' file generated with Exuberant Ctags.
    See :help tags-and-searches

    I mapped Alt-Right and Alt-Left to quickly follow a variable/function name to its definition and go back:
    map <M-Left> <C-T>
    map <M-Right> <C-]>

    1. Re:Vim too by sgarg · · Score: 1

      Try the Tag List extension for Vim. Great & it rocks!!!

  40. Vim: but you gotta' want it.... but it's worth it. by WgT2 · · Score: 1

    Vim and tags.

    But, you have got to want to learn it if you are not already required to learn it.

    The upside?

    • It's an absolutely efficient text editor (once you learn the basic command set)
    • Variation on some of its basic command set are already used as shortcuts elsewhere
    • It's command super set is very huge (and worth programmers getting to know
    • It's free.
    • It's practically ubiquitous on *Nix machines (Mhy Gentoo's installer doesn't have it is a mystery. For the record: I hate Nano)
    • It has a small footprint
    • It's predicessor, Vi, is tollerable despite not having the same 'expected behavior' for some commands (if it has that command at all)
  41. Tools I have used, GNU Global & NCC by ZorroXXX · · Score: 2, Informative
    Lxr is good for browsing "static" code like the different linux releases. But as a tool for browsing arbitrary source code it is too cumbersome to set up and use.

    I have sometimes used GNU Global which makes indexed html pages of the code. Somewhat similar to lxr but there is no setup, just run two commands, gtags and htags. One nice thing about global is that it can be used on any incomplete subset of a software system. Want to just look at the files in the drivers/net/wireless directory in the linux kernel tree? Fine, just run gtags and htags from that directory (and no other setup is necessary).

    I have also used NCC which "compiles" each file and makes a index file with information like "function AAA calls functions BBB, CCC and DDD, reads variables EEE, writes variables FFF and GGG". The format is not exactly like that but you get the idea. NCC includes a text mode gopher-like variable usage/function call browser and there is a script to make graphical call graphs (via dot from graphviz). At work I have also used information from ncc files in combination with with information from the map file to find maximum stack usage.

    This study (which I just found while writing this) seems to have an interesting analysis of this topic.

    --
    When you are sure of something, you probably are wrong (search for "Unskilled and Unaware of It").
  42. sourcenav? by k8to · · Score: 1

    It doesn't really look maintained, but I really enjoyed Cygnus Source Navigator when I need to read a lot of source bases for a living. You can find it at http://sourcenav.sourceforge.net/ or probably as 'sourcenav' in the distribution of your choice.

    The underlying technology is not the prettiest ever. Yeah it uses TCL. But it has a workmanlike efficacy in terms of interface. Give it a try.

    For most smaller projects I just use vi and ctags, or maybe cscope with those, but I'm sure you're familiar with all that already.

    --
    -josh
  43. Not browsing, source code finding is the issue by wysiwia · · Score: 0, Offtopic

    I'm amazed, even the title of this story is wrong. For browsing any tool who can display code is sufficient. Sure tools which can syntax highlight or have name reference lookup are better but the real issue is to find the source code first hand.

    Whenever I search for a solution I first go to http://koders.com/ but their index seems a little limited. Still just try once looking up "wxSingleInstanceChecker". There are others like Koders.com but I've forgotten their names. Next I try to think of a most fitting statement for code and feed it to Google (e.g. "class App: public wxApp", but beware of the white space) which at least returns some hints which project might have source code available. Yet the free text search isn't very suited for searching code since it produces too much wrong results.

    When I've found a project which might have fitting code I either look into their LXR if it's available or simply download the source tarbal and use a decent editor (e.g. http://freshmeat.net/projects/wyoeditor/).

    It's said that none of the current CVS web tools are searchable, nor that Google is able to restrict results to CVS pages, else it would be much easier to search for source code.

    O. Wyss

    --
    See http://wyoguide.sf.net/papers/Cross-platform.html
  44. Browsing C by noz · · Score: 1

    Browsing and, incidentally, development. Use ctags (or compatible) and in vim press ^] over a symbol and vim will launch to the location that symbol is defined. Pop back by pressing ^T. See C++ development using vim and ctags for more options. Awesome.

  45. Brilliant source code browser by heretic108 · · Score: 2

    Leo - http://leo.sourceforge.net/

    A GUI literate programming editor - can import sources in many languages, and break them down into classes/methods/functions.
    You then have ability to create all manner of 'views' of the code.

    --
    -- In the beginning was the WORD, and the WORD was UNSIGNED, and the main(){} was without form and void...
  46. Universal advise by ceeam · · Score: 2, Funny

    Just rewrite it. Reading others' code is for wimps.

  47. Re: Pretty Printer by Poltras · · Score: 1

    a2ps already sends to default player if you don't specify the -o tag :) Just so you save 20-30 characters.

  48. Wrong way, use debugegr by cerberusss · · Score: 1

    You're doing this the wrong way. Pouring over code is very useful, but doesn't show you the layering. So, whip up trusty old gdb, set a breakpoint and run the damn code. Then use the step and next commands and just see where this leads you.

    --
    8 of 13 people found this answer helpful. Did you?
  49. Nedit by ishmalius · · Score: 1

    Any editor with good syntax highlighting would probably give you most of what you want. Nedit has long been my favorite. Simple, light, and with (last time I counted) 28 grammars.

  50. I like G by ananamouse · · Score: 0

    I bleed to National instruments so that I can use thier graphical programming language. If anyone knows an alternative pipe up.

  51. For PHP use PHPXref. by zuffy · · Score: 1

    http://phpxref.sourceforge.net/PHPXref is a great tool which builds an HTML-based outline of your source code. It's been an indespensible tool for working on a very large project, http://www.moodle.org/Moodle), especially when getting my hands dirty with a new section of code I haven't used yet as it makes following an execution path very easy to do.

    From the site description:
            * Minimal requirements, minimal setup.
            * No web server required to view output.
            * Cross-references PHP classes, functions, variables, constants and require/include usage.
            * Extracts phpdoc style documentation from source files.
            * Javascript enhanced output provides:
                        o Mouse-over information for classes and functions in the source view.
                        o Hot-jump to the source of any class/function definition.
                        o Instant lookup of classes, functions, constants and tables by name.
                        o Search/lookup history.
            * Pretty-prints PHP files from the browser.
            * Stays crunchy in milk.

    --
    {justin.filip | jfilip AT gmail DOT com} {http://jfilip.ca/}
  52. Not *browsing* but *understanding* by PurplePhase · · Score: 3, Interesting

    Unfortunately the story poster was a bit vague. They could mean that they or the person assigned don't read code, yet they need to know how a program works, or what it does. There are many times when you don't want to or cannot run/debug a program to analyze it.

    There have been many links posted which I'm going to have to explore - not the editor links (jEdit and Emacs rulz!) but the conceptualization links. Unfortunately most if not all IDEs are still code-file based. The most prominent other tool for project conceptualization is UML which has been gaining IDE integration. Yet there are still a couple problems with that:

    1. The UML usually generates accurate structures for classes, but doesn't or cannot generate execution diagrams (what, 4 types in UML?) or state diagrams.

    2. These static diagrams represent only the level of the code instead of being an interactive object with drill-downs or abstract-up commands!

    To understand a new set of code or codebase, I need something that analyzes the code and reports back to me on its tactics and strategies - what patterns are used, what weaknesses are in the code, ... Current tools give you unuseful amounts like cyclomatic complexity, or other ratings like test coverage or Fowler's class interdepence/brittleness/(whatever) measure. However those things are useful to me only: if you know nothing about code, have any resources to plug testing holes, or are actively managing a codebase, respectively. None of them say what the code *does* or how it does it. So we need something that covers concerns orthogonal to what already exists.

    Which makes me more curious about the comment asking if anyone uses the tools researchers are working on for visualizing a project. I haven't kept up on academics - where do I start looking? And is there anything there with demos, products available, or in post-beta releases?

    8-PP

  53. ConTEXT by jbrannon · · Score: 1

    On Windows, I use ConTEXT (http://www.context.cx/) extensively. It has built-in syntax highlighting for several languages, and you can download highlighters for hundreds more. Also, it usually takes well under a second for it to startup (uncached).
    Plus it's free, which you can't beat (OK, OK, maybe with open source...).

    1. Re:ConTEXT by Anonymous Coward · · Score: 0

      I hoping I would see some ConTEXT love here. I second that, I use ConTEXT exclusively, for everything I do that requires text editing.

      ConTEXT will also ask you if you want to replace Notepad, which creates a new notepad.exe (after backing up your original), and then all calls to notepad.exe open ConTEXT instead. Good for those stubborn hard-coded programs.

      There is also going to be a new version this summer, it's been a little while since the current version was released.

  54. Re:Well... by hatrisc · · Score: 1

    pico? pico? nano man!!!

    --
    I write code.
  55. Source Navigator by avdi · · Score: 2, Informative

    Source Navigator is the perhaps the most amazingly useful freebie I've ever downloaded. It's absolutely indispensible for making sense of large C/C++ codebases (and it has some support for other languages too). The cross-referencing ability is particularly useful; it's great to be able to call up a graphical call-tree of any function.

    --

    --
    CPAN rules. - Guido van Rossum
  56. jGRASP by Khelder · · Score: 1

    For pretty-printing Java, I like jGRASP. It draws outlining-type lines to the left of the code to show nesting and control structures. I always use it to print code for code reviews. It can generate class diagrams, too, but I haven't used that feature.

  57. My choice by idontgno · · Score: 2, Insightful
    Which tools do you prefer to use for browsing and studying source code?

    14-inch greenbar, preferably printing on a color-capable impact printer.

    Wide continuous paper, plus a large work surface, means I can stretch a module out and mark it up with highlighters and scribble notes. A straightedge and some detective work means I can verify "indentation" levels (code nesting).

    Of course, run a source code beautifier over it first.

    Why, yes, I am old; how did you guess?

    --
    Welcome to the Panopticon. Used to be a prison, now it's your home.
  58. Emacs Code Browser and JDEE by tjwhaynes · · Score: 1
    I'm amazed that no one has mentioned the Emacs Code Browser. This includes a whole bunch of code analysis tools, including semantic parsing for intellisense-like completion, directory views, etc. It hooks up with Speedbar to make browsing easier and can mark up and index the code to identify functions/methods. It can be found at ECB at sourceforget.net. It's built on top of the Collection of Emacs Development Environment Tools.

    Also worth mentioning (and related) is the Java Development Environment for Emacs, which makes analysing and traversing a large Java project a whole lot easier, with integrated class management, wizards, skeletons for creating classes and javadoc comments. You can get JDEE from its homepage.

    Cheers,
    Toby Haynes

    --
    Anything I post is strictly my own thoughts and doesn't necessarily have anything to do with the opinions of IBM.
  59. Codewalker for Perl CGI by hughbar · · Score: 1

    Since the original post said 'understand' and 'other languages', I'd just say, I've started a project for untangling legacy Perl CGI and writing the call graphs (via dot etc.) out as svg diagrams. The code is young and messy but has started to work. It's at http://sourceforge.net/projects/codewalker/.

    --
    On y va, qui mal y pense!
  60. In the UNIX world I use four tools: by Richard+Steiner · · Score: 1

    (1) NEdit combined with exuberant ctags.
    (2) Red Hat's SourceNavigator.
    (3) GNU Global to generate a nice clickable HTML version of a source tree.

    I used to also use CSCOPE, but I can't fine Solaris/Sparc binaries which don't require root access to install (pkg format isn't helpful for me -- I'm just a developer on the box, not an admin).

    On the mainframe side, I usually use a combination of FINDREF, IACULL, and CULL, which together form a sort of superpowered CSCOPE, but I'm not aware of a similar tool in the UNIX world other than things like CSCOPE (which are useful but rather basic in functionality).

    --
    Mainframe/UNIX Bit Twiddler and long time Windows/Linux Hobbyist.
    The Theorem Theorem: If If, Then Then.
  61. Re:Well... by after+fallout · · Score: 1

    yeah, nano is so much better than pico!

    (I have never noticed a difference, but then again all I use nano for is to make small changes to xorg.conf when I screw something up)

  62. Old School... by mengel · · Score: 1
    Well, I sound like Sid from User Friendly, but...

    If you really want to read some code, print it with a good old fashioned chain printer on green bar paper formatted with "pr" for page numbers, and get a set of colored highlighters to mark useful things.

    For code you want to browse through, hack up a little perl script that gives you page number references for each symbol and subroutine/function/method, and print that out on a separate stack.

    Go sit somewhere nice where you can relax, flip through your stack of green bar and sip your favorite caffiene, and life is good.

    --
    - "History shows again and again how nature points out the folly of men" -- Blue Oyster Cult, 'Godzilla'
  63. Re:Well... by hatrisc · · Score: 1

    I'm an emacs user. The reason I "corrected" pico was that it's not free. nano is a free replacement for it.

    --
    I write code.
  64. If it's not already understandable... by bill_kress · · Score: 1

    You've already got a problem. I would recommend starting to document and refactor the code yourself. Ensure that all objects are self-contained, remove inter-object relationships and break complex object down into multiple smaller objects. Document as you go and test constantly. Add tests if they don't already exist so that you know your refactoring didn't hurt anything--remember a refactor is a change that can be proven not to effect anything else in the system, so be meticulous!

    If you are just looking for tools, I often load smaller packages into BlueJ just to get an idea of the layout--BlueJ does a good job of reliably breaking down a bunch of classes and building a UML diagram from them. I understand they will make this part of BlueJ an eclipse plug-in eventually.

  65. No OS X version, FYI by Blakey+Rat · · Score: 1

    I emailed them about OS X support, and they replied that they have an OS X version in beta, but won't be ready to release until late this year.

    Just FYI for anybody else looking into it.

  66. $EDITOR by Sloppy · · Score: 1
    the key thing here is _browsing_, not _development_
    The best tools for understanding my own code, are also the best tools for understanding someone else's.
    --
    As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
  67. cscope and Source Navigator by dcd · · Score: 1

    I use cscope (and vi) as they are both curses based. Vim has a cscope mode too!
    I am surprised though that there wasn't a mention of Source Navigator http://sourcenav.sourceforge.net/

    What is Source-Navigator?:
    Source-Navigator is a source code analysis tool. With it, you can edit your source code, display relationships between classes and functions and members, and display call trees.

    1. Re:cscope and Source Navigator by dcd · · Score: 1

      Well, there were some comments w.r.t. snav, but I didn't see them because I often read at level 4.
      There weren't that many comments, and the worse that was said was it used TCL :-)

  68. My favorite tool for the job by Anonymous Coward · · Score: 0

    My favorite tool for the job is Source Insight.

    It's a bit ugly (compared to, say, Visual Studio), but has plenty of useful features, including extensive searching capabilities, most importantly including the "search for cross-references" option. Also, a good idea there (that was copied in Visual Studio 2005) is the lower-pane. The window has a lower pane which also displays code, and it displays the last item you selected - e.g. some function has a variable which is a struct, you click on the struct, and the lower pane jumps to the definition of the struct. Same thing for functions, macros, and just about anything.

    Another great feature is the ability to highlight any identifier. Have a big function, and you just want to trace through the value of a single variable to a certain point in the function? simple - highlight it, and every access to it is clearly visible.

    Another significant feature I can think of is symbol browsing - say you want to jump to the function 'record_read', a single key away from you is the global symbol browsing menu, which includes all the global symbols the the source tree, and lets you do simple, real-time searching (by the time you finish typing 'record', only symbols with the word 'record' in them will appear).

    The little things also make a difference - for example, the symbol browser knows naming conventions (if you type 'read_record', the results will contain 'record_read', and even if you type 'readRecord', or 'RecordRead'), and tiny things like the fact that the size of parthenses changes according to the nesting level (the outermost are larger), so it's really easy to see at a glance what fits where.

    All-in-all, a great tool. Just give it a try.

  69. Try Agent Ransack (freeware) by Anonymous Coward · · Score: 1, Informative

    There's a useful product called Agent Ransack that I use all the time to search through source code either for variable/member references or for common coding errors (e.g. '=' instead of '=='). http://www.mythicsoft.com/agentransack. Also supports regular expressions.

  70. codewright calls it by mann3r · · Score: 1

    as you are looking for code browsing, codewright makes your life easier. Source code highlighting and comments that you can see distinction. searching for some object that calls for some class can be easily find. it is you call anyway

    --
    http://www.allseocontest.com http://www.seoremake.com
  71. Source-Navigator by Anonymous Coward · · Score: 0

    Try Source-Navigator - A former Red Hat product, it's open source and supports a host of programming languages including C++, runs on Windows or Linux (etc. etc.) - and it's fast as well.

  72. !tools by sohp · · Score: 1

    While having tools to assist in the actual task of navigating through the codebase is important, a firm handle on the HOW is more critical.

    http://c2.com/cgi/wiki?TipsForReadingCode
    "Comprehension and Visualisation of Object-Oriented Code for Inspections" http://www.cis.strath.ac.uk/research/efocs/abstrac ts.html#EFoCS-33-98 section 5.
    Demeyer, Serge. Ducasse, Stephane. Nierstrasz, Oscar. Object Oriented Reengineering Patterns ISBN: 1558606394
    Feathers, Michael. Working Effectively with Legacy Code ISBN: 0131177052
    Glass, Robert L. Facts and Fallacies of Software Engineering, section in Chapter 2 on Maintenance ISBN: 0321117425
    Spinellis, Diomidis. Code Reading: The Open Source Perspective ISBN: 0201799405

  73. UndoDB by greglaw99 · · Score: 1

    And you can now use UndoDB -- extends gdb to enable you to step the code backwards as well as forwards. Great if you want to know how a particular piece fits in to the bigger picture. Also means no more "oops - I stepped too far; start again", which is nice.