Closed ridoo closed 10 years ago
this is a design choice. The connectors are not created unneccisarily. The virtual mechanism of a connector is used to query its capabilities. As long as the constructor is leightweight ( as they are now) this is not a problem. There are other solutions possible but they all lead to more code and questionable conceptual value.
Currently the ConnectorFactory::explorersForResource() creates a connector explorer for each
Resource
available to check if it can be used. Performance at this part will be very important especially when more and more resources become available during startup (imagine a stored Ilwis session reloading lots of resources from disk/database/remote services).Besides the fact this brute force method is highly imperformant it also enforces developers to keep their constructors clean. When something is implemented in the constructor it will be executed every time a resource is being checked even if it can't be used by the connector. This could be communicated in a best practice, though, but I still think that this is bad practice as this behaviour is more or less hidden to the developer.