大家都用什么工具看代码?

我现在用的是source insight3.5,不过对php不是很支持,虽然si3.5内置了编辑语言,但我不知道怎么改。

搜到了一个国外的帖子,也是讨论read code tools的,

Posted by Cliff on Sun Dec 26, '04 04:59 PM
from the how-to-achieve-code-nirvana dept.
patonw asks: "I just started working for a company as a programmer on a project with a huge existing codebase. The person hiring me half-jokingly said that it usually takes new employees two years before they understand the system. What I am looking for is not just an editor/browser but a program that displays functions and classes as connected graphs -- preferably free. I would like to view how programs are structured by function calls and class relations. I have access to several different kinds of platforms/operating systems."

<script language="JAVASCRIPT" type="text/javascript"> &lt;!-- document.write("&lt;iframe style='{background-color: #FFFFFF }' type='content' id='6' name='pos6' SRC='http://ads.osdn.com/?ad_id=7469&amp;alloc_id=16477&amp;site_id=1&amp;request_id=6850295' width='336' height='280' frameborder='0' border='0' MARGINWIDTH='0' MARGINHEIGHT='0' SCROLLING='no'&gt;&lt;/iframe&gt;"); //--&gt; </script> id="6" style="BACKGROUND-COLOR: #ffffff" border="0" name="pos6" marginwidth="0" marginheight="0" src="http://ads.osdn.com/?ad_id=7469&alloc_id=16477&site_id=1&request_id=6850295" frameborder="0" width="336" scrolling="no" height="280" type="content"> <script language="javascript" type="text/javascript"> Ads_kid=0;Ads_bid=0;Ads_xl=0;Ads_yl=0;Ads_xp='';Ads_yp='';Ads_xp1='';Ads_yp1=''; Ads_par='';Ads_cnturl=''; Ads_prf='page=article'; Ads_channels='RON_P6_IMU'; Ads_wrd='programming,askslashdot'; </script><script language="javascript" src="http://a.as-us.falkag.net/dat/njf/104/slashdot/askslashdot_p6_middle_rectangle.js" type="text/javascript"> </script>

 

 
Slashdot Log In
Nickname:

Password:

Public Terminal

[ Create a new account ]

Related Links
· Review IT Products
· Review Programming Products
· Compare prices
· Compare prices on Programming Tools
· More Programming stories
· More Ask Slashdot stories
 
 
This discussion has been archived. No new comments can be posted.
Source Code Browsers? | Log in/Create an Account | Top | 67 comments | Search Discussion
Threshold:
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
KDevelop can help (Score:1)
by Zoko Siman (585929) * <zoko@case.gmail@com> on Sunday December 26, @05:22PM (#11186461)
(http://www.hippie-geek.net/)
If it's a c++ project KDevelop will show you a list of functions and classes and what files they're in. Things of that nature. Try it out, it's free.
    Source Navigator (Score:5, Informative)
    by IYagami (136831) on Sunday December 26, @05:25PM (#11186472)
    Sponsored by RedHat:

    http://sourcenav.sourceforge.net/

    From the FAQ:
    Source-Navigator supports C, C++, Java, Tcl, [incr Tcl], FORTRAN and COBOL, and provides and SDK so that you can write your own parsers.

    Use Source-Navigator to:

            * Analyze how a change will effect external source modules.
            * Find every place in your code where a given function is called.
            * Find each file that includes a given header file.
            * Use the grep tool to search for a given string in all your source files.
    Doxygen (Score:3, Informative)
    by Tersevs (168108) on Sunday December 26, @05:28PM (#11186490)
    (http://tersevs.tripod.com/)
    I havnt heard about any free source browsing programs... But I've been using Doxygen to generate HTML documentation of the source when I need to familliarize myself to new code. Definitions in the documentation will be hypertext linkes and there are class inheritance graphs generated. What's missing is really some kind of call-tree but you cant have everything. Doxygen also extract JavaDoc comments from C++ code and insert them into the HTML-documentation.
     
    Doxygen can also generate LaTeX, and RTF files instead of HTML.
      Doxygen for C++ / C etc (Score:4, Informative)
      by ssclift (97988) on Sunday December 26, @05:29PM (#11186496)

      Doxygen [doxygen.org] is a good choice for C++, C, Java, Objective-C, IDL... I used it to get into a ~50K line project a few years ago and have used it regularly whenever I'm forced to use C++... Get Graphviz [att.com] as well so Doxygen can draw pretty pictures for you.

      Doxygen (Score:5, Informative)
      by DeadMeat (TM) (233768) on Sunday December 26, @05:30PM (#11186504)
      (http://slashdot.org/)
      Doxygen [doxygen.org] can use Graphviz [graphviz.org] to generate class and call graphs for several different languages. It helps to have Doxygen or Javadoc annotations in the code, but it's not necessary.

      Unfortunately graph generation is pretty slow, but otherwise it's a fantastic tool.

        Meh (Score:4, Insightful)
        by cookiepus (154655) on Sunday December 26, @05:33PM (#11186516)
        (http://snow.prohosting.com/cookiepu/?slash)
        If your codebase is anything like what I've been working with, there's no tools that are going to make your life easier.

        If the code had decent structure, you'd not be asking this question. But it's a mess. And if you display the mess as a tree structure, it's still a mess. The value is limited.

        The best thing I've done is set up etags accross the entire codebase. This way I can at least navigate code easier. But I doubt you will understand anything more from tree graphs.
        • Re:Meh by _flan (Score:3) Sunday December 26, @06:51PM
        • 1 reply beneath your current threshold.
        Debug (Score:4, Insightful)
        by rmull (26174) on Sunday December 26, @05:39PM (#11186540)
        (http://www.pair.com/~mullr)
        This is perhaps a tangential answer, but I do much better by going through the code with a debugger and watching things happen. Especially with some of the more compilacated OO stuff, and when the comments are unhelpful or wrong, it can be much more useful than reading the code.
        • Re:Debug by Fizzl (Score:3) Sunday December 26, @06:30PM
          • Re:Debug by Bat_Masterson (Score:2) Sunday December 26, @09:35PM
            • Re:Debug by slapout (Score:1) Monday December 27, @02:49PM
              • Re:Debug by GlassHeart (Score:3) Monday December 27, @04:36PM
                • Re:Debug by AsbestosRush (Score:2) Tuesday December 28, @11:30AM
                SHriMP/Creole, JQuery (Score:4, Informative)
                by Earlybird (56426) <slashdot AT purefiction DOT net> on Sunday December 26, @05:46PM (#11186570)
                (http://byzantine.no/alex/)
                SHriMP [thechiselgroup.org] (screenshot [thechiselgroup.org]):

                • ... designed for visualizing and exploring software architecture and any other information space. SHriMP (Simple Hierarchical Multi-Perspective) is a domain-independent visualization technique designed to enhance how people browse and explore complex information spaces. Among the applications we are actively exploring is the exploration of large software programs, and the understanding of complex knowledge-bases (via the Protégé tool)."

                Currently SHriMP runs both as a standalone application and, using the Creole [thechiselgroup.org] plugin, inside Eclipse [eclipse.org] to augment its existing, extensive code browsing capabilities. There's also a plugin for Protégé [stanford.edu], a Stanford project to build "an ontology editor and a knowledge-base editor" supporting new techologies such as OWL [w3.org].

                While Creole is currently Java-specific, SHriMP is a generic framework for code visualization.

                • JQuery by Earlybird (Score:2) Sunday December 26, @05:51PM
                  • Re:JQuery by bitsformoney (Score:1) Sunday December 26, @08:03PM
                  my favorite code bomb.... (Score:3, Informative)
                  by St. Arbirix (218306) <matthew.townsend@nosPam.gmail.com> on Sunday December 26, @05:52PM (#11186594)
                  (http://www.hotornot.com/r/?eid=BZSRALG&key=VTG | Last Journal: Thursday May 19, @05:05PM)
                  Doxygen [stack.nl] does exactly what you described. See item #2 in the link.

                  If that doesn't work look up programs that will convert to UML. Since you didn't mention it in your question I'll expand: Unified Modeling Language diagrams are a standardized means of describing the relationships between objects in classes. To any Slashdotters out there in college looking to take a software engineering course, you'll be seeing a lot of UML.
                    CAST (Score:1)
                    by drsDobbs (589626) on Sunday December 26, @06:06PM (#11186671)
                    (http://www.fttech.net/)
                    Sometime ago I used Cast for this purpose. I think it's currently called Cast Enlighten (http://www.castsoftware.com/Products/platform/AM S /Enlighten/Features.html [castsoftware.com]. It's a big and complex (and probably costly) product, but it really does the job. It covers lots of languages and it is even able to drill down from e.g. java into Oracle stored procedures.
                      Roll-your-own (Score:2, Informative)
                      by Tablizer (95088) on Sunday December 26, @06:08PM (#11186674)
                      (http://www.geocities.com/tablizer | Last Journal: Saturday March 15, @02:22PM)
                      I tend to roll-my-own code analyzers because each system tends to have a different personality and there are different things to look for. Generally I try to parse the code and log each file, module, and subroutine into a relational database. Then I can query it later as needed. I also may log every variable and and token, filtering out common key-words. This risks over-indexing but is better than under-indexing becase extra tokens are less of a problem than non-indexed tokens. And, one can adjust the indexer to remove the extra ones over time. (Ideally one should parse it using perfect grammar parsers, but that is not always an option, especially with web stuff that mixes multiple languages.)

                      Then I log all tables and columns of the databases (data dictionary). Once all the tables, columns, variables, subroutines, and files are logged in database tables, one can cross-reference it all either batch-wise and/or using ad-hoc queries. It is just regular database stuff at that point, so one is no longer dealing with code text but SQL (but I still like FoxPro for such because of its informal nature). However, it may launch a code viewer to inspect matches.

                      It takes about 3-days to a week to do all this if you have done it before and know your tools, plus future tweaking to make improvements.

                      I have seen commercial tools that do similar things for a lot of money. But to be frank, if someone besides you will be using such a tool and they don't like using SQL, then a commercial product may have a more mature user interface. They also don't bring complaints to you when there are glitches or omissions in the parser.
                           
                      Source Insight (Score:2)
                      by murat (262137) on Sunday December 26, @06:11PM (#11186690)
                      We use "Source Insight" and we are very happy. ;) It's not free, though.
                        --...I know... (Score:1, Informative)
                        by Refrozen (833543) <email.answers@gmail.com> on Sunday December 26, @06:47PM (#11186928)
                        (Last Journal: Friday December 31, @11:59PM)
                        Okay, so this doesn't answer what he was looking for, but the title reminded me of Koders [koders.com]... the search engine sucks, but it's a great idea.
                          Source Navigator (Score:2)
                          by avdi (66548) on Sunday December 26, @06:51PM (#11186957)
                          (http://avdi.org/)
                          I second the recommendation for Source Navigator. It's been a a great help to me in comprehending legacy codebases.
                            For PHP try this... (Score:4, Informative)
                            by todsandberg (655653) on Sunday December 26, @07:57PM (#11187487)
                            (http://www.sandboxdesigns.com/)
                            PHPXRef: PHP Cross Referencing Documentation Generator
                            http://phpxref.sourceforge.net/ [sourceforge.net]
                              lxr (Score:4, Informative)
                              by hitchhacker (122525) on Sunday December 26, @08:25PM (#11187739)
                              (http://www.debatepoint.com/)

                              how about LXR? [sourceforge.net]

                              I've been using it to browse linux source code lately: here [linux.no]

                              from the site:
                              A general purpose source code indexer and cross-referencer that provides web-based browsing of source code with links to the definition and usage of any identifier. Supports multiple languages.

                              except for lack of syntax hilighting, it works well.

                              -metric
                              • Re:lxr by brondsem (Score:2) Monday December 27, @01:25AM
                                It takes a *long* time to learn large systems. (Score:4, Insightful)
                                by Richard Steiner (1585) <rsteiner@visi.com> on Sunday December 26, @08:57PM (#11187977)
                                (http://www.visi.com/~rsteiner | Last Journal: Wednesday April 16, @09:53AM)
                                I worked on the flight operations system for a large airline for over eight years (actually ten if you count my contractor time), and I only learned the intimate details of perhaps 20% of it bu the time I'd left.

                                Complex applications require a huge amount of specialized knowledge in order to understand, and most of that knowledge relates to the application or work process itself, not the technical environment...
                                  KCachegrind... (Score:3, Interesting)
                                  by dmayle (200765) * on Sunday December 26, @10:52PM (#11188603)
                                  Here's one that no one else probably thought of. If the software runs on linux, load it up in valgrind with the calltree tool, use it a little, and look at the kcachegrind visualizations. It'll give you an idea of what code is actually used, and how it's interrelated.
                                    Emacs Code Browser (Score:1)
                                    by shapr (723522) on Sunday December 26, @11:33PM (#11188809)
                                    (http://www.scannedinavian.com/ | Last Journal: Thursday April 28, @06:48PM)
                                    I like Emacs Code Browser [sourceforge.net], it's fast, featureful, and it deals with a bunch of different languages, see the screenshots [sourceforge.net]
                                    Of course, if you don't use emacs, it won't be nearly as handy.
                                    • 1 reply beneath your current threshold.
                                    Look on sweetcode.org (Score:1)
                                    by Farq Fenderson (135583) on Monday December 27, @02:49AM (#11189630)
                                    (http://farq.lisachant.net/)
                                    I've written a few in Perl for quick breakdowns. No graphing, but the equivalent textual information. I recall seeing a few projects of a similar nature on sweetcode, with graphing (3D?) unfortunately I don't recall what they might have been called.
                                      someone had to say it... (Score:2)
                                      by loony (37622) on Monday December 27, @02:53AM (#11189641)
                                      (http://www.dealrover.com/)
                                      find, grep and vi is all you need! :-)
                                      Cscope (Score:3, Informative)
                                      by Anonymous Coward on Monday December 27, @03:01AM (#11189671)
                                      I can't believe nobody has mentioned cscope [sourceforge.net] yet. We used that in the multi-million line project I worked on until a couple of years ago. My division was only responsible for a few hundred thousand lines of code with a relatively well defined interface, so we generally kept our own cscope subset (Hint: cscope has an option to cache its results, and I highly recommend doing that if your project is more than a few thousand lines). I never actually had to use cscope for the entire source tree, but it worked VERY well for my area of responsibility (several tens of thousands of lines).

                                      In order to stick to the original question, I should also mention that most nontrivial programs end up using dynamic programming styles, and there's no way to graphically display those. I also want to point out is that no source code analyzer is going to do a even a half-assed job at figuring out dynamic relationships, so if your project contains any drivers/vtables/virtual functions, then you're basically S.O.L, and you may as well just use cscope. However, if you really insist on getting a graphical output, check out the free code graphing project [sourceforge.net]. It has a nice picture of the linux kernel [sourceforge.net].
                                      • 1 reply beneath your current threshold.
                                      no call graph, but immensely useful for C (Score:2)
                                      by ChipMonk (711367) on Monday December 27, @03:12AM (#11189691)
                                      CScope, originally developed at AT&T Labs, now under the GPL and available at SourceForge. It works amazingly well on the Linux kernel. I've even tinkered around in the XFree86 code using CScope.

                                      (Also comes with vim integration, if you're into that.)
                                        Source Insight (Score:2)
                                        by atlasheavy (169115) on Monday December 27, @05:53AM (#11190118)
                                        (http://www.brethorsting.com/)
                                        Use it, love it. The UI

                                        • 0
                                          点赞
                                        • 0
                                          收藏
                                          觉得还不错? 一键收藏
                                        • 0
                                          评论
                                        评论
                                        添加红包

                                        请填写红包祝福语或标题

                                        红包个数最小为10个

                                        红包金额最低5元

                                        当前余额3.43前往充值 >
                                        需支付:10.00
                                        成就一亿技术人!
                                        领取后你会自动成为博主和红包主的粉丝 规则
                                        hope_wisdom
                                        发出的红包
                                        实付
                                        使用余额支付
                                        点击重新获取
                                        扫码支付
                                        钱包余额 0

                                        抵扣说明:

                                        1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
                                        2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

                                        余额充值