|
Some of the poo poo in that waterline article, dear god.
|
# ? Sep 8, 2015 19:30 |
|
|
# ? May 18, 2024 06:29 |
|
German Joey posted:Yeah, I just saw that too, and its finally the tipping point for me where I just gave up on node.js completely and go back to Django, or maybe Flask or Mojolicious, I haven't 100% decided yet. But absolutely that blogpost was the moment that I just said "gently caress it, I'm out, I can't deal with this node.js poo poo anymore." I'd rather spend a couple weeks rewriting my entire project then waste one more day fighting with a broken library. Maybe Sequelize is good now (I remember looking at that one specifically a few years ago and it being inadequate, although that was probably an early version because this looks OK), but the trend is pointing to probably not. I'm so sick of every loving javascript library being terrible!!! ARRGHH! Time after time after time, every new thing I look at has some flashy splash page but lovely, outdated, and inconsistent documentation. Every framework has ten trillion pointless preprocessors being stapled to it that otherwise reinvent the same drat wheel. If you need layers upon layers upon layers of build tools for your server-side javascript, then what the gently caress is the point of using javascript on the server side to begin with? Isn't the whole point that both client/server are in the same language, a language that everyone in the entire drat world happens to know and have access to - a language that any ten year old can start playing around with by pressing ctrl-shift-j in their browser? That's why I got into node.js to begin with! Next time I'm in an interview, if I'm asked about node.js this will be my answer
|
# ? Sep 8, 2015 21:28 |
|
Is node.js really that bad? Just wondering cause I'm trying to learn the MEAN stack as opposed to a standard LAMP stack.
|
# ? Sep 9, 2015 00:44 |
|
Odette posted:Is node.js really that bad?
|
# ? Sep 9, 2015 00:52 |
|
node.js is cool, if you don't rely on it or associated repo's for anything in production environments.
|
# ? Sep 9, 2015 01:02 |
|
node.js is cool and good as long as you, er, don't ever give it write access to your datastores it seems. Node.js is great for what it's good at, which is more front end style tasks like templating and lightweight communications. It is not a good option for the entire stack because the libraries that get you to a full stack are just not there, as evidenced by projects like Waterline being one of the main SQL access libraries, yet making a mockery of things like Data Integrity.
Maluco Marinero fucked around with this message at 01:12 on Sep 9, 2015 |
# ? Sep 9, 2015 01:06 |
|
As much as we hate on node.js (and I'm pretty sure most of us still have jobs paying us to work with it that we go along with) I feel like it's a way better idea than any LAMP stack. Node.js has some very boneheaded stuff in it but you can still go pretty far if you pick the things you're using in it right.
|
# ? Sep 9, 2015 01:11 |
|
Speaking of node and js, what is the standard way to declare functions? is it:code:
code:
|
# ? Sep 9, 2015 01:19 |
|
Knifegrab posted:Speaking of node and js, what is the standard way to declare functions? is it:
|
# ? Sep 9, 2015 01:23 |
|
Knifegrab posted:Speaking of node and js, what is the standard way to declare functions? is it: It's all about hoisting. When you type the first one, as the javascript compiles, it notices that there's a function definition and it "processes" it's instructions up before everything else in scope. With the variablized version, it doesn't jump ahead and take care of it's existence until it hits the line it's defined on. console.log(poo poo()); var poo poo = function(){}; // errors because "poo poo" hasn't been defined yet console.log(poop()); function poop(){} // works, because poop's definition gets moved to the top of the current scope. function poop(){} should be used more for a constant definition that cannot change. The variable'd version should be used when you could possibly want to swap out the function that the variable holds, if that makes sense. And with a file required by node, you have to do the exports.poo poo = function(){} in order to make the function public to outside files.
|
# ? Sep 9, 2015 01:33 |
|
Odette posted:Is node.js really that bad? I feel like node.js in isolation is cool and very suitable to be the core of some types of webapps, like the one i've been working on. However, the problem is that you're never going to be "just" using node.js itself, as, surprisingly, its much more "close to the metal" than you'd expect. Your app is thus node.js + something, and in fact more like node.js + express + something + something + something + something + something + etc; not even counting your database or frontend stuff. Essentially, you'll absolutely need some sort of framework to help you manage the complexity of a large application, and all that other stuff... that's where you start the downward spiral into a world of poo poo. Worlds of poo poo inside worlds of poo poo inside worlds of poo poo... turds all the way down, each more solid than the last... and finally, at the core, you'll find the node.js server engine itself. Perhaps it truly is made of solid gold..? But how long will you need to boil it in bleach to remove that smell..? German Joey fucked around with this message at 01:52 on Sep 9, 2015 |
# ? Sep 9, 2015 01:47 |
|
"and I'm pretty sure most of us still have jobs paying us to work with it that we go along with" Oddly enough I write C#/ASP.NET stuff for a living and honestly just find the whole node.js ecosystem fun to gently caress around with (especially since all I really need is sublime and a command prompt), in addition to getting warm and fuzzies from contributing to open source projects which its kind of enabled for me. I'm also pretty sure its contributed in weird and good ways to the msft stuff I write.
|
# ? Sep 9, 2015 04:10 |
|
piratepilates posted:As much as we hate on node.js (and I'm pretty sure most of us still have jobs paying us to work with it that we go along with) I feel like it's a way better idea than any LAMP stack. Disagree. While it's still a miserable language, PHP has made leaps and bounds since PHP 4 or even PHP 5.3. It's not great, but PHP 5.6 and the more modern frameworks make working with the language tolerable rather than maddeningly frustrating like node.js.
|
# ? Sep 9, 2015 04:18 |
|
Does node.js have sane error handling yet? That's the one thing I've hated, though, to be fair, a lot of other languages and frameworks are also much worse. Promises just made things worse by having things drop errors on the floor by default.
|
# ? Sep 9, 2015 05:18 |
|
Suspicious Dish posted:Does node.js have sane error handling yet? That's the one thing I've hated, though, to be fair, a lot of other languages and frameworks are also much worse. Promises just made things worse by having things drop errors on the floor by default. Bluebird made uncaught errors in promises throw on the event loop, I know the major browsers do the same with native Promises, and probably iojs too.
|
# ? Sep 9, 2015 05:43 |
|
I'm playing around with the bind operator, and just for the experiment's sake I was trying to figure out how to have an optional first parameter that defaults to this. So I have lib of a virtual functions, looks something like this: code:
code:
code:
So if done extremely naively: code:
code:
RobertKerans fucked around with this message at 12:33 on Sep 9, 2015 |
# ? Sep 9, 2015 09:18 |
|
RobertKerans posted:I'm playing around with the bind operator, and just for the experiment's sake I was trying to figure out how to have an optional first parameter that defaults to this. On my phone so this may not make sense, but try using .call or .apply in your decorator with 'this' as the first argument to one of those two functions to preserve the value of 'this'.
|
# ? Sep 9, 2015 14:38 |
|
Aha, cheers, I was trying most of that & it wasn't working, but I am an idiot, wasn't passing it again to the function. Also had to explicitly pass the arity, myFunction.length didn't seem to be picking up the function length for some reason v0v All tests green, so I'm happy code:
RobertKerans fucked around with this message at 16:39 on Sep 9, 2015 |
# ? Sep 9, 2015 16:36 |
|
obstipator posted:It's all about hoisting. When you type the first one, as the javascript compiles, it notices that there's a function definition and it "processes" it's instructions up before everything else in scope. With the variablized version, it doesn't jump ahead and take care of it's existence until it hits the line it's defined on. Thanks, I totally get it now! edit: Got another standards question. What is the standard in terms of encapsulating object properties? E.g.: code:
code:
Knifegrab fucked around with this message at 00:09 on Sep 10, 2015 |
# ? Sep 9, 2015 19:45 |
|
Knifegrab posted:
iirc it makes no difference except without quotes you USED TO be able to iterate over keys easier. now it's all different with ES5 (okay i was setting up a jsfiddle but for some reason it was blowing up on me) code:
|
# ? Sep 10, 2015 02:55 |
|
pepito sanchez posted:iirc it makes no difference except without quotes you USED TO be able to iterate over keys easier. now it's all different with ES5 What was easier about iterating over keys without quotes? They should produce identical objects.
|
# ? Sep 10, 2015 02:59 |
|
Subjunctive posted:What was easier about iterating over keys without quotes? They should produce identical objects. Yeah I'm also struggling to see the difference. My assumption was that they literally produce the same object, it was more a best practices question but am I to believe they actually produce different objects?
|
# ? Sep 10, 2015 08:43 |
|
agh it's been a while. the quotes made it easier to iterate, not the other way around. i should've clarified how. and only for iteration in a certain way (with a for loop) and only if you, for some odd reason give your keys funky numerical names in the first place. this might be desirable for something like pushing new keys into an existing array of objects. i personally never did this that way. it's the way object keys are accessed. was about to do more [code] but found this very helpful link that answers stuff https://mathiasbynens.be/notes/javascript-properties also worth noting that you have to use double quotes if you work with JSON, because some parsers are dumb.
|
# ? Sep 10, 2015 11:48 |
|
pepito sanchez posted:also worth noting that you have to use double quotes if you work with JSON, because some parsers are dumb. If your parser allows anything else, it is your parser who is dumb!
|
# ? Sep 10, 2015 12:46 |
|
pepito sanchez posted:agh it's been a while. the quotes made it easier to iterate, not the other way around. i should've clarified how. and only for iteration in a certain way (with a for loop) and only if you, for some odd reason give your keys funky numerical names in the first place. this might be desirable for something like pushing new keys into an existing array of objects. i personally never did this that way. it's the way object keys are accessed. But how does it make iteration easier/better/faster/whatever? quote:also worth noting that you have to use double quotes if you work with JSON, because some parsers are dumb. lol standards amirite Munkeymon fucked around with this message at 16:10 on Sep 10, 2015 |
# ? Sep 10, 2015 15:11 |
|
Quotes also let you define keys with spaces in them.
|
# ? Sep 10, 2015 15:15 |
|
I have never encountered this before, and it's breaking a load of my tests, just wondering if anyone could explain it:code:
Edit arrgh FFS course I've encountered this thing before, bind call and apply all convert primitives to objects, it just generally hasn't made any difference to the actual end result RobertKerans fucked around with this message at 16:21 on Sep 10, 2015 |
# ? Sep 10, 2015 15:59 |
|
RobertKerans posted:I have never encountered this before, and it's breaking a load of my tests, just wondering if anyone could explain it: Use strict mode JavaScript code:
|
# ? Sep 10, 2015 16:30 |
|
Ah god, thank you, that is easier than this idiotic switch statement I was building to check for primitives. Sidenote though, I thought using ES6 via babel-node would do that for me automatically, but no, might submit an issue EDIT: nope, not doing it for me here, back to the switch statement for the minute. EDIT2: to clarify, works fine if I manually type it into the repl, does not work fine if I run tests (which in theory are just running the same code with the same repl commands) RobertKerans fucked around with this message at 16:52 on Sep 10, 2015 |
# ? Sep 10, 2015 16:35 |
|
I use babel too and it puts 'use strict' in every module. It doesn't hurt to explicitly use strict mode in your case though. Someone could always copy/paste that code and run it in a different context.
|
# ? Sep 10, 2015 16:42 |
|
Chenghiz posted:Quotes also let you define keys with spaces in them. What kind of monster does this!?
|
# ? Sep 10, 2015 16:52 |
|
Hmm, I am at a loss here. The 'use strict' babel inserts should cover this even if I don't manually add anything, all works great in the REPL, tests fail code:
RobertKerans fucked around with this message at 17:12 on Sep 10, 2015 |
# ? Sep 10, 2015 17:00 |
|
Knifegrab posted:What kind of monster does this!? It's useful if you're using objects as generic key:value containers (like a hash map) and only want to access the values that way.
|
# ? Sep 10, 2015 17:02 |
|
pepito sanchez posted:also worth noting that you have to use double quotes if you work with JSON, because some parsers are dumb. I just tested this in the browser and in node and Json seems to be able to stringify objects whose properties were not declared in quotes no problem...
|
# ? Sep 10, 2015 17:46 |
|
Json standard says that Json objects need to have keys enclosed in double quotes, JavaScript objects including ones you're stringifying don't have that restriction, only actual Json.
|
# ? Sep 10, 2015 17:55 |
|
Knifegrab posted:I just tested this in the browser and in node and Json seems to be able to stringify objects whose properties were not declared in quotes no problem... Use this instead: http://jsonlint.com/ IronDoge fucked around with this message at 18:35 on Sep 10, 2015 |
# ? Sep 10, 2015 18:17 |
|
Knifegrab posted:I just tested this in the browser and in node and Json seems to be able to stringify objects whose properties were not declared in quotes no problem... Yes, but the generated JSON has quotes on the property names. Try JSON.parse('{q:"w"}')
|
# ? Sep 10, 2015 18:34 |
|
Knifegrab posted:am I to believe they actually produce different objects? No, pepito is making no sense. If it's legal to leave unquoted, then doing so produces exactly the same result as quoting the key. The specification requires it.
|
# ? Sep 11, 2015 11:37 |
|
Alright so why do the ES6 collections like Map have a forEach method but not some, map, or reduce? I know we have for of now, and it is trivial to make a stream library (like Java 8) out of iterators, but it seems like a weird step back to have these nice new collections that can only be traversed natively using a for of loop imperatively instead of a nice functional approach like a Java 8 stream. Edit: we also now have how many, like 5 ways of traversing collections and they're all slightly different for not a great reason.
|
# ? Sep 11, 2015 16:56 |
|
|
# ? May 18, 2024 06:29 |
|
Subjunctive posted:No, pepito is making no sense. If it's legal to leave unquoted, then doing so produces exactly the same result as quoting the key. The specification requires it. Alright thanks, I was going crazy for a second there. And I understand everyone's point about JSON now, its a good thing to know but doesn't really affect me since I almost never handwrite my JSON.
|
# ? Sep 11, 2015 17:23 |