Issue Bug Rejected

#28980t3lib_http_Request must not extend PEAR HTTP_Request2, but should encapsulate it instead

Ingo Renner 08/15/11, 12:49 updated 10/23/11, 21:05

Description

Currently t3lib_http_Request extends PEAR’s HTTP_Request2 class. By doing so all methods of HTTP_Request2 are exposed as public API. If at some point, for what ever reason we decide HTTP_Request2 to replace it, this will be a problem as we would have to replace the whole HTTP_Request2 public API like it is.

To avoid this and make replacing of the 3rd party library easier we should encapsulate HTTP_Request2 instead of extending it. We then only expose the methods we really need.

Summarizing reasons to encapsulate instead of extending:
  • we may not want or need all the methods a 3rd party lib offers
  • when updating the 3rd party lib, methods may be added or removed without us noticing, again including unwanted changes or methods
  • naming of methods may not fit our naming conventions
  • abstraction and decoupling to make replacement easier
  • easier unit tests as only exposed APIs need testing
Situations which may lead to replacing a 3rd party lib:
  • lib is not actively developed anymore
  • other libraries are performing better
  • other libraries provide better APIs
  • other libraries provide better features
  • other libraries have fewer bugs

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.