Instant Reverse PHP

I’m testing out VP-UML v6 build 20070220. I made a simple diagram and generated PHP source code from it. I then Instant Reversed that code to test reverse engineering PHP. The resulting diagram does not show any associations between the classes I created. Reversing other source code had the same issue.

Can VP-UML reverse engineer PHP associations?
Is this feature planned?
Is this a limitation with other languages as well?
Is there some comment I can add to the code to allow VP-UML to read the associations?

thanks,
s

hello s,

Could you post your project file so that we can test the problem?

Best regards,
Jick

I’ve attached two projects. The first, test.vpp, is the project I started with. I created a few classes and relationships and exported PHP code. I noticed that the code does not take advantage of the type hinting available in PHP5, nor are comments added to attributes to suggest their type for programmers or for documentation generators such as phpDocumentor. I assume there is a template for generating the code that can be tweaked, but I haven’t gotten that far yet.

I created the second project to test reverse engineering PHP source code. I imported/reversed the code I exported from the first project with the assumption that VP-UML, like any program, would probably work best on source it generated itself. All the classes import, but the association I created does not show up. The attributes in each class for the association are present, so my assumption is that they would need to be deleted before recreating the association if I wanted to draw it manually.

Thanks for your help,
Scott

Sorry, the attached files didn’t make it past the Preview screen.
test.vpp
testPHPImport.vpp

Hello sssss,

Okay. So I can classify this as two problems:

  1. Missing support for type hinting and comments in instant generator.
  2. Missing support for association in instant reverse

I will check with our engineers and come back to you as soon as possible.

Best regards,
Jick

Hello sssss,

The problem of missing association after running instant reverse seems to be related to the code - The type information is not stored in the code.

I will discuss with our engineers.

Best regards,
Jick

Thanks, Jick. I appreciate it.
I’m happy to comment code any way that would make it possible to reverse. The PHPDoc format, like JavaDoc, seems a natural way to me if that will work.

Hello sssss,

In the next release we will support producing association by reversing PHP code generated from VP. We will add comment to code to help resolving the association.

I will inform you once it is out.

Best regards,
Jick

That’s wonderful!

Is the “next release” a point release that I should expect in a few weeks or a larger release that might take months? I haven’t been watching closely enough to know your release schedule.

Thanks again,
Scott

Hello sssss,

It should be Service Pack 1 that will be available in the next week, hopefully on Monday :slight_smile:

Have a nice weekend!

Best regards,
Jick

Woohoo! You have a good weekend too.

I gave SP1 a quick try just now and had mixed results. It’s certainly better, and it looks like it’s on the right track.

I re-generated code from the test project I posted last time and took a look at it. It does add comments for associations, but not for other attribute types.

I then re-reversed that code into the project I’ve attached. The aggregate, one-to-many association between the Parent and Child classes has been interpreted as two separate one way associations. Additionally, there is an attribute listed in each class for the other. In other words, the original association has become two associations AND two attributes.

Generating code from the reversed project produces code that does not have the association comments. Apparently the redundant attributes over ride the associations with the same names.

I also, as a separate test, reformatted some of the exported code to add some line breaks, because the code uses some kind of character that one of my text editors doesn’t recognize. VP_UML ignored the association comments when I tried reversing the reformatted code. I didn’t remove them, but the whitespace around them changed. Is there some documentation about what comments are interpreted and what their format should be?

Thanks again for your help,
Scott
importTest2.vpp

Any idea when / whether this might be addressed.

Hello Scott,

Sorry for keep you waiting.

As I know our engineers have fixed the first problem. I will let you know once the fix is released.

Concerning the problem that the association comments are being ignored, could you send me some sample files so that we can identify and fix it easier? Thank you in advance!

Best regards,
Jick

I made a new test project and changed the whitespace in the comments. This time the comments worked. It still had the same association problems that it did before, but the comments were not ignored. I guess I changed something more than I thought before - sorry for the confusion.

I’m looking forward to the next release. Thanks.

Hello Scott,

No problem. I will let you know once the release is out.

Best regards,
Jick

hi Scott,

Please perform an update to advance to build 20070316. I suppose this should contain the fix you needed. Please let me know if it works. Thank you.

Best regards,
Jick

One of the problems is fixed. Attributes have comments in the generated code now, and with those comments the instant reverse recognizes the types of those attributes, which is a great help.

I wonder, though, if the comments VP-UML adds are the same as comments you add to other programming languages? I only ask because there is a standard for describing attributes and method parameters. You can read about it here:
http://manual.phpdoc.org/HTMLframesConverter/default/

The bigger issue though, are the relationships between classes. Two of the bigger problems still remain.

  1. An aggregate association generates code with comments, but when reversed, that code creates two independent non-aggregate associations.
  2. That same association, when reversed, is duplicated. An association is created (2 of them as described above), but 2 attributes are also created. The single association becomes two associations and two attributes.

You can test these with the same files I attached before or with any simple relationship. Let me know if you make any progress.

Thanks, Scott

Hello Scott,

We just made another fix. Please run the updater again to advance to the latest release that include the fix, and try again. It should be much better now.

Best regards,
Jick

I did not have a chance to test last week due to some deadlines. I found out just now that my trial license for the standard edition has expired. If there is no way to extend the trial, I’m sorry that I will not be able to provide feedback on this feature.