Giter VIP home page Giter VIP logo

Comments (6)

paullewis avatar paullewis commented on May 2, 2024

I like it for these shorter audits. When the audits get bigger (which I think they will with things like Speed Index, CRP, etc), then I'd be more inclined to see things a little wrapped up, as opposed to a collection of functions, which is what this would probably give us. In any case, whichever way we go, we'll need to be consistent across all the audits.

This approach currently makes it more difficult for us to ensure that an audit correctly sets its name, tags and description as they're not exposed in a testable way. Making them properties of the function would solve that, but then they'd need to be getters (as they currently are in the class) so they can't be overridden, and that's not really then buying us that much.

from lighthouse.

samccone avatar samccone commented on May 2, 2024

This approach currently makes it more difficult for us to ensure that an audit correctly sets its name, tags and description as they're not exposed in a testable way

IF we export the object, we can just check the shape of the object exported from the audit to verify.

from lighthouse.

brendankenny avatar brendankenny commented on May 2, 2024

I'm a fan of the reorganization. The current implementation seems over-complicated by using inheritance for what is essentially a mixin of a utility function, which we could just as easily require (although the utility of that utility function is declining as so many arguments get added to it :). Ensuring an Audit interface would get us a compile-time check of required properties (and if we want to, a runtime check can be put in auditor.js). Audit utility functions can easily live on auditor.js (or audit-utilities.js or whatever) and be imported where needed.

In general I'd really like to avoid inheritance unless there's actually a class hierarchy. The implicit importing of functions causes a good bit of mental overhead without a conceptual model to back it up, while a require statement is super clear.

from lighthouse.

paulirish avatar paulirish commented on May 2, 2024

Yeah. I do admit it's a bit funny that we are agreeing gathers could use stronger base classes, and meanwhile I'm advocating for removing that structure from audits.. but ... so it goes. 😝

from lighthouse.

paullewis avatar paullewis commented on May 2, 2024

I see it, and generally I favor composition over inheritance, I just think it's premature to refactor this. When we know more about the stronger base classes I think we should be in a better position to make the call. As it is it feels like we would be choosing without a fuller picture.

from lighthouse.

paulirish avatar paulirish commented on May 2, 2024

works for me.

lets get the perf diagnosis moving to see what parts we need to excercise

closing.

from lighthouse.

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.