Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291161

Things that are not really factories should not be documented as factories

$
0
0

In conjunction with
#1815988: UUID class names violate naming standard
today, I noticed that the base UUID class in core/lib/Drupal/Component/Uuid/Uuid.php is documented as "Factory class for UUIDs".

It isn't actually a factory class though.
http://en.wikipedia.org/wiki/Factory_(software_concept)
A factory is an object for creating other objects. This class isn't one -- it is a class that instantiates one of several back-end implementations, and then provides a UUID service by calling methods on the class it instantiated. If it was a factory, it would just return the instantiated implementation class.

So, that documentation needs to be changed. We should not be calling things "factory" if they are not really factory classes.

It would be helpful if someone could look through the rest of core for classes documented as "factory" and make sure they are really factory classes. This may not be the only one. Could be a good Novice project...


Viewing all articles
Browse latest Browse all 291161

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>