A minor alteration of generated code

0 views
Skip to first unread message

cvokk

unread,
Apr 6, 2008, 5:53:26 AM4/6/08
to Php Object Generator
Good day.
At first I want to thank you again for a great work you did with POG
so far, I had really good time using the objects.

I would like to propose you, however, two little hints for your code
generation strategy, which could be a lot helpful.
----------------------------------------------
1) when generating comments for GetParent() method, currently the
coment is generated in a following way:

/**
* Associates the User object to this one
* @return boolean
*/
function GetUser()
{

Would it be possible for you to change the generated comment to the
following

/**
* Associates the User object to this one
* @return User
*/
function GetUser()
{

instead of "boolean" put there the class name. It would make a great
help for people using Eclipse or other editors, which respect those
comments. Then, when you would do
$obj = new SomeObject();
$obj->GetUser()-> <----- in this part, when there is @return User
comment, the IDE would offer you methods and fields of the User class,
which I think is nice improvement.
Now what I do is manually edit the class files when I need this
functionality, would it be any problem if you change it in the
generator?


----------------------------------------------

2) it would be nice, if POG_Base would implement some common
interface, say PogObject, which would define
Get, GetList, Save, SaveNew, Delete, DeleteList methods.

The point is, that you could than in PHP force the method parameter to
be of this interface type, e.g.

class UtilClass{
public method someMethod(PogObject $obj){
// here in this method you could again do
$obj-> <------- and again, here IDE would offer you one of the
defined methods in the interface
}
}

What I do now is
public method someMethod(POG_Base $obj){
}

to at least be sure, that $obj is POG object instance, but interface
would be much nicer.


What do you think about all that?

Wish you a nice day.

Kind regards Vitek

cvokk

unread,
Apr 9, 2008, 3:55:23 AM4/9/08
to Php Object Generator
Or if I can edit the code and supply a patch, it will be a pleasure
for me.

Regards Vitek

Joel

unread,
Apr 9, 2008, 10:47:03 AM4/9/08
to Php Object Generator
Hi Vitek

1) agreed, the comments should be changed. We can discuss adding you
to the svn repo commit list so that you can make other changes in the
future. (Mark can handle this)

2) Good suggestion, though that's not a trivial change. We need at
some point to phase out php4 support so, at that point, implementing
an interface would be nice, but up to now, we chose to support php4.
This will probably need some offline discussion.


regards,
Joel

cvokk

unread,
Apr 10, 2008, 4:19:47 AM4/10/08
to Php Object Generator
Hi Joel,
ad 1) that would be nice

ad 2) I see. But my first thought as a reaction is, that when
generating the code, there is a select box for the PHP version and we
could then change the generated code according to version selected.

Have a nice day.
Vitek

Althought I have not studied the code deeply, couldn't we decide
whether or not pass be the interface implementation done only for the
PHP 5? The code generated for PHP 4 would stay untouched.

Crispy

unread,
Apr 10, 2008, 9:54:29 PM4/10/08
to Php Object Generator
Hi Vitek,

For the comment thing, If you prefer to send me a patch, I will apply
it.

-Mark
Reply all
Reply to author
Forward
0 new messages