Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Asynchronous programming is the next up-and-coming paradigm... or so it seems. I have been programming in Node.js for the past few months and have been learning to write code this way. I have a coworker who works in Silverlight and I have been trying to teach him how to use the TPL. I have also been showing him the "await" keyword and how it works.
After a while, using callbacks becomes pretty normal. In Node.js, I am using the caolan/async project to avoid deeply nested callbacks. I have taken a peek at the source code, but it is like reading the STL for the very first time.
Even though I have learned a lot of techniques that work in this environment, I worry I am missing others. I was curious if there were any reading materials/videos that explained async programming techniques and how to build an async library like the TPL or caolan/async.
Just trying to master the paradigm before it's everywhere.
Well even though I know most of Async source code and how does it work, but I still use async mostly. So don't worry about that, you don't need to know exactly how it works. But as of learning, well I suggest you to read these articles:
http://book.mixu.net/node/ch7.html
http://stella.laurenzo.org/2011/03/bulletproof-node-js-coding/
http://howtonode.org/promises
http://web.archive.org/web/20120111150910/http://nodebits.org/distilled-patterns?
http://raynos.github.com/presentation/shower/controlflow.htm (from Raynos comment)
These are the best things that I've seen on the net explaining async control flow at without any abstractions.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
What factors are important? How do you know if a given programming language is "simple" or "simpler" than another language?
I'm not sure if this is a fair question to ask, since different languages serve different purposes and it might not really be comparing apples to apples.
However, with that said, memory management would come to mind. One can argue that Java is a "simpler" language than C++, since it has a garbage collector that can deal with some of the complexities around memory management, instead of forcing you to do it yourself.
In my perspective, these are the points that define the complexity of a language.
Variation of syntax from common pseudocode and constructs
Ease of developing a structure for real-life entities like objects
Methods of structure enforcement at compile time.
Memory management strategy allocation/deallocation
Code reusability
Ease of code headers and directives management
Inbuilt libraries
Relative installation package sizes
Data exchange capabilities like over network of files
Process handling like thread management
Relative brevity of the code
Speed of compilation
Developer community size and documentation
OpenSource implementations
Platform dependence
And many more could be added to this list.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Is there any rationale why HapiJS endorses using 4-space indentations?
Source: http://hapijs.com/styleguide
Short answer: No better reason than anyone else - styleguides are typically only rules for project maintainers. They had to adopt some convention and that was the choice. As a user, you don't really need to care.
Long answer: Hapi is a great framework, built by the folks at Walmart. and specifically a person named Eran Hammer who was unhappy about some architectural choices made by Express, another server framework for Node. It is somewhat opinionated in general, it was effectively created in an environment of opinion, not to mention a large company (which means it desperately needed a convention). That said, you can safely use the Hapi API with any indentation you want, including tabs, though. Likewise, the Hapi internals could have been written the same way. Their specific choice likely comes down to established tools or conventions already in use at the company. Many different projects make different choices for a variety of reasons. In my experience, many large JavaScript applications go with 2 spaces and the Node.js core itself is written with 2. But there's nothing wrong with those that do otherwise.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Hi everyone I wonder if Node.js provides doing large projects like Disqus and Ghost.
Is this possible or do we have to use minimum 1 language as additional like Python, Django, PHP?
Node.JS is a powerful, fast developing technology. It allows you to make anything you want as if you write in PHP ot Python. But there are also some nuances that can make you doubt about it, and you can read a good article about them. You will see that Node.js is suitable for big projects.
From my experience, the main trouble when you develop for Node.js even in small projects is
"Callback Hell"
Node.JS is mainly asynchronous, so performing consecutive actions turns into adding one statement in the callback function of another statement, which is situated in callback function of another...
doAsync1(function (callback) {
doAsync2(function (callback) {
doAsync3(function (callback) {
doAsync4(function (callback) {
})
})
})
This is good for performance, because the server is not locked waiting for result, but it is really painful for your eyes, especially when you need to perform large sequential operations, and it slows the development speed. Async.js can help you with it.
But everything else about Node.js is great. Using a framework such as Express and a lot of modules (it is not Python, Node.js does not have a big standard library with a lot of cool things in it) will allow you to build large projects.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
what is the best procedure to increase advance level SAS programming skill when there is no such requirement to use those concepts. Most of the time I complete my task using basic SAS concepts like set function, merge function or some other basic function. What is your suggestion if one wants to increase the programming capabilities.
I'm not going to venture a single 'best' option, but here are a few ideas:
I haven't gone down this route myself, but you could look into studying for the SAS certifications to broaden your SAS knowledge.
If you don't already know any SQL, that's something that's probably worth learning, as it's more transferable than most other SAS-related knowledge.
If you find yourself writing lots of very similar bits of code, learn how to use arrays and write macros (and when not to write macros).
If your code is taking a long time to run, read up on optimisation techniques and see if you can find faster ways of doing the same things. E.g. hash objects, indexes and parallel processing.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have to admit that I don't fully understand NodeJS. But I am thinking about using it. However what I don't understand why did the founder of NodeJS go with JavaScript? Why not with a language where for example OOP is more simple?
Ok I found some answer.
JavaScript is perfect for event loops with first class function
objects and closures. People already know how to use it this way
having used it in the browser to respond to user initiated events.
A lot of people already know JavaScript, even people who do not
claim to be programmers. It is arguably the most popular programming
language.
Using JavaScript on a web server as well as the browser reduces the
impedance mismatch between the two programming environments which can
communicate data structures via JSON that work the same on both sides
of the equation. Duplicate form validation code can be shared between
server and client, etc.
Source: What is Node.js?
But I still don't get why is it so difficult to use basic things like classes in NodeJS. Ok maybe not difficult but all the solution look like some kind of a hack job.
Edit: Why the down vote?
This question will, undoubtedly, get closed, since it's looking for opinions, but there are some objective questions in your post, so I'll answer those.
Classes are only "basic things" in OO languages that are class based, like in Java.
JavaScript is what's known as a prototypal OO language. This means that it is prototype based.
A prototype is an object that is used for generating other object. In fact, there's actually nothing special about an object that is being used as a prototype. As such, any object can be used as the prototype for a new object.
Prototypal OO can certainly be tricky if you're not used to it. However, as implemented in JS, it brings a lot of flexibility. However, with great flexibility comes great opportunities for writing bad code.