DonjonMaister

TTRPG fan and programmer.

  • 6 Posts
  • 23 Comments
Joined 1 year ago
cake
Cake day: June 19th, 2023

help-circle
  • This is an excellent take! 👏

    That said you should strive to use both functions and classes. If you can simplify your functions to allow mostly any primitive input, that’s great. It can be reused many times throughout your code. But if you have certain operations that only work with one type, then don’t be afraid to use a class

    This advice looks sound. I’ll definitely take it into consideration.


  • I don’t like/use the class keyword in JS, because I quite like the paradigm with prototypes & stuff, and that keyword tries to make it fit into a totally different paradigm, which doesn’t really work IMHO.

    I’ve read somewhere that Javascript is more of a prototype-oriented language rather than an object-oriented one. Do you agree with this?

    BTW, I’ve developed a few strats to have my own style in TS that I like quite a lot. I can tell more if you’re interested.

    Thank you! But maybe not right now; I’m still learning the basics. Have you considered write an article about it? 😮







  • I think you should do what’s comfortable to you

    Good advice, but I would like to expand outside of my comfort zone to learn different styles of programming.

    but also try to adapt to the common language in each of the code bases you will be working on, so that everyone is on the same page.

    Absolutely agree with you there.

    Good luck in your journey!

    Thank you! ❤️



  • As long as you’re opting for composition over inheritance, it’s probably fine.

    Totally agree with you there.

    Probably on the “sparingly” end.

    I’m on the same train of thought as you. I feel that relying too much on class ignores the better features that JavaScript has to offer. However, I’m sure that its application is useful on the occasion where inheritance IS (but very rarely) necessary.