Static code analyzers (OCLint, Clang...)

Discussion in 'iOS Programming' started by 1458279, Dec 18, 2013.

  1. 1458279 Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #1
    I see there are some code analyzers, but I'm looking for something that will show class structures.

    The ones I see don't seem to offer that and with how long ObjC has been around, I would think someone has written one.

    Given the one that Xcode offers, it should be pretty simple, and I've seen this in other langs.
     
  2. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    It's never occurred to me before that it should be automated... Whenever I've wanted that I've just done it by hand. Normally I do it before I even start writing code - I plan out what my class structures will look like.
     
  3. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #3
    I googled class diagram objective-c

    Two of the first 3 results from Stack Overflow looked pretty good:
    http://stackoverflow.com/questions/...y-generate-uml-diagrams-from-objective-c-code
    Finally found "objc_dep.py" from GitHub. It's free, fast, simple and works as-is. It generates a kind of "dependency graph" based on imports, which really isn't UML or class diagrams, but was surprisingly close enough.


    http://stackoverflow.com/questions/2424362/create-class-diagram-from-already-existent-iphone-code
    Yes, you can use Doxygen:

    Install Doxygen (with MacPorts: sudo port install doxygen).

    Get a script like this and change the first lines to match your configuration.

    Download these files and edit the Doxygen file so it says HAVE_DOT=YES and UML_LOOK=YES.

    It will then generate and install a docset that you can read from the documentation browser, or just right click and show contents from Finder.

    Or, if you want a graph of dependencies check: https://github.com/nst/objc_dep It uses graphviz.


    A little farther down on the first page of results is this:
    http://autograf.sourceforge.net
    AutoGraf is an automatic class diagram (UML) generator for Objective-C. Generated diagrams are rendered using Quartz with transparency, suitable for presentations or print. ...
    Some of the other google results may also be useful.


    If I've misunderstood what you mean by "class structures", then please explain in more detail exactly what kind of output you're looking for. Are you looking for UML? Some other kind of diagram?

    If there's a picture of what you want, or a description, somewhere on the web, then post its URL.

    Please describe what you intend to use the "class structures" for. If it's for documentation, say that. If it's for a presentation, then a different tool might be more suitable.


    What have you tried?

    If you googled, what search terms?

    If you looked at other IDEs or tools, what did you look at? Be specific about their shortcomings.
     
  4. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #4
    I'd like to point out that you're probably googling within your bubble. Other people may get very different results from you. http://dontbubble.us
     
  5. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #5
    You can do the search using duckduckgo, or your search engine of choice.

    My post went from the specific (the google results I got for a specific search) to the more general (what does "class structure" mean, what use the output will be applied to, and what has the OP tried). It was as much an example of how to find things, and a question for clarifying what the OP wants, as it was a list of the specific things I found.

    http://mattgemmell.com/what-have-you-tried/
     
  6. 1458279 thread starter Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #6
    This works well for classes that you create, and that probably covers quite a bit of programming.

    I think what's going on here is that I'm following tutorials and they have their own way of doing things. I probably would have created these classes differently, but I want to complete these tutorials.

    I personally would have made fewer classes, some like to make a bunch of classes and that can be hard to follow sometimes (esp when you didn't write the code :D).

    Kinda funny, I can read my code with no problem, it's trying to get into another programmer's head that gets more challenging :D
     
  7. 1458279 thread starter Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #7
    So it looks like Xcode 3 had this functionality and it was removed from Xcode 4. However, it looks like there's a few older tools that might do the job.

    I'm going to try AutoGraf and see if it still works, it's an older program.
     

Share This Page