Git Product home page Git Product logo

Comments (2)

kentcdodds avatar kentcdodds commented on May 24, 2024

As illustrated here I'm not a huge fan of classes. The reason is that I don't like inheritance from an architecture standpoint. I'm concerned that we're going to wind up in a situation that's already perforating many classical languages in that we get 7 layers deep into inheritance and suddenly we're in a huge maintenance nightmare. I prefer to be functional.

That said, I know when I'm licked. Unless there's a reasonable alternative, I'm fairly confident that I'll cave and use classes for my components in Angular 2. We just need to enforce good coding standards for ourselves.

I hope there's some tool developed that can determine how many levels deep you are inheriting and warns if you inherit beyond a threshold. Then I'll make that a pre-commit git hook (using ghooks) that disallows inheriting beyond 3 levels and requires a special comment beyond 2 levels that says: // I, {coder's name}, being of sound mind and judgement, promise that this was the best way to accomplish my task and that I will pay the technical debt associated with this architectual nightmare... Just kidding, that's way too extreme :-) But it was fun to write.

As for annotations, I'm a fan. I think there are a lot of benefits to declaratively describing your class (static analysis for tooling, all the benefits of declarative code in general, etc.).

Thanks for the question :-)

from ama.

jimthedev avatar jimthedev commented on May 24, 2024

Nice. I also have preferred functional over classical up until now and am skeptical but open to seeing if this improves development. That tool you described sounds awesome and seems like it would be a good addition to an eventual tool like jscs for typescript/es6. I am a huge fan of the shift towards composition so hopefully that helps avoid the 7 levels you described, but we shall see. Thanks for answering.

from ama.

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.