
Ask HN: What are your thoughts about primitive obsession in JavaScript? - fagnerbrack
People talk a lot about primitive obsession in other languages but I don&#x27;t see anyone talking about it in JavaScript.<p>Basically, we have literals (Array&#x2F;String&#x2F;Object) that don&#x27;t actually have any meaning to the domain. We have built-in methods like `.filter`, `.map`, etc. in those primitives and we see people often using it just for mutate data through functions instead of just building &quot;mapeable&quot; or &quot;filterable&quot; functions&#x2F;objects.<p>What are your thoughts about this? Is primitive obsession a thing in JavaScript? Should we care about it? Do you have any link to similar discussions happening elsewhere?
======
angersock
I'm unfamiliar with whatever recent chatter on "primitive obsession" there's
been, but it's not a new idea (
[http://www.jamesshore.com/Blog/PrimitiveObsession.html](http://www.jamesshore.com/Blog/PrimitiveObsession.html)
) and has been discussed elsewhere (
[http://wiki.c2.com/?PrimitiveObsession](http://wiki.c2.com/?PrimitiveObsession)
).

Frankly, while I do see the point about fixing it with value objects and
whatnot, I rather think that is a sign of wannabe architect/PL wankery.

Javascript has a basically useless type system in practice (especially with
legacy code) and has a lot of really handy/flexible features that would only
interact badly with attempts to fix this "primitive obsession" stuff.

I don't think it matters in the JS ecosystem.

