Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

As a developer of some "popular" widgets, I owe a great deal to ExtJS because it taught me that encapsulation, especially in JavaScript, a scripted language with defacto accessible source code, is just absurd. A simple thing like that reminded me of functional programming and the rest is history.

Extending a dropdown component meant that i had to copy some closure just to change a number in a wrapped function, and then update the copy-paste with each extjs version that touched it. Why? Because the developer didn't know any better. Similarly now you have "private" fields in classes, etc because some group wants them, because other languages have them so ofc JavaScript needs it too. When all you have is a hammer...

ExtJS is very much rooted in me as a "not like this", as much as Douglas Crockford is preaching a "keep it simple, stupid, like this". I get pleasure just by hearing him give a talk and saying that while they kids are adding and adding to this pretty ok language, he only needs tail call optimizations, because keeping to the good parts is more than enough.



Encapsulation to me is about limiting the supported API. It sucks to release something, and then find many of your users are depending on accidentally-exposed private values or functions that are all going to break if you do the dream refactor needed to fix all the previous problems and enable new stuff. In situations where the API consumers can't pin an old version (like how a plugin can't choose the version of the product used), then you end up with a constant churn of breakage if the system doesn't limit its API exposure to just the mature public parts. In situations where the API consumers can pin an old version, you end up with consumers updating as slow as possible only when they want a new feature occasionally, missing many fixes or other improvements until much later.


I agree. I like functional programming, but at some point, you're going to have some type of encapsulation, whether at the closure, module, actor, or network boundary. It's always important to think about what API you're exposing.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: