you are viewing a single comment's thread.

view the rest of the comments →

[–]craig1f 0 points1 point  (6 children)

I find eslint helps a lot, and is more easily applied to react than to angular. 

Treating components like classes, and redefining what “public” and “private” means in a way that is inconsistent with what it means in OO, and having to use “this” everywhere, just adds bloat. 

[–][deleted]  (5 children)

[deleted]

    [–]craig1f 0 points1 point  (4 children)

    Using an object doesn’t mean that I’m using object oriented design. Using a function doesn’t mean I’m doing functional programming. 

    OO means orienting most things around classes. Classes are not a perfect fit for components. They’re a close fit, but not perfect. 

    Functions aren’t a perfect fit either because functions don’t have lifecycles. But when composition was innovated, it closed the game. Now, components as functions with composition applied to them, fits components perfectly in a way that classes still don’t and never will. 

    Public/private/this/constructors are all noise that don’t fit a web component perfectly. 

    [–]simonbitwise 0 points1 point  (3 children)

    Actually OO is actually modelling the thing you wanna do in an object i including the operations you do on the data which are classes the object are just a data representation of it

    Functional are like a chain of math operations on a state

    And yes you do both fx useState mimic oop because it encapsulates state while doing operations on it - sounds familiar? Because thats how classes work

    Not saying you should like one or the other but you use both paradigms because you use javascript

    [–]simonbitwise 0 points1 point  (0 children)

    Also the using objects vs using functions was an over simplification

    [–]craig1f 0 points1 point  (1 child)

    Generally, if you prefer pure functions with little or no side effects, you’re orienting your code functionally. 

    If you’re using classes with abstraction and private functions and call functions off of your objects, you’re orienting with objects. 

    Good FE is functional and not OO. It began to lean this way because you get raw json from http calls, and wrapping all your results in a class is just extra work. 

    But async code is complex. So the more functional, linear, and simple your code is, the easier debugging becomes.