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

JS Code runs on so many VMs, which makes trivial things difficult. Imagine you have 10 different JDKs and you want to support all of them.

Of course you can write your own code, but you will be in a bubble then and "works for me" will be something that you say very often.

On the other hand maintaining this code means that you need to have quite solid tests for it, which means that it would be easier to just separated in a module.

Modules are published on npm. Yeah there are lots of them.



When it comes to environmental concerns two general rules account for most of your design decisions: 80/20 rule and separation of concerns. Environment APIs should be well separated from the core of your application. That core of your application will get you the 80% value from 20% of code/effort.

On my open source projects, for example, I perform a huge ton of test automation. My application run in browsers, but I don't provide any test automation for the browser environment. I just manually test there occasionally. The effort is too high and the environment is so simple that I can get what I need from brief manual testing. Since the code that runs in the browser (and its documentation) is dynamically assembled maybe half the concerns there are solved by testing the code in other environments more conducive to test automation.

Rationally speaking you don't really need to provide 100% test coverage. You just need to provide enough tests to guarantee the application does all it claims to do.

> Of course you can write your own code, but you will be in a bubble then and "works for me"

That is what test automation and feature tests are for. The application does all it claims to do or it doesn't regardless of whether you wrote original code or cobbled together various untested packages.


> My application run in browsers, but I don't provide any test automation for the browser environment. I just manually test there occasionally. The effort is too high and the environment is so simple that I can get what I need from brief manual testing.

I do the same.

But I must admit, nearly every time I manually test on a different browser, some behaviour or other is different in some broken way, and I spend a while updating the code to handle yet another browser difference.

Perhaps I'm pushing the edge a bit with the sort of things I write, but still. It's astonishing how much variation there is.


I am pretty old school with my approaches to writing for the browsers so I don’t really see these differences in either my JS or CSS. I love template strings, and if weren’t for my heavy use of those my code would work just fine in IE9 and possibly IE8.




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

Search: