RSSThe TSW Blog

Navigating your code with phpCoder 2008

January 14, 2008

Whenever your project reaches a certain level of complexity, navigating the code can be a very time consuming task. For instance, you may using a function in one file, but it's actually declared in another file. This makes sense with PHP, because include files makes it easy to re-use your functions and classes in many files. But what do you do when you need to have a look at how this MagicStuffWillHappenWhenYouCallMe() function actually works? Remembering where it's declared, opening the file and searching for the function is painfully slow, and if your project is just a tad bit more complicated than 3 files using the same functions.php, you will soon be using more time navigating your code than writing it!

TSW phpCoder 2008 comes with two functions that should help you a lot when navigating code. "Navigate to" and "Find all references to". They are both based on the same parsing engine that brings you PHP IntelliSense, giving them the huge advantage of actually being context-sensitive. For instance, you may have two functions with the same name, but one of them belongs to a class - if you make a reference search for the class member, the stand-alone function won't show up in the results, because phpCoder knows the difference from looking at the parsed documents.

This functionality really took a long time to implement, with lots of little details needing attention, but I hope that you will think it was worth the extra wait, once you see the video of it in action :). Please remember that while the example code/files used in the video are very simple, this works just as well on big projects with many files!

Click to see a video of how code navigation works in TSW phpCoder 2008

Please let me know what you think of it. I really appreciate your feedback :)

Kasper (TSW) @ 12:32 pm in Uncategorized —

21 Responses to “Navigating your code with phpCoder 2008”

  1. YeLL says:

    Do I really need to comment this ? Naaa, I think not !

    See my others posts to know my opinion on this software !

  2. Kasper (TSW) says:

    Comments are always needed – they keep me going! :)

  3. YeLL says:

    Ok, so there is a comment with a lot of suggestions :

    GREAAAAAAAAAAAAAAAAAAAAAAAAAATT !

    I love what you do ! (If I was a girl, I would certainly like to mary you :o ) :D

  4. Codeamatic says:

    Keep’em comin Kasper. This could be the best thing since oxygen…now only if it could cook, clean and change the tv channel…

  5. YeLL says:

    Finally, maybe I’ll not buy your software right after it’ll be available :( I just lose my job … this morning :(

    But you can always count on me to “betatest” it when the beta will be released.

    Sorry :(

  6. Kasper (TSW) says:

    Thank you guys :)

    YeLL, I’m very sorry to hear about your job! :(
    Be sure to be an active betatester, I will be giving away free licenses to the most active testers this time as well :)

  7. YeLL says:

    Great news… I’ll be, for sure :) But I’ll buy it nevertheless when it’ll possible for me ;) (If it suit to me :D But I’m sure it will ! )

    When do you plan to release another erotica videos of phpCoder2008 ? I love these to hold on… ^^

  8. Kasper (TSW) says:

    I don’t think that there will be any more videos for now – after all, a real beta version might be better, don’t you think? ;)

  9. Lewis says:

    How does this work with embedded classes? For example a lot of frameworks have built-in class loaders, so a class is loaded by doing: $this->load->lclass(‘classname’); which will load classname or maybe even class_classname. I know this is a tricky one, but isn’t there some way of using comments in the loader function. Eg.

    /*
    @load: $this->myclass myclass_class
    */
    $this->load->lclass(‘myclass’);

    and then it knows that $this->myclass contains the class instance myclass_class. Or even if it was possible to define REGEXP patterns so it can do it automatically that would be even better.

  10. Kasper (TSW) says:

    Hi Lewis,

    Could you possibly provide me with a more detailed example, preferably with some explanation? Right now I’m not quite sure what you mean, or at least not how “your” code works :). What exactly are you trying to accomplish? Documentation or..?

  11. Lewis says:

    Basically take CodeIgniter for example, and how it loads models:

    http://codeigniter.com/user_guide/general/models.html#loading

    How will the intellisense work with something like:

    $this->load->model(‘Model_name’);

    $this->Model_name->function();

    Because it uses a function to dynamically load the class Model_name, how will it know that class Model_name is?

  12. Kasper (TSW) says:

    Okay, I see. No, phpCoder won’t understand that. Perhaps the solution is something with comments, as you have suggested. I will have to look into that :)

  13. Lewis says:

    Yeah it’s a tough one, and with frameworks and MVC becoming more and more popular it’s something that a lot of people are demanding.

  14. Kasper (TSW) says:

    I see. Unfortunately, the application would have to be humanly intelligent to understand something like that. The only real solution is a hack like the one with the comments, and it’s not a very nice one :(

  15. YeLL says:

    The other solution is something like a configuration tool for this.

    Example :

    Config – Class loading method :
    User entry >> MyMVC::loadClass($name$)

    Config – File loaded :
    User entry >> /mvc/classes/$name$.class.php

    So, when we use MyMVC::loadClas(‘myClass’);
    phpCoder could parse the file /mvc/classes/myClass.class.php

  16. Lewis says:

    Yeah that’s what I meant by being able to use REGEXP to define the patterns automatically. Your version is easier than pure REGEXP, but also needs to include where the class is then stored, eg.,

    Config – Defined to :
    User entry >> $this->$name$

  17. Mike says:

    Ok!!!!! I’m sold!!!

    When do we get our hands on a version? I feel like i’m going through with drawel. (Not that I have any idea what that’s like, you understand :)

    Am using another piece of software right now but keep checking back and seeing the vids and thinking. Pleeeeaaaasssse let me play. :)

  18. Kasper (TSW) says:

    Thank you for the kind words, Mike. Don’t worry, the beta version will be here really soon. I do hate giving dates, but I think you can expect it to be released within the next week or so :)

  19. YeLL says:

    Great :)

  20. Adam Moore says:

    This looks like a great program and a great fit in my work. I have a couple of things I would like to see that I miss in TSWebPad.NET

    Support for SVN and/or CVS. Especially since I work on numerous OpenSource projects I would like to manage my projects using one tool.

    Support for sftp connections and scp connections.

    Looking forward to the beta version.

  21. Kasper (TSW) says:

    Hi Adam,

    Since I’m not using CVS or SVN, I’m not quite sure which kind of support you would like in an editor, and how it should work? Details would be great :)

    SFTP support has been added, and seems to be working rather nice. Check it out your self once the beta arrives :)

Leave a Reply