[TYPO3-50-general] Feature request: Running different versions of a class in parallel
Ernesto Baschny [cron IT]
ernst at cron-it.de
Thu Oct 18 19:40:42 CEST 2007
Elmar Hinz wrote: on 18.10.2007 17:18:
>>> I want to come up with a feature request for v5. Maybe it's already
>>> planned, maybe it's an inbuild feature of PHP6.
>>> Today one of the big issues with TYPO3 is backward compatibility. Once a
>>> class has an API and a behaviour, you can't simply optimize it, because
>>> of the dependent classes. You can extend it, but you can't freely change
>> The idea of having a clear interface is exactly that you are able to
>> optimize the "inner workings". You just don't change the interface.
> let's assume we have a kind "fetchmail" service. The extension key
> is "fetch". There is a class "fetcher". The old version implements
> interface "fetcherInterface1", the new version the "fetcherInterface2.
> The maintainer removes the old interface not to have additional work.
> We have two other extensions. One depends on "feetcherInterface1" the other
> on "feetcherInterface2".
> How does it work? How can we use the old and the new fetcher extensions in
This is the job of the factory which should get the right implementation
at hand for the requested feature. If there are implementations
available for different interface versions, it should be possible to get
the "right one".
If the maintainer decides to "removes" the old interface, you could say
"ok, I will do it myself", create an "fetch1" extension which implements
the "fetcherInterface1" so that extensions which require this interface
will start working again, because the factory will be able to provide
you with that "old" implementation (which could under the hood just use
the new implementation, sort of a bridge to the new interface).
In this solution, you don't really need the maintainer of the original
extension to provide all "old" interfaces. Important for this to work is
not to make interface names bound to the extensions name.
In the ideal world we have interfaces which doesn't need to be modified,
only "enhanced" (optimized, new features added), because they are well
designed from the start. :)
More information about the TYPO3-project-5_0-general