Ah, so this question is fairly old, but I'll throw in an analysis of N dịch - Ah, so this question is fairly old, but I'll throw in an analysis of N Việt làm thế nào để nói

Ah, so this question is fairly old,

Ah, so this question is fairly old, but I'll throw in an analysis of Node today (0.10~0.11), and contrast with the alternatives for building applications in the same niche (heavily I/O bound applications). Most of the points will consider the usage of Node.js with JavaScript, with some considerations for alternative languages.

Node is a neat platform, it has an attractive ecosystem, and it's got one of the only package managers that actually work. It also rides on the popularity of the JavaScript language, which gives it somewhat of a hype status. However, there are a few points where it falls short, even within the niche that it was designed for.

Bad concurrency primitives
Node's core is entirely built on top of the premise of asynchronous I/O. Being a single-threaded platform focused on I/O bound applications on top of a language that does not guarantee purity and has no support for co-routines, this is an understandable choice. It is much better than heavy-weight threads with shared state, as you have in Java and similar mainstream languages. But it's a poor model of concurrency to expose to the platform, none the less.

JavaScript doesn't really have any good primitive for concurrency (although generators will allow cooperative concurrency, and can be used experimentally in Node today), and the core, along most libraries in the ecosystem, just straight up expect you to use continuation-passing style, which leads to non-compositional code, codebases that are difficult to reason about, and lots and lots of duplication and call-site specific glueing.

In JavaScript land the alternative with most acceptance is Promises/A+, but Promises/A+ are Considered Harmful, specially due to how they automatically catch synchronous errors thrown in a function (but nothing else), and the automatic flattening of “thenables”, which leads to behaviour that is difficult to reason about, and impossibility of expressing some abstractions. Truly monadic specifications for promises were proposed, but ultimately rejected by the community and TC-39¹. With generators, people started experimenting with Communicating Sequential Processes. A move to CSP would be pretty interesting, but they're fairly experimental right now.

Single-Threaded
Node being single-threaded means that one does not need to care about the problems of synchronising between threads, or shared mutable state (given JS's semantics). However, it also means that unlike preemptive concurrency, the programmers themselves have to decide how to deal with concurrency, with the default being no concurrency at all! It's easy to write some part of the code that might take a long time to finish in some edge case, and then lock the whole system up. Not a good thing to happen.

Green threads (like in Haskell), or lightweight processes with message passing for communication (like in Erlang) would be a better idea.

Lack of maturity
Most of the core libraries have reached the status of stable, and you can trust them to usually do the right thing. But the ecosystem itself is still fairly immature. It's also difficult to assess the quality of a particular module (core or otherwise) because of the lack of features for ensuring the quality of code from JavaScript itself — for example, in Haskell you can rely on the type system, QuickCheck and SmallCheck tests, and the language semantics; JS has nothing like that (there are some ports of QuickCheck, though).

The way npm is structured also makes it quite difficult to find trustable packages, and the ease of publishing your own package, alongside the Unix-philosophy that runs through part of the community (small modules that do only one thing, and one thing well), make it harder to spot packages that are reliable and proven.

Reliance on stringly-typed² programming
There's a rampant cult of “strings are easy” in the community, which leads to many bugs due to unnecessary reliance on strings, rather than proper data structures. Some of the XSS bugs found in Express are due to this mentality. Since it's a cultural thing, and JavaScript itself doesn't do much to make the alternatives be perceived as easier, it ends up making it even harder to trust thirdy-party libraries.

Hard to make things fault-tolerant
This was somewhat alleviated with the introduction of Domain, but they're still too low level, and don't give you all of the tools necessary to make systems reliable and fault-tolerant, as Erlang/OTP does. JavaScript's semantics don't help here as well, there are no mechanisms to handle or recover from errors that are thrown asynchronously, for example, and processes in Node are not lightweight like Erlang's.

JavaScript's semantics and culture
Even if you end up using an alternative and more principled programming language, like PureScript, most of the code you'll be running on top of will have JavaScript's problems all over (and this includes Node's core). This ranges from the implicit data structures con
0/5000
Từ: -
Sang: -
Kết quả (Việt) 1: [Sao chép]
Sao chép!
Ah, so this question is fairly old, but I'll throw in an analysis of Node today (0.10~0.11), and contrast with the alternatives for building applications in the same niche (heavily I/O bound applications). Most of the points will consider the usage of Node.js with JavaScript, with some considerations for alternative languages.Node is a neat platform, it has an attractive ecosystem, and it's got one of the only package managers that actually work. It also rides on the popularity of the JavaScript language, which gives it somewhat of a hype status. However, there are a few points where it falls short, even within the niche that it was designed for.Bad concurrency primitivesNode's core is entirely built on top of the premise of asynchronous I/O. Being a single-threaded platform focused on I/O bound applications on top of a language that does not guarantee purity and has no support for co-routines, this is an understandable choice. It is much better than heavy-weight threads with shared state, as you have in Java and similar mainstream languages. But it's a poor model of concurrency to expose to the platform, none the less.JavaScript doesn't really have any good primitive for concurrency (although generators will allow cooperative concurrency, and can be used experimentally in Node today), and the core, along most libraries in the ecosystem, just straight up expect you to use continuation-passing style, which leads to non-compositional code, codebases that are difficult to reason about, and lots and lots of duplication and call-site specific glueing.In JavaScript land the alternative with most acceptance is Promises/A+, but Promises/A+ are Considered Harmful, specially due to how they automatically catch synchronous errors thrown in a function (but nothing else), and the automatic flattening of “thenables”, which leads to behaviour that is difficult to reason about, and impossibility of expressing some abstractions. Truly monadic specifications for promises were proposed, but ultimately rejected by the community and TC-39¹. With generators, people started experimenting with Communicating Sequential Processes. A move to CSP would be pretty interesting, but they're fairly experimental right now.Single-ThreadedNode being single-threaded means that one does not need to care about the problems of synchronising between threads, or shared mutable state (given JS's semantics). However, it also means that unlike preemptive concurrency, the programmers themselves have to decide how to deal with concurrency, with the default being no concurrency at all! It's easy to write some part of the code that might take a long time to finish in some edge case, and then lock the whole system up. Not a good thing to happen.Green threads (like in Haskell), or lightweight processes with message passing for communication (like in Erlang) would be a better idea.Lack of maturityMost of the core libraries have reached the status of stable, and you can trust them to usually do the right thing. But the ecosystem itself is still fairly immature. It's also difficult to assess the quality of a particular module (core or otherwise) because of the lack of features for ensuring the quality of code from JavaScript itself — for example, in Haskell you can rely on the type system, QuickCheck and SmallCheck tests, and the language semantics; JS has nothing like that (there are some ports of QuickCheck, though).
The way npm is structured also makes it quite difficult to find trustable packages, and the ease of publishing your own package, alongside the Unix-philosophy that runs through part of the community (small modules that do only one thing, and one thing well), make it harder to spot packages that are reliable and proven.

Reliance on stringly-typed² programming
There's a rampant cult of “strings are easy” in the community, which leads to many bugs due to unnecessary reliance on strings, rather than proper data structures. Some of the XSS bugs found in Express are due to this mentality. Since it's a cultural thing, and JavaScript itself doesn't do much to make the alternatives be perceived as easier, it ends up making it even harder to trust thirdy-party libraries.

Hard to make things fault-tolerant
This was somewhat alleviated with the introduction of Domain, but they're still too low level, and don't give you all of the tools necessary to make systems reliable and fault-tolerant, as Erlang/OTP does. JavaScript's semantics don't help here as well, there are no mechanisms to handle or recover from errors that are thrown asynchronously, for example, and processes in Node are not lightweight like Erlang's.

JavaScript's semantics and culture
Even if you end up using an alternative and more principled programming language, like PureScript, most of the code you'll be running on top of will have JavaScript's problems all over (and this includes Node's core). This ranges from the implicit data structures con
đang được dịch, vui lòng đợi..
Kết quả (Việt) 2:[Sao chép]
Sao chép!
Ah, vì vậy câu hỏi này là khá cũ, nhưng tôi sẽ ném vào một phân tích của Node ngày hôm nay (0.10 ~ 0.11), và tương phản với các lựa chọn thay thế cho các ứng dụng xây dựng trong cùng một niche (nhiều I / O bị ràng buộc các ứng dụng). Hầu hết các điểm sẽ xem xét việc sử dụng Node.js với JavaScript, với một số cân nhắc cho các ngôn ngữ khác. Node là một nền tảng gọn gàng, nó có một hệ sinh thái hấp dẫn, và nó có một trong những nhà quản lý gói duy nhất mà thực sự làm việc. Nó cũng cưỡi trên sự phổ biến của ngôn ngữ JavaScript, mang đến cho nó một chút của một tình trạng thổi phồng. Tuy nhiên, có một vài điểm mà nó rơi ngắn, thậm chí trong các niche rằng nó đã được thiết kế cho. Xấu đồng thời nguyên thủy lõi Node được hoàn toàn được xây dựng trên tiền đề của không đồng bộ I / O. Là một nền tảng đơn luồng tập trung vào I / O bị ràng buộc các ứng dụng trên đầu trang của một ngôn ngữ mà không đảm bảo độ tinh khiết và không có hỗ trợ cho đồng thói quen, đây là một sự lựa chọn dễ hiểu. Nó là tốt hơn nhiều so với đề nặng cân với nhà nước chia sẻ, như bạn có trong Java và ngôn ngữ chính thống tương tự. Nhưng đó là một mô hình kém đồng thời để lộ cho nền tảng này, không ít hơn. JavaScript không thực sự có bất kỳ nguyên thủy tốt cho đồng thời (mặc dù máy phát điện sẽ cho phép đồng thời hợp tác, và có thể được sử dụng thử nghiệm tại Node ngày nay), và cốt lõi, cùng hầu hết các thư viện trong hệ sinh thái, chỉ thẳng lên mong bạn để sử dụng phong cách tiếp-qua, dẫn đến phi mã cấu trúc, codebases rằng rất khó để lý do về, và rất nhiều và rất nhiều sự trùng lặp và gọi chỗ Máy dán cụ thể. trong JavaScript đất thay thế với hầu hết chấp nhận là Promises / A +, nhưng lời hứa / A + được coi là có hại, đặc biệt do cách họ tự động bắt lỗi đồng bộ ném vào một chức năng (nhưng không có gì khác), và sự làm phẳng tự động của "thenables", dẫn đến hành vi đó là khó khăn để lý do về, và bất khả thể hiện một số khái niệm trừu tượng. Quả thật chi tiết kỹ thuật monadic cho những lời hứa đã được đề xuất, nhưng cuối cùng bị từ chối bởi các cộng đồng và TC-39¹. Với máy phát điện, người ta bắt đầu thử nghiệm với Giao tiếp quá trình tuần tự. Một di chuyển để CSP sẽ là khá thú vị, nhưng họ đang khá thử nghiệm ngay bây giờ. Single-Threaded Node là đơn luồng phương tiện mà người ta không cần phải quan tâm đến vấn đề đồng bộ hóa giữa các chủ đề, hoặc chia sẻ trạng thái có thể thay đổi (được đưa ra ngữ nghĩa JS của ). Tuy nhiên, nó cũng có nghĩa là không giống như đồng thời ưu tiên, các lập trình viên phải tự quyết định làm thế nào để đối phó với đồng thời, với mặc định là không có đồng thời ở tất cả! Thật dễ dàng để viết một số phần của mã mà có thể mất một thời gian dài để kết thúc trong một số trường hợp cạnh, và sau đó khóa toàn bộ hệ thống lên. Không phải là một điều tốt để xảy ra. Đề Green (như trong Haskell), hoặc các quá trình nhẹ với thông điệp truyền cho truyền thông (như trong Erlang) sẽ là một ý tưởng tốt hơn. Thiếu sự trưởng Hầu hết các thư viện lõi đã đạt đến trạng thái ổn định, và bạn có thể tin tưởng họ thường làm điều đúng. Nhưng các hệ sinh thái chính nó vẫn còn khá non nớt. Nó cũng rất khó để đánh giá chất lượng của một module đặc biệt (lõi hay cách khác) vì thiếu các tính năng để đảm bảo chất lượng của các mã số từ JavaScript riêng của mình - ví dụ, trong Haskell bạn có thể dựa vào hệ thống các loại, QuickCheck và kiểm tra SmallCheck, và ngữ nghĩa ngôn ngữ; JS có gì giống như thế (có một số cảng của QuickCheck, mặc dù). Cách NPM được cấu trúc cũng làm cho nó khá khó khăn để tìm các gói đáng tin cậy, và dễ dàng xuất bản các gói của riêng bạn, cùng với Unix-triết lý chạy qua một phần của cộng đồng (mô-đun nhỏ mà làm một điều duy nhất, và một điều tốt), làm cho nó khó khăn hơn để phát hiện các gói là đáng tin cậy và đã được chứng minh. Reliance về lập trình stringly-typed² có một giáo phái lan tràn của "dây là dễ dàng" trong cộng đồng, trong đó dẫn đến nhiều lỗi do sự phụ thuộc không cần thiết trên dây, chứ không phải là cấu trúc dữ liệu thích hợp. Một số lỗi XSS trong Express là do tâm lý này. Vì nó là một điều văn hóa, và JavaScript tự nó không làm được gì nhiều để làm cho các lựa chọn thay thế được coi là dễ dàng hơn, nó kết thúc lên làm cho nó thậm chí còn khó khăn hơn để tin tưởng các thư viện thirdy bên. Khó để làm cho mọi việc chịu lỗi này đã phần nào xoa dịu với những giới thiệu về tên miền, nhưng họ vẫn là mức quá thấp, và không cung cấp cho bạn tất cả các công cụ cần thiết để làm cho hệ thống đáng tin cậy và chịu lỗi, như Erlang / OTP không. Ngữ nghĩa của JavaScript không giúp đỡ ở đây là tốt, không có cơ chế để xử lý hoặc phục hồi từ các lỗi được ném không đồng bộ, ví dụ, và các quá trình trong Node không nhẹ như Erlang của. Ngữ nghĩa và văn hóa của JavaScript Ngay cả khi bạn kết thúc bằng một sự thay thế và ngôn ngữ lập trình có nguyên tắc hơn, như PureScript, hầu hết các mã bạn sẽ được chạy trên sẽ có vấn đề JavaScript của hơn tất cả (và điều này bao gồm lõi Node của). Này bao gồm từ các cấu trúc dữ liệu tiềm ẩn con



























đang được dịch, vui lòng đợi..
 
Các ngôn ngữ khác
Hỗ trợ công cụ dịch thuật: Albania, Amharic, Anh, Armenia, Azerbaijan, Ba Lan, Ba Tư, Bantu, Basque, Belarus, Bengal, Bosnia, Bulgaria, Bồ Đào Nha, Catalan, Cebuano, Chichewa, Corsi, Creole (Haiti), Croatia, Do Thái, Estonia, Filipino, Frisia, Gael Scotland, Galicia, George, Gujarat, Hausa, Hawaii, Hindi, Hmong, Hungary, Hy Lạp, Hà Lan, Hà Lan (Nam Phi), Hàn, Iceland, Igbo, Ireland, Java, Kannada, Kazakh, Khmer, Kinyarwanda, Klingon, Kurd, Kyrgyz, Latinh, Latvia, Litva, Luxembourg, Lào, Macedonia, Malagasy, Malayalam, Malta, Maori, Marathi, Myanmar, Mã Lai, Mông Cổ, Na Uy, Nepal, Nga, Nhật, Odia (Oriya), Pashto, Pháp, Phát hiện ngôn ngữ, Phần Lan, Punjab, Quốc tế ngữ, Rumani, Samoa, Serbia, Sesotho, Shona, Sindhi, Sinhala, Slovak, Slovenia, Somali, Sunda, Swahili, Séc, Tajik, Tamil, Tatar, Telugu, Thái, Thổ Nhĩ Kỳ, Thụy Điển, Tiếng Indonesia, Tiếng Ý, Trung, Trung (Phồn thể), Turkmen, Tây Ban Nha, Ukraina, Urdu, Uyghur, Uzbek, Việt, Xứ Wales, Yiddish, Yoruba, Zulu, Đan Mạch, Đức, Ả Rập, dịch ngôn ngữ.

Copyright ©2025 I Love Translation. All reserved.

E-mail: