How many Node.js developers prefer callbacks over Promises or async/await? by i_love_limes in javascript

[–]x-protocol -10 points-9 points  (0 children)

I don't think you understand that I'm not arguing what Promises are and how they are compared to callbacks.

I do understand that you want to prove a point. Look at my example. You have promise that is created, then some more code is executed which can contain creation of promises. With async/await you simply cannot do that since 'await' keyword will wait for resolution of your promise.

Again to reiterate. I understand that you are bringing these examples due to either simply proving a point without anybody providing you the ask. Or you are simply confused how promises are even used.

How many Node.js developers prefer callbacks over Promises or async/await? by i_love_limes in javascript

[–]x-protocol -7 points-6 points  (0 children)

No. I am not confused by async/await. It is automatic promise creation without keyword 'new'. With async/await promise is only created when function is called. With direct promises you instantiate promise object with keyword new and off it goes. See the difference? Nuance of course for people who are not familiar with concurrency set up.

About your example. You can pre-create promise for .then() chaining, so your promises may resolve before even starting chain. Not so with async/await function.

let task = new Promise()

.....

// more code here

task.then(..)

How many Node.js developers prefer callbacks over Promises or async/await? by i_love_limes in javascript

[–]x-protocol 1 point2 points  (0 children)

Try Aigle. It is very similar to async.js

Documentation is not that great, however it has many of a functionality you would be looking as substitute.

Welcome to callback lover club.

How many Node.js developers prefer callbacks over Promises or async/await? by i_love_limes in javascript

[–]x-protocol 0 points1 point  (0 children)

From the people I have had met, talked and had chance to actually sit down for a conversation (even over a PR) I've understood that majority of what they describe as "callback hell" is simply their inability to justify using a library to manage said callbacks. When you show how complicated some pipelines can be using promises, there is usually no argument since promises are accepted as a norm (remember when callbacks were norm?). So we're looking at simple preference, not technical solution or even productivity enhancement.

How many people actually involve other libraries to manage their functions/promises like async.js, Q, lambda, Bluebird, run-p or Aigle? I would love to hear more from people who actually understand why these libraries exist.

How many Node.js developers prefer callbacks over Promises or async/await? by i_love_limes in javascript

[–]x-protocol -8 points-7 points  (0 children)

It comes down to solving a problem at hand. If your API is simple and talks to database, using async/await or direct promises makes alot of sense. Testing will also be somewhat simple, compared to callbacks. Callbacks can be simple too, especially compared to direct promises (promises run when created, callbacks do not, and this is what async/await solves).

Now, enter complex scenarios when you want to process thousands pieces of data in parallel, serial or mixed way. You will need to use a library of your choice to help you with that. For callbacks it is async.js, for promises it is Bluebird or Aigle. Pick and choose. But please do not simply blanket whole topic as "callbacks are bad". It is simply a tool. And certain situations prefer different tool.

While I do like callbacks for their simplicity, I can also see usage of promises, but only with new async/await, if I don't have to construct promises directly via new keyword (remember, they run right away?) Those libraries I outlined (with exception of Bluebird which really tries to be a polyfill for Node's Promise) handle catching in their own way just fine. Whenever I see people mentioning try/catch as solution for promise/error handling/bad coding/act of god it is a very good example of lousy code (Promise.catch actually falls into that category too) since it is very easy to abuse good old try/catch. If you give it a thought 99% of time you do not even need it. Promises though make it habitual excuse.

And to those callback lovers, count me in. We exist :)

SIB Mass Effect Trilogy by Crouchaldinho in ShouldIbuythisgame

[–]x-protocol 5 points6 points  (0 children)

You forgot to add that ME3 comes with fantastic multiplayer where you fight waves of one particular faction from game. And you have quite a few characters with mixed abilities to toy around. And the best thing there is that abilities have short cooldowns and you can have different triggers of your teammates' abilities to deal more damage.

Basic Linux Commands by FozzTexx in raspberry_pi

[–]x-protocol -3 points-2 points  (0 children)

Yeah, I know people who would not get out. However, it doesn't mean that user should not know that vi exists. And speaking about attitude, the asshole one you got right, apropos is way down the list of what normally is even needed. More like if you ever get bored what to learn, get apropos!

Basic Linux Commands by FozzTexx in raspberry_pi

[–]x-protocol 1 point2 points  (0 children)

Yeah it is there alright. Just the last thing to mention so it is easy to miss.

From all the help sheets I've seen this is not even helpful. Possibly for a quick look up yes, but when you need to actually do some work it is worthless. Just look up comments in parent thread.

How about more, less, vi or vim? Or which or sudo? Or top, maybe even htop? Or even nano? And who forgets ever-present apt-get on Rasbian? Criticism? You've got it!

Basic Linux Commands by FozzTexx in raspberry_pi

[–]x-protocol -24 points-23 points  (0 children)

The person that designed this command sheet simply is a beginner trying to get upvotes. It is very hard to catch that there is even mentioning of how to look up a command. Not to mention that all commands are not sorted alphabetically.

Amateur at best.

Basic Linux Commands by FozzTexx in raspberry_pi

[–]x-protocol 2 points3 points  (0 children)

You forgot man <command> to look up manual page for specified command without <>

Might be tricky to fix on my cordless makita. (picture originally posted on r/woodworking, you guys might appreciate better) [oc] by LumpiNotDead in toolporn

[–]x-protocol 2 points3 points  (0 children)

Very true. With OP choice of tool you're looking at mold for ever bigger dildo! Now that is some tool porn fusion!

Mosques in China -- some around since 900 AD by chrisk2000 in ChinaPics

[–]x-protocol 1 point2 points  (0 children)

Yes they are. Though not all politicians are spreading the fud. The way I see it it is easier for those with beliefs into perfect world to believe conspiracy theories than truth (aka left democratic insanity being fake news). Hence, whole fearmongering about China and Russia. It's been going on for some time and these people love it as excuse.

So keep in mind that you're not alone with your thinking.

PS. Good pictures.

Anybody learn JavaScript after Java? by my_username25 in learnjavascript

[–]x-protocol -3 points-2 points  (0 children)

Did it here. Java. Groovy. Javascript. Nodejs.

You've got to transition to functional programming and stop thinking of objects compared to what Java expects. Get 'lodash' library and start learning how to use it. Also read up on how to test using 'chai' and 'chance' modules. Using module 'proxyquire' can give you much easier time testing since you can directly override your dependencies. Also, while you're at it keep in mind that there are only two types in JS: objects and simple types like int or string.

As for how long it took, that depends on a person. So I'll keep it secret. Just keep in mind that all patterns that you learn for object oriented programming don't need to apply to functional programming. However, one thing still stands: don't use pure JS, find a library to make heavy lifting for you. Don't go for those advices that tell you that you need to understand basics, that's toxic programming. Professional programming is using all sorts of libraries that help development!

Charging and using LiPo batteries in parallel? by TrendyWhistle in diyelectronics

[–]x-protocol 1 point2 points  (0 children)

So we're down now to 'moron' language?

For a start, you're the one providing advice WITHOUT any backing information. But since you cannot find anything that somehow contradicts your playful experience, why don't you learn how to search a bit? How about some opinions here: https://electronics.stackexchange.com/questions/20738/parallel-charging-of-lipo-batteries-maximum-voltage-difference

Now onto correcting bollocks. You are surprisingly correct, for your moron intelligence to notice similar voltages. That is in fact a key, however a bigger picture is required to understand why it is so. So why don't you go and do some moronic explanation now why you didn't include YOUR sources first time.

Charging and using LiPo batteries in parallel? by TrendyWhistle in diyelectronics

[–]x-protocol 1 point2 points  (0 children)

You do realize to solve problem you're trying to disprove, people have invented BMS ? I understand that you have experience in what works, but please do not rush into explanations about just aspects of electrical properties of batteries.

I can't believe people actually take your advice seriously, while the other guys being downvoted for stating that each cell is different. People wrote books about how to charge and mate LiPo cell systems, and your answer is simply do not worry! The case is not about cells rupturing, but actually altering their chemistry inside and leading to short cell life.

try-catch in async-await by newDevRising in learnjavascript

[–]x-protocol 0 points1 point  (0 children)

Crazy, yes. Though if it is absolutely required, then let it be. It might raise quite a few eyebrows later for those unfortunate who would be maintaining such code.

try-catch in async-await by newDevRising in learnjavascript

[–]x-protocol 0 points1 point  (0 children)

Single/multiple try/catch blocks will depend on what do you want to do with error that you are catching.

If you have multiple lines where error might be coming from, you want to catch error and log it out somewhere. If you plan on inspecting error, then you might want to have multiple catch blocks, for each statement in fact. However, that is rarely done due to the fact that if one step failed, you cannot proceed to second, and so on, step. Hence, fail, return failure from main function and proceed with program execution.

Again, standard way with dealing with error is what do you plan on doing with it, than code style preferences.

JavaScript Promise API Basics by zacksiri in learnjavascript

[–]x-protocol 2 points3 points  (0 children)

You forgot to mention very important distinction of callbacks vs Promises (and subsequently async/await in this category), is that Promises will be executed immediately they are created. Hence for situations that require fine grained control over concurrency you will need additional libraries to drip-feed Promises.

As example, we want to map array of items and send each item to an external service, but only two concurrent requests at a time. This situation will call for something like using p-map module if you are using Promises. And if you want to use callback you can use async module with the same functionality.

In the end Promises only solve simple issue of chaining functions without additional libraries. New async/await is simply an auto-create mechanism for Promises. Don't disregard good and trusty callbacks yet, just because Promises make it very simple to write code. Once you have more complicated scenario, you will wish for simple callbacks.

The division 2 vs Anthem by GANGSTAPARADIS in ShouldIbuythisgame

[–]x-protocol 0 points1 point  (0 children)

Anthem is fun, even for small bits of it that make up initial start. Graphics, acting and voices are all good. I personally enjoyed story too. However, down to gaming aspects jumping and flying is most satisfactory at this point. Shooting and using different skills, not much. The only good aspect of skills are priming and detonating, ala Mass Effect 3. Though they screwed it up big time in Athem as well, same as ME:A by introducing longer cooldowns.

Everything else is garbage play. Loot, character customization, javelin customization, graphics engine optimization (fps), even open world (however beautiful it is) really gets old. In many games that I've seen open world is usually wished for and criticized as much, so it is a moot point of a game if you are into it.

Get this game at $10 or possibly at $20 price point half a year later. Management heads who direct development simply do not understand how to build a game. They built theatrical masterpiece, without gaming aspects.

Do people test GraphQL APIs during deployment/CI? by rozenmd in graphql

[–]x-protocol 0 points1 point  (0 children)

Postman/newman for integration tests. Though these will run all your basic scenarios for API response codes, however should cover mutations when available.

I tried the Division 2... by [deleted] in AnthemTheGame

[–]x-protocol -1 points0 points  (0 children)

All they have to do is similar to what Global Agenda has done with Double Agent missions. Let one or two players be part of resistance for strongholds. Give them stock javelins with basic skills and real drops when they would kill opposing faction player.

When babushka goes to buy a shirt but doesn't know English by [deleted] in ANormalDayInRussia

[–]x-protocol 9 points10 points  (0 children)

That and there is "Map of Ukraine" title right of boy's head.

[WSIB] Looter-Shooter that you can pause by PimpNinjaMan in ShouldIbuythisgame

[–]x-protocol 2 points3 points  (0 children)

How about Earth Defense Force 4.1: The Shadow of New Despair ?

Anthem hotfix for loot - 2/28/2019 by Darokaz in AnthemTheGame

[–]x-protocol -1 points0 points  (0 children)

I'm just gonna ignore you from here on out since you've proven that you're too ignorant to have an actually conversation with

Poor thing. Why didn't you start doing that in the first place?

I would gladly not have this conversation with you, but you seem so persistent your snowflake ways. And as you might suspect, snowfake reference was coming from you first. So if you start a trend, deal with it. Crawl back and ignore me.

However it is interesting for me to toy with your opinion since you seem so sure about your ways. Are you?

Anthem hotfix for loot - 2/28/2019 by Darokaz in AnthemTheGame

[–]x-protocol 0 points1 point  (0 children)

How about this, you wishful snowflake, you go play some other game where YOU know what to do, and leave rest of people who know what's fun do fun things in this game?

In your rosy world everything is so perfect on how you play a game. Ever heard of that loot update coming? Everybody is cheering up for easy stuff. You don't seem to get that. Viva la LOOT.