Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
[dupe] PayPal releases Kraken, Node.js framework (krakenjs.com)
76 points by bluepnume on Nov 23, 2013 | hide | past | favorite | 24 comments


Maybe I'm a minority, but I can't really trust anything from a company with a login screen that says "logging you in securely" for 5000ms before loading me (sometimes) to my dashboard.


I agree with you. This is one of my biggest pet peeves. But we're working hard on load times. Every call is HTTPS, adds lag. But you'll start to see improvements on the new experiences that will start rolling out in Q1. One thing after another, we're improving the company, its platform, and its engineering culture. I have to say I'm quite proud of the team behind Kraken. This framework is solid.


You are not their target market.


Explain?


This might provide you some insight: http://thedailywtf.com/Articles/The-Slow-Down-Loop.aspx

In all seriousness, adding interstitials can provide value. If the login performance has high variance, it's better to set an expectation that it will take 5 seconds than leave the user wondering if the click actually worked. Similarly, Apple has done an amazing job with UI transitions in iOS to mask the actual load time.


I was honestly expecting something with more added value to warrant it's own name, maybe a viable competitor to Sails.js, Derby, etc. Lusca is nice, everything else is more or less what everyone is already doing - runtime config, controllers, grouped routes, etc, more of a template than a framework. Good thing they are not reinventing the wheel.


====

Don't like:

dust.js templates instead of handlebars

self = this all over the place

native use of forEach and Object.keys instead of underscore or lowdash

====

I like:

that you can change the template system

grouping routes, I always add this myself, makes it more django like

security stuff like csrf

dev and prod environment awareness

directory layout is cool

apache license

uses grunt

they use Object.create!

one var statement per function

krakens

====

Overall pretty awesome.

p. s. I have no idea how to format text here.


I'd be interested to hear what you don't like about Object.keys or Array#forEach. Not looking to start an argument, just genuinely curious why you prefer a utility library over native methods -- especially in Node, where you have guaranteed ES5 compatibility.

Also: self = this can be avoided in a lot of cases with Function#bind, but not always. Seems like a weird criticism to me.


Native methods can be slower than simply using a for (Edit: while) loop:

http://allyoucanleet.com/post/21624742336/jsconf-us-12-slide...

self = this is error prone because it relies on JavaScript's lexical scope to share a variable across nested functions. It's a gross abuse of closures. It invalidates the ability to bind or use apply later, since everything is bound to that local variable self, and it's simply not needed and is probably used to avoid considerable use of bind, but using bind is only an issue when you write flock of seagull style nested function code. using self = this is not the right solution, writing more modular code with smaller functions is.


Actually ran this on Chrome/V8 and the native method was faster. And as someone else wrote: lodash/underscore should normally fall back to the native methods if available.

As for bind - funny that you mention that as a good alternative to using self/closure. Because while it is convenient and powerful, it's also slower than using self/closure.

I don't want to pretend that for either `[].forEach` or `bind` the differences in speed are (in most cases) really that relevant, I just found your argumentation a little confusing here. As for bind vs. closure-self I wouldn't say that either is really better than the other. Both are perfectly fine options. The former is a pretty heavy solution (since it's basically using a special case of partial application) and can be confusing (e.g. calling `a.b()` can have weird behavior even when the implementation of b is known). The latter is less powerful but a little more explicit imho - you really see the this-scope expansion and it's not hidden away. Both solutions obviously can't protect you from "flock of seagull style nested function code" but as you wrote: that's not a problem of the way someones does this-binding, it's a problem with the design.


Neither underscore nor lodash use a for loop. Both use the native Object.keys when available. underscore uses native Array#forEach and lodash uses a while loop. So only lodash forEach is actually faster.

lodash is the only one to be performance focused. underscore always uses the native methods when possible.


I think whatever performance cost might exist with Object.keys and Array#forEach vs loops is outweighed in most cases by a pretty significant increase in readability. There are exceptions, of course, but I think the performance card gets played too often in cases where the difference is negligible.

As for self = this, I tend to agree that it's kind of gross in most cases. It's not something I use very often. But unless you're willing to say that you're never going to use anonymous functions, the reality is that sometimes it's useful.


The performance hit of using .bind() instead of `self = this` is much larger than .forEach() vs loop. Pick your side :)


I pick less chance for errors over performance. Referencing variables outside of local scope is something I avoid. Write beautiful code first, because it's easier to optimize beautiful code than to beautify optimized code.


What's wrong with using .forEach or Object.keys? Underscore will fallback to that if it's supported (which is always in nodejs).


Someone else asked this too, check out my answer there.


A framework should at least be template engine agnostic. I hate handlebars and dust.js , why should i use that? I want to use a jinja like templating language.

Seems even their i18n component is tied to their view layer. And 0 doc comments in the scripts? how do they document their own code ?


Yeah didn't notice the lack of doc comments. That is nice to have for a library.


That's a huge problem with most javascript libs I hack. No Js doc means wasting a lot of time trying to figure out what is the dev intent. Or they just removed all docs from their scripts ,seems more likely.


check out nunjucks


Huh: https://www.kraken.com/

Why this is relevant: kraken is a bitcoin trading platform. Paypal is a competitor to bitcoin.




Yeah, these days people don't seem to give a shit to preceding OS projects with the same name. "Ours will be much bigger".




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

Search: