GithubHelp home page GithubHelp logo

Comments (5)

X-Coder264 avatar X-Coder264 commented on August 11, 2024 1

I think everything here that was mentioned is solved. Feel free to open a new issue if there are still things that need to be improved.

from oauth2-bundle.

X-Coder264 avatar X-Coder264 commented on August 11, 2024

I don't think we should blindly add interfaces to all final classes in the bundle just for some "test" purposes. For example I don't see any value in adding an interface for the UserConverter class. I don't see the possibility of there being another implementation that justifies an interface (or it's very unlikely at least) nor does this implementation do any I/O or database calls etc which means doing new UserConverter() in your tests is fine if you ask me.

from oauth2-bundle.

Nyholm avatar Nyholm commented on August 11, 2024

No, not "blindly". Final classes that are not "internal" should have an interface.

Speaking of your example of UserConverter:
I like the OauthAuthorizationController but I need do to some modifications to it. So I copied that class to my namespace and did my modifications. (Everything is perfect.) However, when I write unit tests from my new controller class I cannot mock its dependencies. That is reason 1 why we need an interface.

Reason 2 is that OauthAuthorizationController has dependency on a concrete class. That violates the dependency inversion principle.


You are probably correct when you say that there will most likely not be an other implementation of the UserConverter. However, adding an interface to be more correct will guarantee future proof code.

from oauth2-bundle.

alexspark21 avatar alexspark21 commented on August 11, 2024

Yep, I think we have to set UserConverterInterface, because I have to have possibility override UserConverter and implement my logic

from oauth2-bundle.

janvernieuwe avatar janvernieuwe commented on August 11, 2024

I just ran into a situation where a ScopeInterface would have been nice.
When retrieving scopes from a custom system you could just implement it and return them.

from oauth2-bundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.