Live data from Hacker News

Ask HN: Which JavaScript frameworks do you use?

news.ycombinator.com

61–70 of 71 posts

Re: Ask HN: Which JavaScript frameworks do you use?

#61

ReactJS + webpack, though I've used Angular and browserify in the past. 1. It's just a component framework. It doesn't do the kitchen sink, like Angular does. A couple hours reading the spec and implementing a small test case gets a seasoned developer up to speed on it. Flux takes a little bit longer to get used to, though, and I'm still not quite sure I'm 'doing it right.' 2. Coupled with webpack and an automated te…

> 3. [...] The favored test runner, Jest, provides automocking for dependencies and code coverage analysis. 3/3. Thanks for sharing! A few questions about Jest: a. Are you happy with Jest auto-mocking? How do you keep a team from banging its head on this "exotic" behavior? (Typically, devs would be stuck on a test for a few hours, only to notice they failed to unmock something in the chain being tested). Have you tri…

a. I am. I'm the only one working on this product so far, so I haven't run into the issue of it being exotic. I test my components, actions, data stores, api util, and misc util modules completely separately though. I have run into the issue of "oh, it's failing because that thing that's mocked is returning undefined instead of an empty array", but that just means I need to test for undefined behavior :)

Everything in my ./node_modules is unmocked, though.

On a previous project, we used karma+jasmine and the mocking became extremely cumbersome very quickly. Setup/teardown for a given module was up to 5-10x longer than the actual tests for said module. It might have been an artifact of applying unit tests to a codebase that was never tested properly before (and then not having time to refactor).

b. It 'just worked' for me. I'm happily generating lcov / clover reports with jest 0.4.17 `jest --coverage`. I even have it in my continuous build setup, so my coverage reports update every time I save. There's weirdness where it will report a branch or function as ignored, and I can't find which branch that is ... but I think that may be an ignored/missed function in the transpiled source (I work in ES2015).

c. Yes. And I love them. Default setup is to run these in JSDom (headless). We're considering doing full end-to-end tests with selenium in an e.g. jenkins environment, but haven't come to a decision yet - as much of that testing would be duplicating the already-written component unit tests.

It is slowing down a little bit. My test suite takes 21 seconds to run right now (including coverage analysis), which is pretty slow considering the number of components I have. Some of the async modules run even slower, though - it hasn't been a sticking point so far, but it will be fairly soon. Average test per component is ~3 seconds, with the longest taking 10 seconds. Test suite runtime doesn't grow linearly, though: average component test is 5.34s; average non-component test is 0.8s; total time taken by tests is 63s; actual (perceived) time for the entire test command including webpack build is 21 seconds.

Re: Ask HN: Which JavaScript frameworks do you use?

#62

ReactJS + webpack, though I've used Angular and browserify in the past. 1. It's just a component framework. It doesn't do the kitchen sink, like Angular does. A couple hours reading the spec and implementing a small test case gets a seasoned developer up to speed on it. Flux takes a little bit longer to get used to, though, and I'm still not quite sure I'm 'doing it right.' 2. Coupled with webpack and an automated te…

The virtual DOM is sick on ReactJS. However, I ran into quite a bit of trouble when I used Semantic UI + Reactjs for implementing a modal window. Because React works with the virtual DOM, you're not supposed to modify the DOM directly or else React loses track of what's going on. So when I implemented my Semantic UI modal, I would get DOM errors and my application would freeze. What would happen is that Semantic UI's…

There's a react module for modals :) https://github.com/rackt/react-modal

But yeah, in a similar fashion to angular, modifying the DOM outside the 'blessed' render()ing is a pathway to darkness. You can do a bit of fiddling in the lifecycle though - take a look at https://facebook.github.io/react/docs/component-specs.html#u...

Re: Ask HN: Which JavaScript frameworks do you use?

#63

Earlier quoted context omitted.

> 3. [...] The favored test runner, Jest, provides automocking for dependencies and code coverage analysis. 3/3. Thanks for sharing! A few questions about Jest: a. Are you happy with Jest auto-mocking? How do you keep a team from banging its head on this "exotic" behavior? (Typically, devs would be stuck on a test for a few hours, only to notice they failed to unmock something in the chain being tested). Have you tri…

a. I am. I'm the only one working on this product so far, so I haven't run into the issue of it being exotic. I test my components, actions, data stores, api util, and misc util modules completely separately though. I have run into the issue of "oh, it's failing because that thing that's mocked is returning undefined instead of an empty array", but that just means I need to test for undefined behavior :) Everything i…

b. Glad to learn it works now :)

c. jsdom, yeah, thanks! Maybe you're used to longer tests and are okay with it; I got spoiled by the early test suite of this project running in one or two seconds, which enabled me to tell my editor to automagically run tests at each save and report brokenness (in Atom, with the test-status package [1]). Which is amazing, almost physical, because it lets you feel when you break stuff and when you're back in a stable state. Then we discovered the jsdom tests, and at this point we didn't have any end-to-end Selenium tests, so it sounded like a great first step and we added them, but liiittle by little they started lengthening the tests, to a point where I abandoned my auto-test setup. Maybe this auto-test looks futile to you, to me it's the kind of enabling real-time dev. experience I now want to replicate on all the projects I work on, like react-hot-loader [2].

[1] https://github.com/tombell/test-status

[2] http://gaearon.github.io/react-hot-loader/

Re: Ask HN: Which JavaScript frameworks do you use?

#64
post #8

ractive. It's the best kept secret in web development. Want a live binding, 2 way, super performant virtual DOM, that feels less like a framework and more like something that came with JavaScript? var binding = new Ractive({ el: '.some-class', template: ' Hi there {{ name }} ', data: { name: 'Alex' } }) It's created and maintained by The Guardian interactive team. http://www.ractivejs.org/ ## Time needed for Learning…

I was in love with Ractive at one point. But I have come to appreciate JSX over mustache after working on some non-trivial projects at work. Being able to do whatever can do in JS has saved me from googling for template helpers.

The one thing I do miss from Ractive is event-bubbling.

Other than that React has some other fringe benefits: ecosystem: React Native, React Router etc clojurescript: Reagent, Om etc

Re: Ask HN: Which JavaScript frameworks do you use?

#65

I use MeteorJS. It really does feel like the future of web development, so much so that going back to other frameworks feels like drudgery. 1. Time to learn: I'd say it took me about 120 hours to really feel comfortable and get down the flow of how to build things with it. The hardest part to really grok is the whole Mongo.Collection publication/subscription model. But once you get it, it's smooth sailing. 2. Develop…

For 1), the hardest part for me coming from LAMP stack apps was shifting over to the way routing works (see https://github.com/iron-meteor/iron-router) and attaching your subscriptions to routes.

For 3) I've used meteorchef's excellent base package (https://github.com/themeteorchef/base) for two big projects so far and it's great.

Re: Ask HN: Which JavaScript frameworks do you use?

#66

I use MeteorJS. It really does feel like the future of web development, so much so that going back to other frameworks feels like drudgery. 1. Time to learn: I'd say it took me about 120 hours to really feel comfortable and get down the flow of how to build things with it. The hardest part to really grok is the whole Mongo.Collection publication/subscription model. But once you get it, it's smooth sailing. 2. Develop…

For 1), the hardest part for me coming from LAMP stack apps was shifting over to the way routing works (see https://github.com/iron-meteor/iron-router ) and attaching your subscriptions to routes. For 3) I've used meteorchef's excellent base package ( https://github.com/themeteorchef/base ) for two big projects so far and it's great.

FWIW don't use IronRouter. It's considered an antipattern now to tie your router to your subscriptions and generally to have reactivity in your router.

Use FlowRouter and BlazeLayout, both found on Atmosphere.

It's like yeah Martini is popular in the Go ecosystem, but it's now considered bad to use now that people know better.

Re: Ask HN: Which JavaScript frameworks do you use?

#67

Earlier quoted context omitted.

Yeah I'd imagine most people don't use the template as text -- one of the best parts about knockout is it's natural (HTML) feeling templates. What do you use for routing? I've been dreaming up a framework that's actually knockout +/- routing +/- requirejs +/- model management...

I haven't done any client-side routing. Normally each page is either static HTML/JS or is served by ASP.NET MVC on the server side. Then APIs are used to load the models on the client side and perform interaction. In other words, we're not making any effort to move to "single page" applications.

Ah I get it -- knockout is even better for that kind of usecase

Re: Ask HN: Which JavaScript frameworks do you use?

#68
I'm a big fan of virtual-dom and the ecosystem of very sharp single-purpose libraries that people have built up around it, usually not even coupled to virtual-dom at all.

For me, virtual-dom + main-loop is a pretty great combo for front+back universal javascript. I made some repos about setting up virtual-dom, main-loop, routing, and browserify/watchify with npm run scripts:

* https://github.com/substack/virtual-dom-starter - bare-bones main-loop + virtual-dom setup * https://github.com/substack/virtual-dom-universal-starter - universal (front+back)end js example with shared routing and single-page pushState

I usually use an ordinary EventEmitter to rig up the unidirectional flow (but I dislike how "flux" makes this a big deal). Here's an example of that: https://github.com/substack/virtual-dom-unidirectional-examp...

If jsx is your thing, I made an example of setting up jsx in virtual-dom land too: https://github.com/substack/virtual-dom-starter-babel-es6-js...

As far as the research questions go for 1-3, I don't think sampling people about their subjective opinions will lead to any interesting findings, but for question #4:

I chose virtual-dom and main-loop because each piece has a singular concern and performs that concern well. I don't want to use a tool that does a bunch of unrelated things because I want to be confident that in the future I can discard pieces of my tooling at will as my requirements change. With bigger tools with larger scope that is not so easy.

Re: Ask HN: Which JavaScript frameworks do you use?

#69
We're running production apps based mostly on Knockout.js and jQuery. We also use lodash and moment.

The problem with getting stuck into one particular framework is that then become an "X" programmer, not a web programmer. If you need a fully fledged bells and whistles one though, Angular is probably top dog at the moment.

Re: Ask HN: Which JavaScript frameworks do you use?

#70
Angular

1. 2 months

2. 3 (and code reuse is great)

3. 3

4. Directives is a greatest idea we had in 2011

Those who are writing "15 hours" to learn a framework - I think it's the time to read basic APIs, not the time needed to learn how to write effective and reusable code, not "it works!" mess.

Post reply on HN