Topic on Talk:Requests for comment/TitleValue

Refactoring of the Title class

2
Tim Starling (talkcontribs)

You say that you want to avoid refactoring of the Title class, but I would hope that the Title class would be refactored to use TitleValue/TitleFormatter/TitleParser where appropriate, instead of duplicating the whole system. That is, secureAndSplit() etc. would be moved into TitleParser instead of being duplicated there.

Duesentrieb (talkcontribs)

I was referring to changing the interface or contract of the Title class. You are right that the implementation should be changed to use the new code. However, in order to do so, Title needs access to TitleFormatter and TitleParser instances. This kind of B/C code is the rationale for the ServiceRegistry - I see no way to inject them (directly or indirectly via a RequestContext) without changing the signature of the newXXX and makeXXX pseudo-constructor methods in a very inconvenient way.

Of course, we could use the RequestContext singleton to get the services. But I don't see how that would be better, it would cause even more dependencies to be dragged in (everything RequestContext depends on, recursively).

Reply to "Refactoring of the Title class"