ec changed the topic of #elliottcable to: a π―ππ ππ π―πππππππππ π―ππππππ slash sΝΜuΝΝpΝΝeΜΜΊrΜΌΜ¦iΜΌΜoΜΜ¬rΜΜ cΜΝα»₯Μ§ΝαΈ·Μ‘ΝΕ£ΝΜ || #ELLIOTTCABLE is not about ELLIOTTCABLE
<jfhbrook>
oh geez ok that's hilarious
<jfhbrook>
I came at this like, oh, I want a constructor and some methods, this sounds like a good use case for a class
<jfhbrook>
but it turns out what I *actually* want is an object decorator
<jfhbrook>
ie, I've been hacking on this project for a *while* and I still haven't had a need for classes
<jfhbrook>
and not like in an avoiding them way, more in a bad fit way
<jfhbrook>
what a funny language
<jfhbrook>
in python this woulda 100% be an ABC
<ljharb>
funny language aka "multiparadigm"
<ljharb>
:-p
<ljharb>
greatest {strength,weakness}
<jfhbrook>
python is also arguably multi-paradigm
<jfhbrook>
though a number of its design decisions make classes preferred over closures and require special syntax for certain actions
<jfhbrook>
for instance, python by default defines variables in the current scope as soon as you try to assign, even if there's a variable in the outer scope w/ that name - it shadows it. that means you need special keywords (nonlocal and/or global) to set variables via closure
<jfhbrook>
on the other hand, python's classes can manage that state just fine, and in fact can even be accessed via the closure! ie, state_dict['count'] += 1 is totally fine
<jfhbrook>
python classes will also copy class properties onto the instance, which gives a cheap way of setting default values on the instance sans constructor
<jfhbrook>
and because all classes are defined explicitly, you can almost always do a meaningful isinstance check
<jfhbrook>
oh, and python lambdas are single statement only so you need special syntax for decorators
<jfhbrook>
so even though python has map and reduce and comprehensions and first class functions (and callables!!), it's still often idiomatic/easiest to use a class
<jfhbrook>
meanwhile, javascript has cheap object literals, much better support for iterating over keys (attributes in python), multi-line anonymous in-line functions and so on, means more duck typing, mixins, instance modification and just way fewer classes
<ec>
yeah, I never do OO β¦ anything, anymore, unless the APIβs for someone else
<ec>
really the only single thing OOβs got going for it, is documentation
<jfhbrook>
well with python in particular it's really hard to write without doing boring ol' oop
<jfhbrook>
like it's "multi-paradigm" but it truly shines in oop contexts
<jfhbrook>
and like, javascript still has objects! and you don't need to write traditionally object-oriented code on top of them but I'd argue that it's still got quite a bit of oop in there
<jfhbrook>
in some ways I think of javascript as being /more/ object-oriented than python because javascript is objects all the way down, meanwhile, python is class-based - just my hot take is all
<jfhbrook>
looking better! I think I need to move the setTimeout into the hook and I need a linter that's more opinionated about the amount of space between things
<jfhbrook>
I think the pattern of creating a closure around a component is a little funky but only a little
<jfhbrook>
also this one creates the logger and then doesn't use it - logging inside the component is a little dangerous and not really needed here
<jfhbrook>
yeah, like, useTimer, no state of its own
<jfhbrook>
might get rid of processParams too, it's kinda needless indirection
<jfhbrook>
just gotta bite the bullet with that one!
Sgeo__ has joined #elliottcable
Sgeo_ has quit [Ping timeout: 240 seconds]
Sgeo_ has joined #elliottcable
Sgeo__ has quit [Ping timeout: 240 seconds]
_whitelogger has joined #elliottcable
Sgeo__ has joined #elliottcable
Sgeo_ has quit [Ping timeout: 250 seconds]
Rurik has joined #elliottcable
Sgeo_ has joined #elliottcable
Sgeo__ has quit [Ping timeout: 250 seconds]
Sgeo_ has quit [Read error: Connection reset by peer]
Sgeo_ has joined #elliottcable
Rurik has quit [Quit: Rurik]
Sgeo__ has joined #elliottcable
Rurik has joined #elliottcable
Sgeo_ has quit [Ping timeout: 265 seconds]
Rurik has quit [Quit: Rurik]
Sgeo_ has joined #elliottcable
Sgeo__ has quit [Ping timeout: 265 seconds]
Rurik has joined #elliottcable
<ec>
fuckme, Travis-CI's macOS machines are so slow