Dynamic component inheritance

Hi,

I have a component, say Person.cfc. From time to time, I make updates to
this component so I create PersonV1.cfc, PersonV2.cfc, … And for
consistency, I just make Person.cfc be an empty component that extends the
relevant version.

Person.cfc

This way, if I need to change the version, I just change where Person.cfc
points to.

My question: is there a way to make the extension dynamic? I can’t do
as it gives me the
error that the attributes of need to be literal string. I
would like to be able to do this so that when I deploy this component in
multiple applications, I can easily specify the version for each
application without having different versions of Person.cfc. Is this
possible?

Thanks,
ML

I think your versioning strategy is wrong here. You don’t change the name
of the file, you just release a new version of it with the same name.
Depending on the situation you might release a replacement Person.cfc, or
you might release a new version of the app. You shold
read http://semver.org/ (and perhaps
even https://en.wikipedia.org/wiki/Software_versioning). The version of the
software is not reflected in the names of the classes in the application,
“generally”.

If your application needs PersonV1 and PersonV2 to co-exist… you need to
rethink your application architecture.

Component inheritance isn’t a tool for versioning, it’s a technique for
defining inherited behaviour.

So, in short… don’t try to do what you’re doing; adopt a more established
pattern for handling the versioning of your code.On Thursday, 21 January 2016 06:07:51 UTC, ML wrote:

Hi,

I have a component, say Person.cfc. From time to time, I make updates to
this component so I create PersonV1.cfc, PersonV2.cfc, … And for
consistency, I just make Person.cfc be an empty component that extends the
relevant version.

Person.cfc

This way, if I need to change the version, I just change where Person.cfc
points to.

My question: is there a way to make the extension dynamic? I can’t do
as it gives me the
error that the attributes of need to be literal string. I
would like to be able to do this so that when I deploy this component in
multiple applications, I can easily specify the version for each
application without having different versions of Person.cfc. Is this
possible?

Thanks,
ML

I totally agree with Adam here. Using inheritance for versioning purposes is a really bad idea!

PaulOp 21 jan. 2016, om 10:28 heeft Adam Cameron <@Adam_Cameron> het volgende geschreven:

I think your versioning strategy is wrong here. You don’t change the name of the file, you just release a new version of it with the same name. Depending on the situation you might release a replacement Person.cfc, or you might release a new version of the app. You shold read http://semver.org/ http://semver.org/ (and perhaps even https://en.wikipedia.org/wiki/Software_versioning https://en.wikipedia.org/wiki/Software_versioning). The version of the software is not reflected in the names of the classes in the application, “generally”.

If your application needs PersonV1 and PersonV2 to co-exist… you need to rethink your application architecture.

Component inheritance isn’t a tool for versioning, it’s a technique for defining inherited behaviour.

So, in short… don’t try to do what you’re doing; adopt a more established pattern for handling the versioning of your code.

On Thursday, 21 January 2016 06:07:51 UTC, ML wrote:
Hi,

I have a component, say Person.cfc. From time to time, I make updates to this component so I create PersonV1.cfc, PersonV2.cfc, … And for consistency, I just make Person.cfc be an empty component that extends the relevant version.

Person.cfc

This way, if I need to change the version, I just change where Person.cfc points to.

My question: is there a way to make the extension dynamic? I can’t do as it gives me the error that the attributes of need to be literal string. I would like to be able to do this so that when I deploy this component in multiple applications, I can easily specify the version for each application without having different versions of Person.cfc. Is this possible?

Thanks,
ML


Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html http://lucee.org/supporters/become-a-supporter.html

You received this message because you are subscribed to the Google Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com mailto:lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com mailto:lucee@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/8516a7c7-3468-4f30-af19-cc6962b0e451%40googlegroups.com https://groups.google.com/d/msgid/lucee/8516a7c7-3468-4f30-af19-cc6962b0e451%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout https://groups.google.com/d/optout.

So it looks like I can use in
Person.cfc and I can set currentVersion to “PersonV2.cfc”. It seems to
work but is it kosher to do so?

One thing that that doesn’t look quite right is the object metadata.

PersonV2.cfc

Person.cfc

personObj = new Person();
writeDump( getMetaData( personObj ) );

I don’t see that Person is an extension of LivingThing. I only see that
Person is an extension of Component. However, I am able to access the
methods of LivingThing from Person, so maybe I shouldn’t care that the
inheritance stack is incorrect?

Any thought would be greatly appreciated.On Thursday, January 21, 2016 at 2:07:51 PM UTC+8, ML wrote:

Hi,

I have a component, say Person.cfc. From time to time, I make updates to
this component so I create PersonV1.cfc, PersonV2.cfc, … And for
consistency, I just make Person.cfc be an empty component that extends the
relevant version.

Person.cfc

This way, if I need to change the version, I just change where Person.cfc
points to.

My question: is there a way to make the extension dynamic? I can’t do
as it gives me the
error that the attributes of need to be literal string. I
would like to be able to do this so that when I deploy this component in
multiple applications, I can easily specify the version for each
application without having different versions of Person.cfc. Is this
possible?

Thanks,
ML

Ok. Thanks you two for the advice.

MLOn Thursday, January 21, 2016 at 5:46:10 PM UTC+8, Paul Klinkenberg wrote:

I totally agree with Adam here. Using inheritance for versioning purposes
is a really bad idea!

Paul

Op 21 jan. 2016, om 10:28 heeft Adam Cameron <camero...@gmail.com <javascript:>> het volgende geschreven:

I think your versioning strategy is wrong here. You don’t change the name
of the file, you just release a new version of it with the same name.
Depending on the situation you might release a replacement Person.cfc, or
you might release a new version of the app. You shold read
http://semver.org/ (and perhaps even
https://en.wikipedia.org/wiki/Software_versioning). The version of the
software is not reflected in the names of the classes in the application,
“generally”.

If your application needs PersonV1 and PersonV2 to co-exist… you need to
rethink your application architecture.

Component inheritance isn’t a tool for versioning, it’s a technique for
defining inherited behaviour.

So, in short… don’t try to do what you’re doing; adopt a more
established pattern for handling the versioning of your code.

On Thursday, 21 January 2016 06:07:51 UTC, ML wrote:

Hi,

I have a component, say Person.cfc. From time to time, I make updates to
this component so I create PersonV1.cfc, PersonV2.cfc, … And for
consistency, I just make Person.cfc be an empty component that extends the
relevant version.

Person.cfc

This way, if I need to change the version, I just change where Person.cfc
points to.

My question: is there a way to make the extension dynamic? I can’t do
as it gives me the
error that the attributes of need to be literal string. I
would like to be able to do this so that when I deploy this component in
multiple applications, I can easily specify the version for each
application without having different versions of Person.cfc. Is this
possible?

Thanks,
ML


Love Lucee? Become a supporter and be part of the Lucee project today! -
http://lucee.org/supporters/become-a-supporter.html

You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+un...@googlegroups.com <javascript:>.
To post to this group, send email to lu...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/8516a7c7-3468-4f30-af19-cc6962b0e451%40googlegroups.com
https://groups.google.com/d/msgid/lucee/8516a7c7-3468-4f30-af19-cc6962b0e451%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.