Always use types that have an interface (eg IPageRetriever
vs DocumentHelper
or IPageUrlRetriever
vs DocumentURLProvider
.
Why?
- Because it will result in more testable code.
- The Kentico Xperience dev team has been migrating away from these static classes and is building functionality for Kentico Xperience 13 into the interface abstractions they are providing.
So, DocumentURLProvider
might work today, but it's not going to cover the edge cases like IPageUrlRetriever
will (it's not going to be 'Content Tree routing' aware), and it's not guaranteed to give you the expected result when you eventually upgrade your site to the next version.