Mongodb phản ứng hình thức js

Node. js shines in real-time web apps that employ push technology over WebSocket. Node’s real-time, two-way connections—where the client and server can each initiate communication—enable the freer exchange of data

By

Tomislav Capan

Tomislav is an AWS Certified Solution Architect, developer, and technical consultant with more than 10 years of experience. Tomislav has a master’s degree in computing

SHARE

SHARE

Read the Spanish

Mongodb phản ứng hình thức js
version of this article translated by Isabella Rolz

Editor’s note. The English version of this article was updated on 10/03/2022 by our editorial team. It has been modified to include recent sources and to align with our current editorial standards

JavaScript’s popularity has brought with it a lot of changes. The things we do on the web nowadays were hard to imagine just several years ago

Before we dig into Node. js (“Node”) solutions, consider that applying JavaScript across the stack to unify the language and data format (JSON), would facilitate the optimal reuse developer resources. As this is more a benefit of JavaScript than Node. js specifically, we won’t elaborate further

With all of its advantages, Node. js plays a critical role in the technology stack of many high-profile companies who depend on its unique benefits. This Node. js tutorial addresses how to realize these advantages and why you might—or might not—use Node. js

What Is Node. js?

Node. js is composed of Google’s V8 JavaScript engine, the libUV platform abstraction layer, and a core library that is written in JavaScript. Additionally, Node. js is based on the open web stack (HTML, CSS, and JS), and operates over the standard port 80

Node. js provides developers a comprehensive tool for working in the non-blocking, event-driven I/O paradigm. Ryan Dahl, the creator of Node. js was “inspired by applications like Gmail” and—in creating Node. js—aimed to create real-time websites with push capability

After over 20 years of stateless-web based on the stateless request-response paradigm, we finally have web applications with real-time, two-way connections

Why Use Node. js?

Node. js shines in real-time web applications employing push technology over WebSocket. After over 20 years of stateless-web based on the stateless request-response paradigm, we finally have web applications with real-time, two-way connections, where both the client and server can initiate communication, allowing them to exchange data more freely. This is in stark contrast to the typical web response paradigm, where the client always initiates communication

One might argue that we’ve had this technology for years in the form of Flash and Java Applets. In reality, however, those were just sandboxed environments that used the web as a transport protocol to be delivered to the client. Plus, Flash and Java Applets were run in isolation and often operated over nonstandard ports, which may have required extra permissions

How Does Node. js Work?

Node really shines in building fast, scalable network applications. This is due to its capability of handling a huge number of simultaneous connections with high throughput

Node. js uses non-blocking, event-driven I/O to remain lightweight and efficient in the face of data-intensive real-time applications that run across distributed devices

Node. js is a platform that fills a particular need, and understanding this is absolutely essential. For example, you wouldn’t use Node. js to perform CPU-intensive operations. Nearly all of Node’s advantages are annulled if it’s used for heavy computation

Node. js is a platform that fills a particular need. It is not a silver bullet, or a platform that will dominate the web development world

Tweet

How Node. js works under the hood is interesting. Compared to traditional web-serving techniques where each connection (request) spawns a new thread (taking up system RAM and eventually maxing out at the amount of RAM available), Node. js operates on a single thread, using nonblocking I/O calls. This allows Node to support tens of thousands of concurrent connections held in the event loop

Traditional vs. Node.js Server Thread

Per Michael Abernethy’s 2011 article “Just what is Node. js?”, take a thread with an accompanying 2 MB of memory, running on a system with 8 GB of RAM, and providing a theoretical maximum of 4,000 concurrent connections. Thêm vào đó là chi phí chuyển đổi ngữ cảnh giữa các luồng và bạn sẽ có một kịch bản phổ biến trong các kỹ thuật phục vụ web truyền thống. Nút. js tránh được tất cả điều này, đạt được mức khả năng mở rộng cao

Tất nhiên, có câu hỏi về việc chia sẻ một luồng duy nhất trong số tất cả các yêu cầu của khách hàng, một cạm bẫy tiềm ẩn khi viết Node. ứng dụng js

Đầu tiên, tính toán nặng nề có thể làm tắc nghẽn luồng đơn của Node và gây ra sự cố cho tất cả các máy khách, vì các yêu cầu đến bị chặn cho đến khi quá trình tính toán nói trên hoàn tất

Thứ hai, các nhà phát triển cần cảnh giác và ngăn chặn các ngoại lệ xuất hiện ở nút lõi (trên cùng). js, vì điều này sẽ khiến Node. js để chấm dứt, làm hỏng chương trình một cách hiệu quả

Để ngăn dòng ngoại lệ, chúng tôi chuyển lỗi trở lại trình gọi dưới dạng tham số gọi lại (thay vì "ném", như chúng tôi làm trong một số môi trường khác). Nếu một ngoại lệ chưa được xử lý xuất hiện, chúng ta có thể sử dụng mô-đun Forever hoặc các công cụ bên ngoài như upstart và monit và just upstart để giám sát Nút. js và thực hiện khôi phục cần thiết cho một phiên bản bị lỗi. Lưu ý rằng những công cụ này không giải quyết việc khôi phục trạng thái hiện tại của phiên người dùng

npm. Trình quản lý gói nút

Hỗ trợ tích hợp để quản lý gói bằng npm được bao gồm trong mọi Nút. cài đặt js. The idea behind npm modules is similar to that of Ruby Gems. It is a set of publicly available, reusable components, easily installed via an online repository, with version and dependency management

npm Inc. shares a list of packaged modules that are also accessible via its npm CLI tool. The module ecosystem is open to all to publish their own module, which would be added to the npm repository

Một số mô-đun npm hữu ích bao gồm

thể hiện, thể hiện. js hoặc đơn giản là Express

Khung phát triển web lấy cảm hứng từ Sinatra cho Node. js và tiêu chuẩn thực tế cho phần lớn Node. ứng dụng js

hapi

Khung tập trung vào cấu hình mô-đun và dễ sử dụng để xây dựng các ứng dụng web và dịch vụ

liên kết

Khung máy chủ HTTP có thể mở rộng cho Node. js, cung cấp một tập hợp các plugin hiệu suất cao được gọi là phần mềm trung gian;

ổ cắm. io và sockjs

Một thành phần phía máy chủ của hai thành phần WebSocket phổ biến

pug (trước đây là Jade)

Một công cụ tạo khuôn mẫu lấy cảm hứng từ HAML, một công cụ mặc định trong Express. js

mongodb and mongojs

Trình bao bọc MongoDB để cung cấp API cho cơ sở dữ liệu đối tượng MongoDB trong Node. js

làm lại

Thư viện máy khách Redis

lodash, gạch dưới, lười biếng. js

The JavaScript utility belt. Underscore bắt đầu trò chơi nhưng bị lật đổ bởi một trong hai đối tác của nó, chủ yếu là do lười biếng. js' hiệu suất tốt hơn và triển khai mô-đun

mãi mãi

Một tiện ích để đảm bảo rằng tập lệnh nút đã cho chạy liên tục; . js process up in production in the face of any unexpected failures

bluebird

A full-featured Promises/A+ implementation with exceptionally good performance

moment. js

A JavaScript date library for parsing, validating, manipulating, and formatting dates

Where to Use Node. js

Chat

Chat is a typical real-time, multi-user application—from IRC (back in the day)—to modern implementations in Node. js with WebSocket

Ứng dụng trò chuyện nhẹ, lưu lượng truy cập cao và sử dụng nhiều dữ liệu (nhưng khả năng xử lý/tính toán thấp). Nó chạy trên các thiết bị phân tán và là ví dụ điển hình cho Node. js

Đơn giản, nhưng bao gồm hầu hết các mô hình mà bạn sẽ sử dụng trong một Nút điển hình. js, trò chuyện là một trường hợp sử dụng tuyệt vời cho việc học

Hãy mô tả cách trò chuyện hoạt động. Giả sử chúng tôi có một phòng trò chuyện duy nhất nơi người dùng có thể trao đổi tin nhắn theo kiểu một-nhiều (thực tế là tất cả). Cũng giả sử có ba người dùng được kết nối với bảng tin của chúng tôi

Về phía máy chủ, một Express đơn giản. triển khai ứng dụng js

  1. Trình xử lý yêu cầu GET / phục vụ trang web chứa bảng tin và nút 'Gửi' để khởi tạo đầu vào tin nhắn mới và
  2. Máy chủ WebSocket lắng nghe các tin nhắn mới do máy khách WebSocket phát ra

Về phía khách hàng, chúng tôi có một trang HTML với một số trình xử lý được thiết lập

  1. Trình xử lý cho sự kiện nhấp vào nút 'Gửi', nhận thông báo đầu vào và gửi nó xuống WebSocket
  2. Trình xử lý lắng nghe các tin nhắn đến mới trên máy khách WebSocket (i. e. , thông báo do người dùng tạo mà máy chủ muốn máy khách hiển thị)

Khi một khách hàng đăng một tin nhắn, đây là những gì sẽ xảy ra

  1. Trình duyệt bắt nút 'Gửi' khi nhấp qua trình xử lý JavaScript. Nó chọn giá trị từ trường đầu vào (i. e. , văn bản tin nhắn) và phát ra một tin nhắn WebSocket bằng ứng dụng khách WebSocket được kết nối với máy chủ của chúng tôi (được khởi tạo khi khởi tạo trang web)
  2. Thành phần phía máy chủ của kết nối WebSocket nhận tin nhắn và chuyển tiếp nó tới tất cả các máy khách được kết nối khác, sử dụng phương thức quảng bá
  3. Tất cả máy khách nhận được tin nhắn mới dưới dạng tin nhắn đẩy, thông qua thành phần phía máy khách WebSocket chạy trong trang web. Sau đó, khách hàng chọn nội dung tin nhắn và cập nhật trang web tại chỗ, bằng cách thêm tin nhắn mới vào bảng
Client and Server WebSockets in a Node.js Application

Đây là một ví dụ đơn giản về trò chuyện thời gian thực với NodeJS, Socket. io và ExpressJS

Để có giải pháp hiệu quả hơn, bạn có thể sử dụng bộ đệm đơn giản dựa trên cửa hàng Redis. Hoặc trong một giải pháp nâng cao hơn nữa, hãy sử dụng hàng đợi tin nhắn để xử lý việc định tuyến tin nhắn đến máy khách và cơ chế phân phối mạnh mẽ hơn. Hàng đợi có thể bao gồm mất kết nối tạm thời hoặc lưu trữ tin nhắn cho khách hàng đã đăng ký khi họ ngoại tuyến

Bất kể giải pháp bạn chọn là gì, Node. js hoạt động theo các nguyên tắc cơ bản giống nhau. phản ứng với các sự kiện, xử lý nhiều kết nối đồng thời và duy trì tính trôi chảy trong trải nghiệm người dùng

API trên đầu DB đối tượng

Nút. js là sự phù hợp tự nhiên để hiển thị dữ liệu từ các DB đối tượng (e. g. , MongoDB). Dữ liệu được lưu trữ JSON cho phép Node. js hoạt động mà không có trở kháng không phù hợp và chuyển đổi dữ liệu

Chẳng hạn, nếu bạn đang sử dụng Rails, bạn sẽ chuyển đổi từ JSON sang mô hình nhị phân, sau đó hiển thị chúng trở lại dưới dạng JSON qua HTTP khi dữ liệu được sử dụng bởi Backbone. js, Angular. js, v.v. —hoặc thậm chí các cuộc gọi jQuery AJAX đơn giản. với nút. js, bạn có thể hiển thị các đối tượng JSON bằng API REST để máy khách sử dụng

Nếu bạn đang sử dụng MongoDB, bạn không cần lo lắng về việc chuyển đổi giữa JSON và bất kỳ thứ gì khác khi đọc hoặc ghi từ cơ sở dữ liệu. Do đó, bạn có thể tránh nhu cầu chuyển đổi nhiều lần bằng cách sử dụng định dạng tuần tự hóa dữ liệu thống nhất trên máy khách, máy chủ và cơ sở dữ liệu

Đầu vào xếp hàng

Nút cho phép bạn linh hoạt đẩy việc xóa sổ cơ sở dữ liệu sang một bên. Nhưng thậm chí còn có nhiều lý do hơn để sử dụng Node. js

Nếu bạn đang nhận một lượng lớn dữ liệu đồng thời, cơ sở dữ liệu của bạn có thể trở thành nút cổ chai. Nút. js có thể dễ dàng xử lý các kết nối đồng thời. Bởi vì—trong trường hợp này—việc truy cập cơ sở dữ liệu là một thao tác ngăn chặn, nên chúng tôi gặp rắc rối. Giải pháp là thừa nhận hành vi của khách hàng trước khi dữ liệu thực sự được ghi vào cơ sở dữ liệu

Cách tiếp cận này cho phép hệ thống duy trì khả năng phản hồi khi tải nặng. Tính năng này đặc biệt hữu ích khi khách hàng không yêu cầu xác nhận chắc chắn về việc ghi dữ liệu thành công, khi ghi nhật ký hoặc ghi dữ liệu theo dõi người dùng, được xử lý theo lô, để sử dụng sau này hoặc cho các hoạt động không cần thiết

Dữ liệu được xếp hàng đợi thông qua một số loại bộ nhớ đệm hoặc cơ sở hạ tầng xếp hàng tin nhắn như RabbitMQ hoặc ZeroMQ. Sau đó, nó được tiêu hóa bởi một quy trình ghi hàng loạt cơ sở dữ liệu riêng biệt hoặc dịch vụ phụ trợ xử lý tính toán chuyên sâu, được viết trên một nền tảng hoạt động tốt hơn cho tác vụ như vậy

Database Batch-write in Node.js With Message Queuing.

Nói ngắn gọn. Với Node, bạn có thể đẩy việc ghi cơ sở dữ liệu sang một bên để xử lý sau

Truyền dữ liệu

Tại sao không sử dụng Nút. js trong truyền dữ liệu? . Chúng ta có thể sử dụng quan sát này để xây dựng một số Node thú vị. tính năng js

Ví dụ: chúng tôi có thể xử lý tệp trong khi chúng vẫn đang được tải lên. Khi dữ liệu đến qua một luồng, chúng tôi có thể xử lý dữ liệu song song trong quá trình tải lên đó. Điều này đúng với mã hóa âm thanh hoặc video thời gian thực và ủy quyền giữa các nguồn dữ liệu khác nhau

Ủy quyền

Nút. js dễ dàng được sử dụng làm proxy phía máy chủ, nơi nó có thể xử lý một lượng lớn kết nối đồng thời theo cách không chặn. Nó hữu ích cho việc ủy ​​quyền các dịch vụ khác nhau với thời gian phản hồi khác nhau hoặc thu thập dữ liệu từ nhiều điểm nguồn

Ví dụ: hãy xem xét ứng dụng phía máy chủ giao tiếp với tài nguyên của bên thứ ba, lấy dữ liệu từ các nguồn khác nhau hoặc lưu trữ nội dung (như hình ảnh và video) vào dịch vụ đám mây của bên thứ ba

Sử dụng Nút thay cho máy chủ proxy chuyên dụng có thể hữu ích nếu cơ sở hạ tầng ủy quyền của bạn không tồn tại hoặc nếu bạn cần một giải pháp để phát triển cục bộ. Bằng cách này, ý tôi là bạn có thể xây dựng ứng dụng phía máy khách bằng Node. máy chủ phát triển js cho nội dung và yêu cầu ủy quyền/sơ khai API. Trong sản xuất, bạn sẽ xử lý các tương tác như vậy với dịch vụ proxy chuyên dụng (như nginx hoặc HAProxy)

Môi giới/Bảng điều khiển của nhà giao dịch chứng khoán

Ở cấp độ ứng dụng, phần mềm giao dịch của nhà môi giới là một ví dụ khác trong đó phần mềm máy tính chiếm ưu thế, nhưng có thể dễ dàng thay thế bằng giải pháp web thời gian thực. Phần mềm giao dịch của nhà môi giới theo dõi giá cổ phiếu, thực hiện tính toán và phân tích kỹ thuật, đồng thời hiển thị đồ thị và biểu đồ

Tại sao không sử dụng Nút. js to write a real-time web-based solution for brokers? Then, brokers could easily switch workstations or work locations. Chúng tôi có thể sớm gặp các nhà môi giới của mình trên bãi biển ở Florida hoặc Ibiza hoặc Bali

Bảng điều khiển giám sát ứng dụng

Hãy tưởng tượng bạn có thể phát triển doanh nghiệp của mình như thế nào nếu bạn có thể thấy khách truy cập của mình đang làm gì trong thời gian thực. With Node’s real-time, two-way sockets, you can gain this ability

Node with WebSocket fits perfectly for tracking website visitors and visualizing their interactions in real time

Reasons to use Node. js for a monitoring dashboard include gathering real-time stats from users, or introducing targeted interactions with your visitors by opening a communication channel at a specific point in your funnel. CANDDi productizes this idea

System Monitoring Dashboard

Now, let’s visit the infrastructure side of things. Imagine, for example, a SaaS provider that wants to offer users a service monitoring page, like GitHub’s status page. With Node. js’s event-loop, we can create a powerful web-based dashboard that checks services’ statuses in an asynchronous manner, pushing data to clients using WebSocket

Both internal (intracompany) and public services’ statuses can be reported live and in real time using this technology. Push a little further and try to imagine a network operations center (NOC) that monitors the applications of a telecommunications operator, cloud/network/hosting provider, or some financial institution. The applications would run on the open web stack backed by Node. js and WebSocket

Don’t try to build hard real-time systems in Node (i. e. , systems requiring consistent response times). Erlang is probably a better choice for that class of application

Where to Use Node. js, but Cautiously

Server-side Web Applications

With Node. js with Express. js, you can create classic web applications on the server side. While possible, this request-response paradigm in which Node. js would carry rendered HTML is not an ideal use case. There are arguments to be made for and against this approach. Here are some facts to consider

Pros

  • You can significantly ease the development of an application that does not require CPU-intensive computation, by using Javascript to build it top to bottom, even down to the database level—if you use JSON storage Object DB (e. g. , MongoDB)
  • Crawlers receive a fully rendered HTML response, which is far more SEO friendly than, say, a Single Page Application or a WebSocket app that runs on top of Node. js

Cons

  • Any CPU-intensive computation will block Node. js responsiveness, so a threaded platform is a better approach. Alternatively, you could try scaling out the computation
  • Using Node. js with a relational database can be painful. If you’re trying to perform relational operations, consider going with an environment such as Rails, Django, or ASP. Net MVC

An alternative to CPU-intensive computations is to create a highly scalable MQ-backed environment with back-end processing to keep Node as a front-facing “clerk” to handle client requests asynchronously

Where Not to Use Node. js

There are situations where Node may not be the best tool for the job

Server-side Web Application With a Relational Database Application

Ruby on Rails was once the clear choice as a tool to access relational databases like PostgreSQL, MySQL, and Microsoft SQL Server. This was because relational DB tools for Node. js were still in their early stages while, in contrast, Rails automatically provided data access setup right out of the box, together with DB schema migrations support tools, and other Gems (pun intended). Rails and its peer frameworks have mature and proven Active Record or Data Mapper data access layer implementations

It’s possible and not uncommon to use Node solely on the front end, while keeping your Rails back end with its easy access to a relational DB

But things have changed. Sequelize, TypeORM, and Bookshelf have come a long way toward becoming mature ORM solutions. It might also be worth checking out Join Monster if you’re looking to generate SQL from GraphQL queries

Heavy Server-side Computation and/or Processing

Node. js is not the best platform to handle heavy computation. No, you definitely don’t want to build a Fibonacci computation server in Node. js

In general, any CPU-intensive operation annuls all the throughput benefits Node offers with its event-driven, nonblocking I/O model. This is because incoming requests are blocked while the thread is occupied with your number-crunching—assuming you’re trying to run computations in the same Node instance used to respond to requests

Since Node. js is single-threaded and uses only a single CPU core, it would require considerable effort to develop a cluster module in order to deliver concurrency on a multicore server. Alternatively, you can run several Node. js server instances pretty easily behind a reverse proxy via nginx

With clustering, you should still offload all heavy computation to background processes. Ensure that you use an appropriate environment for the background processes, and that they communicate via a message queue server like RabbitMQ

While you may run background processes on the main server, this approach may not scale well once the load increases. You may distribute background processing services to separate worker servers without the need to configure the loads of front-facing web servers

With Node. js—as opposed to most other platforms—you enjoy that high reqs/sec throughput we talked about, as each request is a small task that Node handles quickly and efficiently

Why Choose Node. js?

We discussed Node. js from theory to practice, beginning with its purpose, and ending with its sweet spots and pitfalls

Problems with Node almost always originate from the fact that blocking operations are the root of all evil—and 99% of Node misuses are a direct consequence

In Node, blocking operations are the root of all evil—99% of Node misuses are a direct consequence

Tweet

If your use case does not contain CPU-intensive operations, nor accesses blocking resources, you can exploit the benefits of Node. js and enjoy fast and scalable network applications. Welcome to the real-time web

Understanding the basics

What is Node. js?

Node. js is a server-side, open-source, JavaScript runtime environment. Node uses Google's V8 engine---libUV---to deliver cross-platform compatibility and a core library. Notably, Node. js does not expose a global window object, since it does not run within a browser

What is Node. js used for?

Because Node. js là một luồng, chúng tôi sử dụng nó chủ yếu cho các máy chủ hướng sự kiện, không chặn. We can also use Node. js for traditional websites and back-end API services, as it was designed with real-time, push-based architectures in mind

What is a web framework?

Web frameworks like Angular and React are libraries that help organize and generate the front-end code that runs in a web browser. Web frameworks reuse code for common operations, thereby reducing development time. Some web frameworks are full stack

là nút. js là một khuôn khổ?

No, Node. js is an environment. Back-end frameworks run within Node. js. Popular, compatible frameworks include Express. js (also referred to as Express) for HTTP servers and Socket. IO for WebSocket servers

Is Node. js a programming language?

Node. js is not a programming language. The ". js" at the end of its name indicates that JavaScript is its associated programming language. Anything that can transpile to JavaScript---like TypeScript, Haxe, or CoffeeScript---can also be used with Node. js

Aside from its being highly effective, Node. js is popular because of its huge, active, open-source, JavaScript-based ecosystem

What is the difference between Node. js and Angular/AngularJS?

The Node. js runtime environment executes JavaScript code on the server, whereas Angular is a JavaScript framework that is executed on the client (i. e. , within a web browser)

Why is Node. js bad?

Node. js isn't bad. Its technology is widely used for many types of servers. However, because it’s single-threaded, Node. js is not ideal for web servers that double as computational servers---such heavy computation would block the server's responsiveness

Tags

JavaScriptI/ONode. js

Freelancer? Find your next job.

JavaScript Developer Jobs

View full profile

Tomislav Capan

Cloud Solution Architect and Lead Developer

About the author

Tomislav is a software engineer, technical consultant, and solution architect who began as a technical partner for an online media business, growing it from zero to over 100,000 monthly readers. After years in software engineering, he now provides technical leadership through consulting and architecting dynamic, reliable, and scalable cloud solutions to support business growth and optimize complex architectures gone wrong. As an infrastructure lead, he makes the cloud a friendly place

Hire Tomislav

Comments

Anony Mouse

For relational DBs on Node, I like http. //bookshelfjs. org/

Anony Mouse

For relational DBs on Node, I like http. //bookshelfjs. org/

Adin Scannell

Awesome article. I definitely agree that node. js has some really perfectly suited use cases. However, I do want to comment on something that is a bit of a pet peeve of mine -- I wish you wouldn't contrast it with a non-existent straw-man "traditional" system in "how it works". 1) No server spawns a thread per request (they use thread pools or process pools). 2) You say "cost of context switching" as if it only applies to OS threads. Userspace frames need to be saved and loaded in the same way. Plus the OS does it with a few instructions, leveraging specialized support from the hardware -- which userspace can't do. 3) Similarly, userspace threads (I. e. frames or closures if you don't want to talk threads) take memory resources in the same way kernel threads do. It's not as if each system thread has it's full stack limit allocated, so that's an unfair analysis. Normal systems regularly have more than 4000 without coming anywhere near where you've pegged it. 4) The BIG problem with single-thread concurrency is the lack of parallelism. Sure, you can handle thousands of requests per second, but only one CPU on your 40 core server is going to doing ANY work. Anyways, all the above is in regard to a pretty minor paragraph in your excellent post. Node isn't really guilty of this, it's just that there's a lot of FUD out there around threads and processes which people often use to justify insane designs (and avoid threads when they are completely the right approach for the majority of situations)

Adin Scannell

Awesome article. I definitely agree that node. js has some really perfectly suited use cases. However, I do want to comment on something that is a bit of a pet peeve of mine -- I wish you wouldn't contrast it with a non-existent straw-man "traditional" system in "how it works". 1) No server spawns a thread per request (they use thread pools or process pools). 2) You say "cost of context switching" as if it only applies to OS threads. Userspace frames need to be saved and loaded in the same way. Plus the OS does it with a few instructions, leveraging specialized support from the hardware -- which userspace can't do. 3) Similarly, userspace threads (I. e. frames or closures if you don't want to talk threads) take memory resources in the same way kernel threads do. It's not as if each system thread has it's full stack limit allocated, so that's an unfair analysis. Normal systems regularly have more than 4000 without coming anywhere near where you've pegged it. 4) The BIG problem with single-thread concurrency is the lack of parallelism. Sure, you can handle thousands of requests per second, but only one CPU on your 40 core server is going to doing ANY work. Anyways, all the above is in regard to a pretty minor paragraph in your excellent post. Node isn't really guilty of this, it's just that there's a lot of FUD out there around threads and processes which people often use to justify insane designs (and avoid threads when they are completely the right approach for the majority of situations)

Eric Elliott

All your advice about computation heavy apps could not be more wrong. It's certainly true that attempting heavy computation inline with the request-response cycle, is a bad idea, but the same could be said of threaded environments. If you have CPU bound operations, it's a good idea to handle them with worker processes. JavaScript, and Node in particular are actually very well suited to handle distributed computation - especially with the good support for functional style programming. If you write your algorithms using pure functions and distribute workload to workers, you can easily distribute your workload over networked clusters. Node's great support for networking makes it an ideal environment both for computing and orchestration tasks, and it's orders of magnitude faster than Ruby at both

Eric Elliott

All your advice about computation heavy apps could not be more wrong. It's certainly true that attempting heavy computation inline with the request-response cycle, is a bad idea, but the same could be said of threaded environments. If you have CPU bound operations, it's a good idea to handle them with worker processes. JavaScript, and Node in particular are actually very well suited to handle distributed computation - especially with the good support for functional style programming. If you write your algorithms using pure functions and distribute workload to workers, you can easily distribute your workload over networked clusters. Node's great support for networking makes it an ideal environment both for computing and orchestration tasks, and it's orders of magnitude faster than Ruby at both

jim thomas

Very helpful. Thanks a lot

jim thomas

Very helpful. Thanks a lot

Roland

You certainly don't want to block any Node. js process that is handling server requests, but that doesn't mean you shouldn't do heavy computations behind a Node. js server. So long as the process doing the heavy computations is spawned asynchronously from your server process. Still you could end up blocking your Node. js process if you overdue it, but that is also true with the traditional threaded server

Roland

You certainly don't want to block any Node. js process that is handling server requests, but that doesn't mean you shouldn't do heavy computations behind a Node. js server. So long as the process doing the heavy computations is spawned asynchronously from your server process. Still you could end up blocking your Node. js process if you overdue it, but that is also true with the traditional threaded server

Danny Machal

This is going to make me out to be a giant noob but can you give me an example of a "blocking operation" ?

Danny Machal

This is going to make me out to be a giant noob but can you give me an example of a "blocking operation" ?

irneb

Any such hybrid system? I'm thinking. Use Node. js to process a request by simply placing it onto a to-process queue, return a message to the client stating something like "calculating. ". Then Node. js is free to continue with the next request. The to-process queue can then be run through using a difference thread (or even multiple threads). As and when these complete, they send their results to Node. js's queue which will then relay it back to the original client? Of course this means some ID key needs to accompany each item in this queue to ensure the correct data is returned to the correct client. Anything like this possible? Or even already implemented?

irneb

Any such hybrid system? I'm thinking. Use Node. js to process a request by simply placing it onto a to-process queue, return a message to the client stating something like "calculating. ". Then Node. js is free to continue with the next request. The to-process queue can then be run through using a difference thread (or even multiple threads). As and when these complete, they send their results to Node. js's queue which will then relay it back to the original client? Of course this means some ID key needs to accompany each item in this queue to ensure the correct data is returned to the correct client. Anything like this possible? Or even already implemented?

zivkovic_milan

Great article, thanks . )

zivkovic_milan

Great article, thanks . )

Gerd Jungbluth

Tomislav, thanks for this very well written and concise article. We 've been using MongoDB and Node. js (in combination with AngularJS for the user facing part) for > 2 years now and couldn't imagine to ever, ever, ever switch back to Flash (after 10 years of experience) or JEE / RDMS. So it boils down to just one programming language (JS), one data format (JSON) and one programming paradigma (Async), wow

Gerd Jungbluth

Tomislav, thanks for this very well written and concise article. We 've been using MongoDB and Node. js (in combination with AngularJS for the user facing part) for > 2 years now and couldn't imagine to ever, ever, ever switch back to Flash (after 10 years of experience) or JEE / RDMS. So it boils down to just one programming language (JS), one data format (JSON) and one programming paradigma (Async), wow

chad

That's by far the best explanation out there about Node. js. Cuối cùng tôi đã hiểu rằng nó rất hữu ích (trong một số tình huống nhất định) và không chỉ là sự cường điệu. Thanks a lot this was very informative

chad

That's by far the best explanation out there about Node. js. Cuối cùng tôi đã hiểu rằng nó rất hữu ích (trong một số tình huống nhất định) và không chỉ là sự cường điệu. Thanks a lot this was very informative

ellisgl

Nút hoạt động tốt với cơ sở dữ liệu quan hệ, chỉ cần không sử dụng ORM. SQL không khó để học. =)

ellisgl

Nút hoạt động tốt với cơ sở dữ liệu quan hệ, chỉ cần không sử dụng ORM. SQL không khó để học. =)

Tomislav Capan

Đúng vậy, nhưng tôi nghĩ chúng ta với tư cách là một ngành công nghiệp đã vượt qua ý tưởng viết tất cả SQL theo cách thủ công. Các công cụ rất tốt cho các hoạt động thông thường, các công cụ giúp bạn viết một số chi tiết cụ thể theo cách thủ công, nếu không sẽ giảm khả năng xảy ra lỗi và các vấn đề bảo mật (điều đó xảy ra với nhiều nhà phát triển cơ sở hơn cho dù chúng ta có muốn hay không)

Tomislav Capan

Đúng vậy, nhưng tôi nghĩ chúng ta với tư cách là một ngành công nghiệp đã vượt qua ý tưởng viết tất cả SQL theo cách thủ công. Các công cụ rất tốt cho các hoạt động thông thường, các công cụ giúp bạn viết một số chi tiết cụ thể theo cách thủ công, nếu không sẽ giảm khả năng xảy ra lỗi và các vấn đề bảo mật (điều đó xảy ra với nhiều nhà phát triển cơ sở hơn cho dù chúng ta có muốn hay không)

Tomislav Capan

Xin chào Adin, cho phép tôi bình luận lại 1) kịch bản tương tự xảy ra, có một số lượng chủ đề giới hạn phục vụ số lượng khách hàng hạn chế. 2/3) Bản trình bày tham chiếu cho thấy một số phép đo và con số, bạn có thể khá đúng về phần bên trong nhưng tổng quan sơ bộ chung vẫn là một so sánh chung về cách mọi thứ hoạt động giữa hai thế giới đó. 4) các tùy chọn song song hóa cũng được thảo luận trong bài viết - dưới dạng các quy trình công nhân nền hoặc một số quy trình nút phía sau proxy ngược hoặc với API phân cụm nút (vẫn còn trong Thử nghiệm, nhưng cuối cùng sẽ có). Cảm ơn những bình luận tuyệt vời và phản hồi chất lượng về bài viết với thông tin bổ sung đó, tôi đánh giá cao nó

Tomislav Capan

Xin chào Adin, cho phép tôi bình luận lại 1) kịch bản tương tự xảy ra, có một số lượng chủ đề giới hạn phục vụ số lượng khách hàng hạn chế. 2/3) Bản trình bày tham chiếu cho thấy một số phép đo và con số, bạn có thể khá đúng về phần bên trong nhưng tổng quan sơ bộ chung vẫn là một so sánh chung về cách mọi thứ hoạt động giữa hai thế giới đó. 4) các tùy chọn song song hóa cũng được thảo luận trong bài viết - dưới dạng các quy trình công nhân nền hoặc một số quy trình nút phía sau proxy ngược hoặc với API phân cụm nút (vẫn còn trong Thử nghiệm, nhưng cuối cùng sẽ có). Cảm ơn những bình luận tuyệt vời và phản hồi chất lượng về bài viết với thông tin bổ sung đó, tôi đánh giá cao nó

Tomislav Capan

Có, bạn có thể có nhiều worker process, thậm chí giao tiếp qua Message Queue (MQ). Những công nhân đó có thể là các quy trình Nút riêng biệt (vì nút là một luồng, trừ khi bạn thử nghiệm API phân cụm - Tôi chưa thử vì API còn rất sớm và có thể chưa hoàn thiện), nhưng có thể là bất kỳ ngôn ngữ nào khác. Tôi đã làm việc trên một hệ thống chạy C# trên Mono để xử lý nền trong kiến ​​trúc CQRS phân tán

Tomislav Capan

Có, bạn có thể có nhiều worker process, thậm chí giao tiếp qua Message Queue (MQ). Những công nhân đó có thể là các quy trình Nút riêng biệt (vì nút là một luồng, trừ khi bạn thử nghiệm API phân cụm - Tôi chưa thử vì API còn rất sớm và có thể chưa hoàn thiện), nhưng có thể là bất kỳ ngôn ngữ nào khác. Tôi đã làm việc trên một hệ thống chạy C# trên Mono để xử lý nền trong kiến ​​trúc CQRS phân tán

Tomislav Capan

Bất kỳ tính toán nào khiến CPU bận rộn cho đến khi tính toán kết thúc. Imagine some operation that requires 2 seconds to perform the calculation. Hit that with 100 clients - you get a 200-sec delay. Note the article I have referenced, which explains the blocking of the event loop. http. //zef. me/4561/node-js-and-the-case-of-the-blocked-event-loop

Tomislav Capan

Bất kỳ tính toán nào khiến CPU bận rộn cho đến khi tính toán kết thúc. Imagine some operation that requires 2 seconds to perform the calculation. Hit that with 100 clients - you get a 200-sec delay. Note the article I have referenced, which explains the blocking of the event loop. http. //zef. me/4561/node-js-and-the-case-of-the-blocked-event-loop

Tomislav Capan

Yes, that falls under the idea of having 'backend worker processes' in a distributed system. As the system is distributed, those workers can use any language/platform, including Node

Tomislav Capan

Yes, that falls under the idea of having 'backend worker processes' in a distributed system. As the system is distributed, those workers can use any language/platform, including Node

Tomislav Capan

Thanks for your feedback. I agree on that completely, for worker processes you could use JS when it fits, and that implies Node. js as that's what runs JS on the server, but you can also use other languages that do the particular work at hand fast

Tomislav Capan

Thanks for your feedback. I agree on that completely, for worker processes you could use JS when it fits, and that implies Node. js as that's what runs JS on the server, but you can also use other languages that do the particular work at hand fast

ellisgl

For ORMs in general, I just see them as a tool that can get something done quick for a newbie, but end up really gumming up the works later on. The closest thing I use for an ORM is a PDO wrapper (which I borrowed and rewrote from an old co-worker), that helps with writing PDO statements. https. //github. com/ellisgl/GeekLab-XPDO

ellisgl

For ORMs in general, I just see them as a tool that can get something done quick for a newbie, but end up really gumming up the works later on. The closest thing I use for an ORM is a PDO wrapper (which I borrowed and rewrote from an old co-worker), that helps with writing PDO statements. https. //github. com/ellisgl/GeekLab-XPDO

Adin Scannell

Apologies for the wall of text. Excellent discussion. 1) Agreed. But threads and processes are powerful tools. That's why a hybrid of threads/processes and event systems typically does best in the real world. Like the much beloved nginx . ) 2/3) Sorry, I may not have been clear. When I said FUD regarding threads and processes, I *meant the referenced presentation*. It's just a bunch of specifically tailored microbenchmarks designed to prove a certain point. (Which is fair, given that it's a lightning fair and can be a bit polemic. In fact, it's a great talk. But these synthetic micro-benchmarks are not the basis for a fair and through comparison. ) To say the difference between nginx and apache benchmarks is purely because of context switching is an extreme oversimplification. Nginx is specifically designed to serve HTTP requests really, really quickly in common circumstances (IMO generally by a tight coupling with the latest OS event systems, etc. ). You could specifically measure the overhead of context switching, and I would wager it's trivial. 4) But then aren't you at the mercy of the horrible "process overhead" the referenced presentation talks about -- can't have it both ways . ) (To be clear, my position using threads/processes or whatever is not in and of itself a problem. There are way more important design factors there, the OS overhead of those entities is pretty trivial. Hence I hate it when people adopt a silly design based on the idea thread-are-bad or processes-are-bad or some other such nonesense)

Adin Scannell

Apologies for the wall of text. Excellent discussion. 1) Agreed. But threads and processes are powerful tools. That's why a hybrid of threads/processes and event systems typically does best in the real world. Like the much beloved nginx . ) 2/3) Sorry, I may not have been clear. When I said FUD regarding threads and processes, I *meant the referenced presentation*. It's just a bunch of specifically tailored microbenchmarks designed to prove a certain point. (Which is fair, given that it's a lightning fair and can be a bit polemic. In fact, it's a great talk. But these synthetic micro-benchmarks are not the basis for a fair and through comparison. ) To say the difference between nginx and apache benchmarks is purely because of context switching is an extreme oversimplification. Nginx is specifically designed to serve HTTP requests really, really quickly in common circumstances (IMO generally by a tight coupling with the latest OS event systems, etc. ). You could specifically measure the overhead of context switching, and I would wager it's trivial. 4) But then aren't you at the mercy of the horrible "process overhead" the referenced presentation talks about -- can't have it both ways . ) (To be clear, my position using threads/processes or whatever is not in and of itself a problem. There are way more important design factors there, the OS overhead of those entities is pretty trivial. Hence I hate it when people adopt a silly design based on the idea thread-are-bad or processes-are-bad or some other such nonesense)

Tomislav Capan

Everything always needs to be put in the right context. I have presented possible situations, to analyze each one deeply I'd need a book . -) Still, I really appreciate your comments and insights, they are valuable addition to the article. Thank you for those

Tomislav Capan

Everything always needs to be put in the right context. I have presented possible situations, to analyze each one deeply I'd need a book . -) Still, I really appreciate your comments and insights, they are valuable addition to the article. Thank you for those

Aaron Wang

When use node. js as api server, and the back-end db is the bottleneck, if the clients are the other applications, not user interface, can we just let these client requests hang there waiting for db operation complete(sine node. js can handle massive concurrent connections easily)? Is a MQ necessary in this scenario? In my opinion, node. js is right the queue

Aaron Wang

When use node. js as api server, and the back-end db is the bottleneck, if the clients are the other applications, not user interface, can we just let these client requests hang there waiting for db operation complete(sine node. js can handle massive concurrent connections easily)? Is a MQ necessary in this scenario? In my opinion, node. js is right the queue

Ethan

ORM does not exist to make query languages "easier", it's a tool used to encapsulate database concerns, isolating them from the application. There are several benefits, but ultimately, it makes applications easier to test and maintain years down the road. Excuse the tangent, nothing to do with node

Ethan

ORM does not exist to make query languages "easier", it's a tool used to encapsulate database concerns, isolating them from the application. There are several benefits, but ultimately, it makes applications easier to test and maintain years down the road. Excuse the tangent, nothing to do with node

Eric Elliott

Yes, you could, but Ruby would be a poor choice if your aim is performance. =)

Eric Elliott

Yes, you could, but Ruby would be a poor choice if your aim is performance. =)

Vedran

thank you for a great article. By using the node. js child process http. //nodejs. org/api/child_process. html - would you be able to overcome the high computational blocking Fibonacci issue?

Vedran

thank you for a great article. By using the node. js child process http. //nodejs. org/api/child_process. html - would you be able to overcome the high computational blocking Fibonacci issue?

nene odonkor

any real life examples?

nene odonkor

any real life examples?

nene odonkor

What of the Facebook example you used. When a user clicks on the like button there is an immediate acknowledgement but the data is written later. Cant that be an example of node used with relational db? Anyway what makes up the message queue?

nene odonkor

What of the Facebook example you used. When a user clicks on the like button there is an immediate acknowledgement but the data is written later. Cant that be an example of node used with relational db? Anyway what makes up the message queue?

Moch Lutfi

Maybe go-lang is alternative choice. . )

Moch Lutfi

Maybe go-lang is alternative choice. . )

Anthony Hildoer

This article is great, except for the part where it says don't use NodeJS for computation because it doesn't have threads. Since when do we need threads? Run child processes. The only advantage to running threads over child processes is shared memory. Last time I checked, any system large enough for this entire debate to be relevant anyway is going to span multiple servers anyway, their by nullifying any benefit of threads. So, get it out of your head that NodeJS can't do CPU intensive work. And, if you can't, contact BlueRival. com, and we can fix all the stuff you built wrong with NodeJS

Anthony Hildoer

This article is great, except for the part where it says don't use NodeJS for computation because it doesn't have threads. Since when do we need threads? Run child processes. The only advantage to running threads over child processes is shared memory. Last time I checked, any system large enough for this entire debate to be relevant anyway is going to span multiple servers anyway, their by nullifying any benefit of threads. So, get it out of your head that NodeJS can't do CPU intensive work. And, if you can't, contact BlueRival. com, and we can fix all the stuff you built wrong with NodeJS

RiggerTheGeek

One application that few people use, but could be really fanastic, is using NodeJS to build a desktop application. There's plenty of packages out there - personally, I favour Node-Webkit https. //github. com/rogerwang/node-webkit

RiggerTheGeek

One application that few people use, but could be really fanastic, is using NodeJS to build a desktop application. There's plenty of packages out there - personally, I favour Node-Webkit https. //github. com/rogerwang/node-webkit

hfuti

Hi, nice article. However I would like to point one thing, NodeJS is not running in a single thread. Lập trình viên không phải sinh ra các luồng mới, chúng được xử lý bởi chính nút trên cơ sở sự kiện. NodeJS được tạo sự kiện, mỗi lệnh gọi hàm cho mỗi sự kiện sẽ chạy trong một luồng riêng biệt. That approach encourages writing lighter functions. If your function does a lot of computation, reactor it into smaller ones and they all will run in separate threads. Think about the example where you process file while streaming. Điều đó là có thể nhờ chủ đề

hfuti

Hi, nice article. However I would like to point one thing, NodeJS is not running in a single thread. Lập trình viên không phải sinh ra các luồng mới, chúng được xử lý bởi chính nút trên cơ sở sự kiện. NodeJS được tạo sự kiện, mỗi lệnh gọi hàm cho mỗi sự kiện sẽ chạy trong một luồng riêng biệt. That approach encourages writing lighter functions. If your function does a lot of computation, reactor it into smaller ones and they all will run in separate threads. Think about the example where you process file while streaming. Điều đó là có thể nhờ chủ đề

Matthew Keas

Điều này được viết rất tốt. Cảm ơn vì điều này

Matthew Keas

Điều này được viết rất tốt. Cảm ơn vì điều này

Matti Schneider

> Kỹ thuật được sử dụng để tránh ngoại lệ nổi lên trên bề mặt là chuyển lỗi trở lại người gọi dưới dạng tham số gọi lại Xin lỗi, nhưng điều đó có vẻ sai. In my understanding, [“Node-style callbacks”](http. // nút hướng dẫn. com/style. html#callbacks) (tôi. e. mô hình chuyển lỗi dưới dạng tham số đầu tiên cho lệnh gọi lại) là tác dụng phụ của hàng đợi sự kiện (trả lại quyền kiểm soát càng sớm càng tốt để cho phép “đồng thời”) thay vì thiết kế để tránh làm gián đoạn luồng. Thực tế là các ngoại lệ không bong bóng thực sự thường là một nguồn gây ra lỗi, đặc biệt là đối với những người mới

Matti Schneider

> Kỹ thuật được sử dụng để tránh ngoại lệ nổi lên trên bề mặt là chuyển lỗi trở lại người gọi dưới dạng tham số gọi lại Xin lỗi, nhưng điều đó có vẻ sai. In my understanding, [“Node-style callbacks”](http. // nút hướng dẫn. com/style. html#callbacks) (tôi. e. mô hình chuyển lỗi dưới dạng tham số đầu tiên cho lệnh gọi lại) là tác dụng phụ của hàng đợi sự kiện (trả lại quyền kiểm soát càng sớm càng tốt để cho phép “đồng thời”) thay vì thiết kế để tránh làm gián đoạn luồng. Thực tế là các ngoại lệ không bong bóng thực sự thường là một nguồn gây ra lỗi, đặc biệt là đối với những người mới

kyoukhana

Bài báo tuyệt vời. Wondering who made the beautiful diagrams . )

kyoukhana

Bài báo tuyệt vời. Wondering who made the beautiful diagrams . )

TZ

Great article, thanks . ) BTW, bạn sử dụng công cụ nào để vẽ hình ảnh?

TZ

Great article, thanks . ) BTW, bạn sử dụng công cụ nào để vẽ hình ảnh?

Matthew Keas

+1 cho điều đó

Matthew Keas

+1 cho điều đó

Matthew Keas

Đối với những người tò mò, có vẻ như những hình ảnh được tạo ra bằng Adobe Photoshop CC. Tôi đã kiểm tra điều này bằng cách xem dữ liệu EXIF ​​của một trong những hình ảnh. http. //dữ liệu exif. com/ File Size – 61 kB File Type – PNG MIME Type – image/png Image Width – 624 Image Height – 600 X Resolution – 72 Y Resolution – 72 Color Space – sRGB Color Mode – 3 Compression – Deflate/Inflate Orientation – Horizontal (normal) XMP Toolkit – Adobe XMP Core 5. 5-c014 79. 151481, 2013/03/13-12. 09. 15 Công cụ tạo – Adobe Photoshop CC (Macintosh)

Matthew Keas

Đối với những người tò mò, có vẻ như những hình ảnh được tạo ra bằng Adobe Photoshop CC. Tôi đã kiểm tra điều này bằng cách xem dữ liệu EXIF ​​của một trong những hình ảnh. http. //dữ liệu exif. com/ File Size – 61 kB File Type – PNG MIME Type – image/png Image Width – 624 Image Height – 600 X Resolution – 72 Y Resolution – 72 Color Space – sRGB Color Mode – 3 Compression – Deflate/Inflate Orientation – Horizontal (normal) XMP Toolkit – Adobe XMP Core 5. 5-c014 79. 151481, 2013/03/13-12. 09. 15 Công cụ tạo – Adobe Photoshop CC (Macintosh)

Juan G. nuño

Ngoài ra, thực tế là javascript không thể kiểm tra tính tuân thủ của loại gây khó khăn trong việc tổ chức số lượng lớn các lập trình viên cập nhật cùng một lúc cùng một cơ sở mã

Juan G. nuño

Ngoài ra, thực tế là javascript không thể kiểm tra tính tuân thủ của loại gây khó khăn trong việc tổ chức số lượng lớn các lập trình viên cập nhật cùng một lúc cùng một cơ sở mã

Juan G. nuño

mmmm. không đồng ý, nếu bạn sử dụng đúng một ORM tốt (hãy xem các ORM trưởng thành), bạn cũng nhận được bộ đệm được phân phối của Cơ sở dữ liệu quan hệ cho phép bạn có hiệu suất cao hơn với cùng số tiền và khả năng mở rộng hơn của hệ thống của bạn. ORM không chỉ để giảm bớt cuộc sống cho người mới. It is non sense to use a non-blockin sistem such as node. js, nếu cuối cùng bạn bị chặn tại Cơ sở dữ liệu của mình. But using a ORM that way, is not for newbies

Juan G. nuño

mmmm. không đồng ý, nếu bạn sử dụng đúng một ORM tốt (hãy xem các ORM trưởng thành), bạn cũng nhận được bộ đệm được phân phối của Cơ sở dữ liệu quan hệ cho phép bạn có hiệu suất cao hơn với cùng số tiền và khả năng mở rộng hơn của hệ thống của bạn. ORM không chỉ để giảm bớt cuộc sống cho người mới. It is non sense to use a non-blockin sistem such as node. js, nếu cuối cùng bạn bị chặn tại Cơ sở dữ liệu của mình. But using a ORM that way, is not for newbies

geniium

Glad you mention, most people don't mention this

geniium

Glad you mention, most people don't mention this

Trình theo dõi1

Đối với vấn đề đó, vì bạn có thể thực hiện async shell cho ứng dụng bảng điều khiển, bạn có thể dễ dàng ghi nhân viên của mình vào, chẳng hạn như golang, sau đó sử dụng nhóm chung để giới hạn nhân viên cpu của bạn. từ đó, bạn có thể bao ra cho một công nhân hiệu quả hơn. You can also do that for CPU intensive JS as well, I did this for my scrypt-js module (there are binary modules that are more performant, but I wanted one without compiled dependencies). Không khó để xếp hàng công việc cho các hệ thống khác và không có lý do gì không thể sử dụng nút để điều phối công việc nói trên

Trình theo dõi1

Đối với vấn đề đó, vì bạn có thể thực hiện async shell cho ứng dụng bảng điều khiển, bạn có thể dễ dàng ghi nhân viên của mình vào, chẳng hạn như golang, sau đó sử dụng nhóm chung để giới hạn nhân viên cpu của bạn. từ đó, bạn có thể bao ra cho một công nhân hiệu quả hơn. You can also do that for CPU intensive JS as well, I did this for my scrypt-js module (there are binary modules that are more performant, but I wanted one without compiled dependencies). Không khó để xếp hàng công việc cho các hệ thống khác và không có lý do gì không thể sử dụng nút để điều phối công việc nói trên

Trình theo dõi1

Có thể *có thể* sử dụng một hệ thống trung gian như TypeScript, bạn cũng có thể sử dụng một kẻ nói dối (jshint) và thậm chí yêu cầu một mức độ kiểm tra để phát hành. Nhận phạm vi kiểm tra 100% nói chung là *rất* dễ dàng trong môi trường tập lệnh. Would suggest looking into Mocha, Chai, and Proxyquire. Nếu bạn không viết bài kiểm tra đơn vị, kiểu an toàn thực sự không mang lại cho bạn nhiều

Trình theo dõi1

Có thể *có thể* sử dụng một hệ thống trung gian như TypeScript, bạn cũng có thể sử dụng một kẻ nói dối (jshint) và thậm chí yêu cầu một mức độ kiểm tra để phát hành. Nhận phạm vi kiểm tra 100% nói chung là *rất* dễ dàng trong môi trường tập lệnh. Would suggest looking into Mocha, Chai, and Proxyquire. Nếu bạn không viết bài kiểm tra đơn vị, kiểu an toàn thực sự không mang lại cho bạn nhiều

Steve Naidamast

Tôi đang bắt đầu tìm Node. js khá thú vị. Tuy nhiên, mô hình mà nó dường như đang quảng bá hầu như không mới đối với CNTT. Trong thế giới truyền thông máy tính lớn, chúng tôi gọi những khả năng như vậy là "đăng nhập lại", trong đó một quy trình đơn lẻ có thể xử lý mức độ cao của các cuộc gọi đến nó. Microsoft đã triển khai các khả năng tương tự với cơ sở hạ tầng đối tượng Singleton của mình và tôi tưởng tượng thế giới Java đã thực hiện các triển khai tương tự. Thật kỳ lạ, khuyến nghị của Microsoft để tăng cường khả năng mở rộng trên các dây dẫn đến các dịch vụ phụ trợ là thúc đẩy cấu trúc đối tượng "Cuộc gọi đơn" hoặc một phiên bản đối tượng cho mỗi yêu cầu cuộc gọi. Do đó, lập luận được đưa ra cho Node. js is actually contrary to the Microsoft recommendation; BTW, a recommendation I never quite understood. Trong mọi trường hợp, với tư cách là một doanh nghiệp ASP. NET, tôi không chắc liệu tôi có tìm thấy bất kỳ cách sử dụng nào cho một Node hay không. js, mặc dù nhà thiết kế web của chúng tôi có thể. Một lưu ý khác, tôi muốn thêm ý kiến ​​​​của riêng mình về việc sử dụng ORM. ORM là công cụ tuyệt vời khi phải đối mặt với cấu trúc cơ sở dữ liệu hiện có so với yêu cầu của ứng dụng mới vì ORM có thể xử lý rất nhiều mã hóa lặp đi lặp lại thông thường thường thấy với bất kỳ ứng dụng cơ sở dữ liệu nào. Tuy nhiên, vì ORM là các lớp cấp cao nên chúng thường không phải là tùy chọn hiệu quả nhất để sử dụng đối với cơ sở dữ liệu trong khi truy cập trực tiếp thông qua các nhà cung cấp bản địa là. Trong nhiều khía cạnh, tốt hơn là thực hiện mã hóa lặp đi lặp lại để đạt hiệu quả hơn là áp dụng lớp tạm thời có trọng lượng nặng, chẳng hạn như ORM

Steve Naidamast

Tôi đang bắt đầu tìm Node. js khá thú vị. Tuy nhiên, mô hình mà nó dường như đang quảng bá hầu như không mới đối với CNTT. Trong thế giới truyền thông máy tính lớn, chúng tôi gọi những khả năng như vậy là "đăng nhập lại", trong đó một quy trình đơn lẻ có thể xử lý mức độ cao của các cuộc gọi đến nó. Microsoft đã triển khai các khả năng tương tự với cơ sở hạ tầng đối tượng Singleton của mình và tôi tưởng tượng thế giới Java đã thực hiện các triển khai tương tự. Thật kỳ lạ, khuyến nghị của Microsoft để tăng cường khả năng mở rộng trên các dây dẫn đến các dịch vụ phụ trợ là thúc đẩy cấu trúc đối tượng "Cuộc gọi đơn" hoặc một phiên bản đối tượng cho mỗi yêu cầu cuộc gọi. Do đó, lập luận được đưa ra cho Node. js is actually contrary to the Microsoft recommendation; BTW, a recommendation I never quite understood. Trong mọi trường hợp, với tư cách là một doanh nghiệp ASP. NET, tôi không chắc liệu tôi có tìm thấy bất kỳ cách sử dụng nào cho một Node hay không. js, mặc dù nhà thiết kế web của chúng tôi có thể. Một lưu ý khác, tôi muốn thêm ý kiến ​​​​của riêng mình về việc sử dụng ORM. ORM là công cụ tuyệt vời khi phải đối mặt với cấu trúc cơ sở dữ liệu hiện có so với yêu cầu của ứng dụng mới vì ORM có thể xử lý rất nhiều mã hóa lặp đi lặp lại thông thường thường thấy với bất kỳ ứng dụng cơ sở dữ liệu nào. Tuy nhiên, vì ORM là các lớp cấp cao nên chúng thường không phải là tùy chọn hiệu quả nhất để sử dụng đối với cơ sở dữ liệu trong khi truy cập trực tiếp thông qua các nhà cung cấp bản địa là. Trong nhiều khía cạnh, tốt hơn là thực hiện mã hóa lặp đi lặp lại để đạt hiệu quả hơn là áp dụng lớp tạm thời có trọng lượng nặng, chẳng hạn như ORM

openas

Quan sát rất thú vị. Tôi muốn ai đó giải thích thêm một chút về điều đó. Tôi muốn một ví dụ cụ thể hơn, chẳng hạn như một số đoạn mã cụ thể gọi một hàm tính toán nặng không đồng bộ và ai đó giải thích điều gì sẽ xảy ra nếu nó được chạy trong một thiết bị đa lõi. Chuỗi đang thu thập các yêu cầu http có bị chặn không?

openas

Quan sát rất thú vị. Tôi muốn ai đó giải thích thêm một chút về điều đó. Tôi muốn một ví dụ cụ thể hơn, chẳng hạn như một số đoạn mã cụ thể gọi một hàm tính toán nặng không đồng bộ và ai đó giải thích điều gì sẽ xảy ra nếu nó được chạy trong một thiết bị đa lõi. Chuỗi đang thu thập các yêu cầu http có bị chặn không?

Derrick Simpson

Node là một máy chủ web khủng khiếp. Ngay cả người sáng tạo cũng gợi ý rằng đây không phải là mục đích của Node và nó nên được tận dụng vì thế mạnh của nó. JavaScript "Mọi thứ", giống như các quy trình công nhân, thật lố bịch

Derrick Simpson

Node là một máy chủ web khủng khiếp. Ngay cả người sáng tạo cũng gợi ý rằng đây không phải là mục đích của Node và nó nên được tận dụng vì thế mạnh của nó. JavaScript "Mọi thứ", giống như các quy trình công nhân, thật lố bịch

Eric Elliott

Điều này thật là buồn cười. Nút được xây dựng với web là hạng nhất và nó vượt trội như một máy chủ web. Nó đang nhanh chóng thay thế Ruby và PHP trong nhiều tổ chức doanh nghiệp vì nó đã tăng hiệu suất ứng dụng một cách đáng kể (giảm thời gian tải trang, v.v. ) and developer productivity

Eric Elliott

Điều này thật là buồn cười. Nút được xây dựng với web là hạng nhất và nó vượt trội như một máy chủ web. Nó đang nhanh chóng thay thế Ruby và PHP trong nhiều tổ chức doanh nghiệp vì nó đã tăng hiệu suất ứng dụng một cách đáng kể (giảm thời gian tải trang, v.v. ) and developer productivity

jonpress

Trên thực tế, bạn có thể tạo các máy chủ đa luồng bằng Node. js để cung cấp hiệu suất ổn định hơn nhưng phải làm thêm nhiều việc (xem mô-đun cụm tích hợp và mô-đun child_ process). Tôi đã tạo một khung chạy trên nhiều lõi CPU và giải quyết được nhiều vấn đề được thảo luận trong bài đăng này. Kiểm tra nó ra. http. // nombo. io/

jonpress

Trên thực tế, bạn có thể tạo các máy chủ đa luồng bằng Node. js để cung cấp hiệu suất ổn định hơn nhưng phải làm thêm nhiều việc (xem mô-đun cụm tích hợp và mô-đun child_ process). Tôi đã tạo một khung chạy trên nhiều lõi CPU và giải quyết được nhiều vấn đề được thảo luận trong bài đăng này. Kiểm tra nó ra. http. // nombo. io/

Connor Leech

làm điều gì đó giống cầy mangut. js giải quyết vấn đề cơ sở dữ liệu quan hệ nút? . // mongoosejs. com/

Connor Leech

làm điều gì đó giống cầy mangut. js giải quyết vấn đề cơ sở dữ liệu quan hệ nút? . // mongoosejs. com/

Rob Tweed

Có - xem cách tiếp cận nhóm công nhân hàng đợi/phân nhánh trước được EWD áp dụng. js. http. //gradvs1. đường cổng. com/tải xuống/EWDjs. pdf Summarised here. http. //gradvs1. đường cổng. com/download/EWDjsMechanics. pdf

Rob Tweed

Có - xem cách tiếp cận nhóm công nhân hàng đợi/phân nhánh trước được EWD áp dụng. js. http. //gradvs1. đường cổng. com/tải xuống/EWDjs. pdf Summarised here. http. //gradvs1. đường cổng. com/download/EWDjsMechanics. pdf

keith

vâng, tôi cũng đã tự hỏi về nó. hình ảnh tuyệt vời + bài viết tuyệt vời

keith

vâng, tôi cũng đã tự hỏi về nó. hình ảnh tuyệt vời + bài viết tuyệt vời

Carlos Ballena

bài viết rất hữu ích

Carlos Ballena

bài viết rất hữu ích

Chúa Giêsu Nunez

npm cài đặt felixge/nút-mysql. Đó có thể là kho lưu trữ hữu ích nhất mà tôi từng thấy từ lâu

Chúa Giêsu Nunez

npm cài đặt felixge/nút-mysql. Đó có thể là kho lưu trữ hữu ích nhất mà tôi từng thấy từ lâu

Matthias Lienau

Bài viết hay thật đấy. But, @hfuti. disqus, you're wrong in saying "NodeJS is not running in a single thread . each function call per event will run in a separate thread. " As far as I understood, the main NodeJS event loop consuming your JS code in fact runs in a single thread. All potentially blocking and/or long-running tasks like disk I/O is delegated to and executed by libuv as part of the node runtime engine which spawns a *limited* number of threads made available as thread pool. Said this, it's obvious that the main event loop thread is not affected or blocked by other (yet again asynchronous) code execution. Vì vậy, ví dụ: tệp I/O với chính mô-đun fs được triển khai theo cách không chặn - cuối cùng thì hệ điều hành/nhân cho phép hoạt động không chặn cũng tốt. Of course foreign processes or threads could always be spawned by custom modules or 3rd party services (worker processes). And yes, there are runtime env projects handling more than one node process and their threads on the same machine or cpu cluster. But that's another story. Hãy sửa tôi nếu tôi sai

Matthias Lienau

Bài viết hay thật đấy. But, @hfuti. disqus, you're wrong in saying "NodeJS is not running in a single thread . each function call per event will run in a separate thread. " As far as I understood, the main NodeJS event loop consuming your JS code in fact runs in a single thread. All potentially blocking and/or long-running tasks like disk I/O is delegated to and executed by libuv as part of the node runtime engine which spawns a *limited* number of threads made available as thread pool. Said this, it's obvious that the main event loop thread is not affected or blocked by other (yet again asynchronous) code execution. Vì vậy, ví dụ: tệp I/O với chính mô-đun fs được triển khai theo cách không chặn - cuối cùng thì hệ điều hành/nhân cho phép hoạt động không chặn cũng tốt. Of course foreign processes or threads could always be spawned by custom modules or 3rd party services (worker processes). And yes, there are runtime env projects handling more than one node process and their threads on the same machine or cpu cluster. But that's another story. Hãy sửa tôi nếu tôi sai

josep2

This is fantastic

josep2

This is fantastic

Jacopo Chiapparino

Nice article, thank you

Jacopo Chiapparino

Nice article, thank you

NoobMovies. com

I think Django still kicks Node's ass

NoobMovies. com

I think Django still kicks Node's ass

Alex Viết

Hey Tomislav, http. //codecondo. com/7-minimal-node-js-web-frameworks/ I'd love if you could add the above post to the list . )

Alex Viết

Hey Tomislav, http. //codecondo. com/7-minimal-node-js-web-frameworks/ I'd love if you could add the above post to the list . )

Victor Lava

Omg, this is amazing. Tôi luôn muốn học nút. js

Victor Lava

Omg, this is amazing. Tôi luôn muốn học nút. js

ak

Thanks for providing examples, illustrations and use cases. Giải thích chi tiết và các bước trong một số trường hợp với các tài nguyên có liên quan làm cho nó trở nên tuyệt vời. Trường hợp sử dụng nodejs *nên* rất hữu ích

ak

Thanks for providing examples, illustrations and use cases. Giải thích chi tiết và các bước trong một số trường hợp với các tài nguyên có liên quan làm cho nó trở nên tuyệt vời. Trường hợp sử dụng nodejs *nên* rất hữu ích

crueber

Tất cả mã Node đều bị ràng buộc bởi luồng. Nó có thể không chạy trên cùng một luồng mọi lúc (điều này không liên quan gì đến bản thân Node mà thay vào đó phải thực hiện với bộ lập lịch xử lý của hệ điều hành), nhưng nó bị ràng buộc bởi luồng. Để tận dụng nhiều luồng, bạn cần sử dụng thứ gì đó như Cụm. http. //nodejs. org/api/cluster. html

crueber

Tất cả mã Node đều bị ràng buộc bởi luồng. Nó có thể không chạy trên cùng một luồng mọi lúc (điều này không liên quan gì đến bản thân Node mà thay vào đó phải thực hiện với bộ lập lịch xử lý của hệ điều hành), nhưng nó bị ràng buộc bởi luồng. Để tận dụng nhiều luồng, bạn cần sử dụng thứ gì đó như Cụm. http. //nodejs. org/api/cluster. html

crueber

Đã đồng ý. Tôi sử dụng Postgres cho tất cả các loại hoạt động GIS trong một ứng dụng mà tôi đã làm việc trong khoảng một năm và ứng dụng này hoạt động rất tốt cũng như mang lại lợi ích từ I/O không chặn giống như bất kỳ quyền truy cập cơ sở dữ liệu nào khác. It's just that you have to drop down directly to the SQL. There are a couple ORMs, but nothing that is real mature

crueber

Đã đồng ý. Tôi sử dụng Postgres cho tất cả các loại hoạt động GIS trong một ứng dụng mà tôi đã làm việc trong khoảng một năm và ứng dụng này hoạt động rất tốt cũng như mang lại lợi ích từ I/O không chặn giống như bất kỳ quyền truy cập cơ sở dữ liệu nào khác. It's just that you have to drop down directly to the SQL. There are a couple ORMs, but nothing that is real mature

elijahca

Awesome, thanks a lot for this

elijahca

Awesome, thanks a lot for this

Zmirc

nhận xét nhỏ. don't confuse Object DBs with Mongo (Document DB). There are 2 completely different things

Zmirc

nhận xét nhỏ. don't confuse Object DBs with Mongo (Document DB). There are 2 completely different things

Gianlucca

i agree, good post

Gianlucca

i agree, good post

Gianlucca

yes, i agree

Gianlucca

yes, i agree

Gianlucca

chắc chắn rồi

Gianlucca

chắc chắn rồi

Toulon

Bài viết rất tốt. Bạn đã suy nghĩ rất nhiều về nó. Quick node/express question I am I am adding rapid data entry, not batch, data entry to my system I have a form (mfntapes) that works great. I have a test form (joe) the prompts for the number of times I want to call the mfntapes form The gist contains the code, fails to work, the after prompting for cnt attempts to call for mfntapes cnt times. Error is "ReferenceError. biểu mẫu không được xác định" trong dòng 87 của ý chính. Câu hỏi đặt ra là làm thế nào để gọi biểu mẫu mfntapes x số lần trong đó x là khả dụng? Xem các dòng 45-55 của https. //ý chính. github. com/toulon/9571625

Toulon

Bài viết rất tốt. Bạn đã suy nghĩ rất nhiều về nó. Quick node/express question I am I am adding rapid data entry, not batch, data entry to my system I have a form (mfntapes) that works great. I have a test form (joe) the prompts for the number of times I want to call the mfntapes form The gist contains the code, fails to work, the after prompting for cnt attempts to call for mfntapes cnt times. Error is "ReferenceError. biểu mẫu không được xác định" trong dòng 87 của ý chính. Câu hỏi đặt ra là làm thế nào để gọi biểu mẫu mfntapes x số lần trong đó x là khả dụng? Xem các dòng 45-55 của https. //ý chính. github. com/toulon/9571625

Jesus Bejarano

ORM cho các dự án thực tế là vô ích

Jesus Bejarano

ORM cho các dự án thực tế là vô ích

Thomas

Nice article . -) > SERVER-SIDE WEB APPLICATION W/ A RELATIONAL DB BEHIND I wonder why Node is not good for that? You have promise based *SQL libraries (like Knex) which enables non-blocking queries. Node has no opposition with relational databases. it has no interest with blocking I/O drivers only. Relational or not relational

Thomas

Nice article . -) > SERVER-SIDE WEB APPLICATION W/ A RELATIONAL DB BEHIND I wonder why Node is not good for that? You have promise based *SQL libraries (like Knex) which enables non-blocking queries. Node has no opposition with relational databases. it has no interest with blocking I/O drivers only. Relational or not relational

Seb

I wish NodeJS was not (almost) systematicallty presented as THE de facto alternative to the traditional threaded webserver. Async IO không dành riêng cho NodeJS. Most major languages out there - including Java and PHP - have async IO frameworks similar to NodeJS. This wiki page lists most of them. http. // vi. wikipedia. org/wiki/Reactor_potype Tôi không nói rằng NodeJS không có giá trị của nó, nhưng tôi phát ốm và mệt mỏi khi thấy mọi người đổ xô vào nó như thể đó là ngăn xếp IO *chỉ* không đồng bộ có sẵn và là giải pháp thay thế *chỉ* cho . Thành thật mà nói, chúng tôi có thể bị mắc kẹt với Javascript trên trình duyệt và sẽ còn rất lâu (trừ khi Javascript trở thành một nền tảng/ngôn ngữ mục tiêu khác nhờ asm. js), but I can't come up with any good reason to use it on the server side in favor to other available languages. Hầu hết các lựa chọn thay thế chỉ là ngôn ngữ tốt hơn, có thư viện, công cụ và tài nguyên tiêu chuẩn tốt hơn. Chỉ là ý kiến ​​cá nhân. Tóm lại, Node JS rất tuyệt, nhưng chắc chắn có một framework tương tự được viết bằng ngôn ngữ yêu thích của bạn. Please just take 5 minutes to research it before switching to NodeJS

Seb

I wish NodeJS was not (almost) systematicallty presented as THE de facto alternative to the traditional threaded webserver. Async IO không dành riêng cho NodeJS. Most major languages out there - including Java and PHP - have async IO frameworks similar to NodeJS. This wiki page lists most of them. http. // vi. wikipedia. org/wiki/Reactor_potype Tôi không nói rằng NodeJS không có giá trị của nó, nhưng tôi phát ốm và mệt mỏi khi thấy mọi người đổ xô vào nó như thể đó là ngăn xếp IO *chỉ* không đồng bộ có sẵn và là giải pháp thay thế *chỉ* cho . Thành thật mà nói, chúng tôi có thể bị mắc kẹt với Javascript trên trình duyệt và sẽ còn rất lâu (trừ khi Javascript trở thành một nền tảng/ngôn ngữ mục tiêu khác nhờ asm. js), but I can't come up with any good reason to use it on the server side in favor to other available languages. Hầu hết các lựa chọn thay thế chỉ là ngôn ngữ tốt hơn, có thư viện, công cụ và tài nguyên tiêu chuẩn tốt hơn. Chỉ là ý kiến ​​cá nhân. Tóm lại, Node JS rất tuyệt, nhưng chắc chắn có một framework tương tự được viết bằng ngôn ngữ yêu thích của bạn. Please just take 5 minutes to research it before switching to NodeJS

Jarle Leopold Moe

Làm thế nào bạn sẽ tải lên các tập tin? . Node. js is _single-threaded_ it's only applicable for certain types of tasks

Jarle Leopold Moe

Làm thế nào bạn sẽ tải lên các tập tin? . Node. js is _single-threaded_ it's only applicable for certain types of tasks

Eric Elliott

Đây là những ví dụ tuyệt vời về lý do tại sao Node tốt hơn nhiều so với sự cạnh tranh tại các dịch vụ web. Không ai trong số đó đang chặn hoạt động trong Node. They're asynchronous. Trong khi các máy chủ khác lãng phí tài nguyên khi chạy các luồng riêng biệt, Node kích hoạt hoạt động không đồng bộ theo hướng sự kiện và tiếp tục nhận nhiều yêu cầu hơn trong thời gian chờ đợi. Kết quả thực tế là việc chuyển các dịch vụ web từ PHP hoặc Ruby có thể mang lại những cải tiến từ 2 đến 10 lần trong các kết nối đồng thời và thường là 30% - 60% cải thiện về thời gian phản hồi trung bình. Rất nhiều công ty lớn đang thực hiện các dự án Node web chỉ vì những lý do này, bao gồm Adobe, Paypal, eBay, Walmart, Yahoo. , Groupon, Uber, etc

Eric Elliott

Đây là những ví dụ tuyệt vời về lý do tại sao Node tốt hơn nhiều so với sự cạnh tranh tại các dịch vụ web. Không ai trong số đó đang chặn hoạt động trong Node. They're asynchronous. Trong khi các máy chủ khác lãng phí tài nguyên khi chạy các luồng riêng biệt, Node kích hoạt hoạt động không đồng bộ theo hướng sự kiện và tiếp tục nhận nhiều yêu cầu hơn trong thời gian chờ đợi. Kết quả thực tế là việc chuyển các dịch vụ web từ PHP hoặc Ruby có thể mang lại những cải tiến từ 2 đến 10 lần trong các kết nối đồng thời và thường là 30% - 60% cải thiện về thời gian phản hồi trung bình. Rất nhiều công ty lớn đang thực hiện các dự án Node web chỉ vì những lý do này, bao gồm Adobe, Paypal, eBay, Walmart, Yahoo. , Groupon, Uber, etc

jenit shah

very nice article and very clear thought regarding node. js nên sử dụng ở đâu và không ở đâu

jenit shah

very nice article and very clear thought regarding node. js nên sử dụng ở đâu và không ở đâu

BòQuy Định

Every major application development platform has already had support for HTML5 for the past several years, including websockets for bi-directional communication. Thêm vào đó là các loại mạnh, đa luồng và hàng tấn thứ khác mà các ngôn ngữ như Java phải cung cấp và tôi thực sự đặt câu hỏi tại sao mọi người lại lãng phí thời gian của họ khi sử dụng ngôn ngữ này

BòQuy Định

Every major application development platform has already had support for HTML5 for the past several years, including websockets for bi-directional communication. Thêm vào đó là các loại mạnh, đa luồng và hàng tấn thứ khác mà các ngôn ngữ như Java phải cung cấp và tôi thực sự đặt câu hỏi tại sao mọi người lại lãng phí thời gian của họ khi sử dụng ngôn ngữ này

robertcook

Chỉ muốn đề cập rằng nút đó không phải là tùy chọn phía máy chủ duy nhất cho javascript, đặc biệt là kể từ khi nhà tiên tri đặt công cụ javascript nashorn trên jdk. Bây giờ bạn cũng có thể sử dụng tất cả tính năng tốt của jvm từ javascript mà chúng tôi đang sử dụng vert. x làm máy chủ không đồng bộ và nashorn để sử dụng javascript. You can see some code samples in this module https. //github. com/core9/module-nashorn trang web dự án là core9. io

robertcook

Chỉ muốn đề cập rằng nút đó không phải là tùy chọn phía máy chủ duy nhất cho javascript, đặc biệt là kể từ khi nhà tiên tri đặt công cụ javascript nashorn trên jdk. Bây giờ bạn cũng có thể sử dụng tất cả tính năng tốt của jvm từ javascript mà chúng tôi đang sử dụng vert. x làm máy chủ không đồng bộ và nashorn để sử dụng javascript. You can see some code samples in this module https. //github. com/core9/module-nashorn trang web dự án là core9. io

Vô danh

Đây là một tổng quan tuyệt vời. Cảm ơn bạn

Vô danh

Đây là một tổng quan tuyệt vời. Cảm ơn bạn

Vishnu Tekale

Viết rất tốt. Cám ơn vì đã chia sẻ

Vishnu Tekale

Viết rất tốt. Cám ơn vì đã chia sẻ

Gleb Bahmutov

Tại sao Nút lại khác - sử dụng thanh làm http tương tự. //bahmutov. cái ghim. co/tại sao-nút-là-khác. html

Gleb Bahmutov

Tại sao Nút lại khác - sử dụng thanh làm http tương tự. //bahmutov. cái ghim. co/tại sao-nút-là-khác. html

FluckerSputter

Chỉ để cho bạn biết rằng bạn có "hỗ trợ hỗ trợ" trong Cách thức hoạt động cơ bản khá thú vị. So với các kỹ thuật phục vụ web truyền thống trong đó mỗi kết nối (yêu cầu) tạo ra một luồng mới, chiếm RAM hệ thống và cuối cùng sử dụng tối đa dung lượng RAM có sẵn, Node. js hoạt động trên một luồng đơn, sử dụng các cuộc gọi I/O không chặn, cho phép nó hỗ trợ hàng chục nghìn kết nối đồng thời (được tổ chức trong vòng lặp sự kiện)

FluckerSputter

Chỉ để cho bạn biết rằng bạn có "hỗ trợ hỗ trợ" trong Cách thức hoạt động cơ bản khá thú vị. So với các kỹ thuật phục vụ web truyền thống trong đó mỗi kết nối (yêu cầu) tạo ra một luồng mới, chiếm RAM hệ thống và cuối cùng sử dụng tối đa dung lượng RAM có sẵn, Node. js hoạt động trên một luồng đơn, sử dụng các cuộc gọi I/O không chặn, cho phép nó hỗ trợ hàng chục nghìn kết nối đồng thời (được tổ chức trong vòng lặp sự kiện)

piloh23

Node. js sẽ không bao giờ thay thế Rails để trở thành web framework số một

piloh23

Node. js sẽ không bao giờ thay thế Rails để trở thành web framework số một

Alifa Nurani Putri

Hello, Is node a best choice for video streaming and uploading? Is any different performance w/ PHP for that?

Alifa Nurani Putri

Hello, Is node a best choice for video streaming and uploading? Is any different performance w/ PHP for that?

SleightDifference

How come PHP isn't mentioned for interacting with relational databases? It's as if PHP isn't used anymore? Why is it being neglected?

SleightDifference

How come PHP isn't mentioned for interacting with relational databases? It's as if PHP isn't used anymore? Why is it being neglected?

Clain Dsilva

Thanks for taking time to explain Node. js. Tôi thực sự gặp khó khăn trong việc hiểu nó từ trang web của họ cũng như Wikipedia. Bài viết tốt. Giữ nó lên

Clain Dsilva

Thanks for taking time to explain Node. js. Tôi thực sự gặp khó khăn trong việc hiểu nó từ trang web của họ cũng như Wikipedia. Bài viết tốt. Giữ nó lên

Cézar Luiz

What about this https. //github. com/felixge/node-mysql? Nice article. Cảm ơn

Cézar Luiz

What about this https. //github. com/felixge/node-mysql? Nice article. Cảm ơn

Marcelo Lima

Thank you for this article. Cleared a lot of questions I had about Node internals

Marcelo Lima

Thank you for this article. Cleared a lot of questions I had about Node internals

Navid

Điều tuyệt vời

Navid

Điều tuyệt vời

Abdelhakim

https. //www. udemy. com/nodejs-tutorial-from-scratch-by-examples/?couponCode=NewOffer 1. Truy cập trọn đời 24 bài giảng 2. Hơn 120 phút nội dung chất lượng cao. 2. Join to a community of over 2687 students learning together. 4. Thông tin khóa học và cập nhật thường xuyên 5. Learn node. js and mongoDB from scratch by examples. 6. Course information and regular updates. 7. Discussion forum, which we encourage you to make use of -- both to pose questions about the material to the course instructor and to exchange ideas with your classmates. 8. High quality course support

Abdelhakim

https. //www. udemy. com/nodejs-tutorial-from-scratch-by-examples/?couponCode=NewOffer 1. Truy cập trọn đời 24 bài giảng 2. Hơn 120 phút nội dung chất lượng cao. 2. Join to a community of over 2687 students learning together. 4. Thông tin khóa học và cập nhật thường xuyên 5. Learn node. js and mongoDB from scratch by examples. 6. Course information and regular updates. 7. Discussion forum, which we encourage you to make use of -- both to pose questions about the material to the course instructor and to exchange ideas with your classmates. 8. High quality course support

rahul gag

Theo sự hiểu biết của tôi với bài viết, nếu bạn gửi bất kỳ yêu cầu nào tới máy chủ nút, nó sẽ thực sự xử lý trên một số luồng nền (libuv. dll). Bây giờ tôi muốn đăng một số tệp qua máy chủ nút, tại sao nó lại chặn máy chủ nút trong khi nó thực sự sẽ xử lý trên luồng nền và khi hoàn tất, chỉ phản hồi sẽ được trả về bởi luồng nút?

rahul gag

Theo sự hiểu biết của tôi với bài viết, nếu bạn gửi bất kỳ yêu cầu nào tới máy chủ nút, nó sẽ thực sự xử lý trên một số luồng nền (libuv. dll). Bây giờ tôi muốn đăng một số tệp qua máy chủ nút, tại sao nó lại chặn máy chủ nút trong khi nó thực sự sẽ xử lý trên luồng nền và khi hoàn tất, chỉ phản hồi sẽ được trả về bởi luồng nút?

siddesh

Siêu Bài Viết

siddesh

Siêu Bài Viết

fanck

Không thể lấy ngày đăng bài viết của bạn? . It is really disturbing to read technical posts without dates. thanks

fanck

Không thể lấy ngày đăng bài viết của bạn? . It is really disturbing to read technical posts without dates. thanks

Namo

Bạn đề cập đến Nút. js is good for a chat application because it's not CPU intensive. Tôi không thể nghĩ ra quá nhiều trường hợp sử dụng không yêu cầu nhiều CPU. For example, could Twitter be built with Node? It seems there's a lot of computation required just to generate your feed. Nút. js sử dụng chắc chắn không thể quá hẹp

Namo

Bạn đề cập đến Nút. js is good for a chat application because it's not CPU intensive. Tôi không thể nghĩ ra quá nhiều trường hợp sử dụng không yêu cầu nhiều CPU. For example, could Twitter be built with Node? It seems there's a lot of computation required just to generate your feed. Nút. js sử dụng chắc chắn không thể quá hẹp

Ian Kaplan

Bài báo tuyệt vời. Thanks. There's an old joke. you're not a paranoid if they're really out to get you. Đó là thái độ nên có khi nói đến bảo mật ứng dụng Web. One thing that bothers me about Node. js là tôi không hiểu rõ về mức độ an toàn của nó. Khi một môi trường như Grails, nơi tôi có Java/Groovy chạy trên Tomcat, tôi có chút tin tưởng vào bảo mật của Tomcat, nếu không vì lý do nào khác ngoài thực tế là Tomcat đã tồn tại từ lâu và đã phát triển. This isn't true with Node. js. I was also looking at the Node. js libraries. At least for the file access, it appears to be nothing more than a thin layer over the POSIX file system calls. Tôi thích phần trừu tượng hóa tệp Java hoặc thậm chí C++ hơn. The main argument that I see for Node. js (made in this post) is that it has really lightweight threads and that you can have JavaScrip everywhere. Vấn đề cuối cùng này là một điểm thu hút đối với những người chỉ biết JavaScript. As far as the light weight threads, this is not so much a language issue as a platform support issue. Có thể hỗ trợ loại mô hình luồng này bằng ngôn ngữ khác

Ian Kaplan

Bài báo tuyệt vời. Thanks. There's an old joke. you're not a paranoid if they're really out to get you. Đó là thái độ nên có khi nói đến bảo mật ứng dụng Web. One thing that bothers me about Node. js là tôi không hiểu rõ về mức độ an toàn của nó. Khi một môi trường như Grails, nơi tôi có Java/Groovy chạy trên Tomcat, tôi có chút tin tưởng vào bảo mật của Tomcat, nếu không vì lý do nào khác ngoài thực tế là Tomcat đã tồn tại từ lâu và đã phát triển. This isn't true with Node. js. I was also looking at the Node. js libraries. At least for the file access, it appears to be nothing more than a thin layer over the POSIX file system calls. Tôi thích phần trừu tượng hóa tệp Java hoặc thậm chí C++ hơn. The main argument that I see for Node. js (made in this post) is that it has really lightweight threads and that you can have JavaScrip everywhere. Vấn đề cuối cùng này là một điểm thu hút đối với những người chỉ biết JavaScript. As far as the light weight threads, this is not so much a language issue as a platform support issue. Có thể hỗ trợ loại mô hình luồng này bằng ngôn ngữ khác

Web khổng lồ

Nhà thiết kế Toptal đã thiết kế cho họ

Web khổng lồ

Nhà thiết kế Toptal đã thiết kế cho họ

Scott

Great article. cảm ơn vì những thông tin

Scott

Great article. cảm ơn vì những thông tin

daimmo

tôi đồng ý. I guessed it was around "a year ago" because of most of Disqus comments. This is taken from their meta tags anyway. 2013-08-13

daimmo

tôi đồng ý. I guessed it was around "a year ago" because of most of Disqus comments. This is taken from their meta tags anyway. 2013-08-13

Adnan King

đẹp

Adnan King

đẹp

Ethan Garofolo

Nút. js không phải là một khung web. Đó là thời gian chạy V8 được đóng gói với một số thư viện lõi được đính kèm. Node giống mri trong thế giới Ruby hơn Rails

Ethan Garofolo

Nút. js không phải là một khung web. Đó là thời gian chạy V8 được đóng gói với một số thư viện lõi được đính kèm. Node giống mri trong thế giới Ruby hơn Rails

Khách mời

Nút. js giống Rack hơn, nhưng không giống. MRI chỉ là một ngôn ngữ thực hiện

Khách mời

Nút. js giống Rack hơn, nhưng không giống. MRI chỉ là một ngôn ngữ thực hiện

Bể bơi Lambda

vấn đề là mongodb, quá rủi ro khi sử dụng cơ sở dữ liệu không thể di chuyển

Bể bơi Lambda

vấn đề là mongodb, quá rủi ro khi sử dụng cơ sở dữ liệu không thể di chuyển

Bể bơi Lambda

đúng vậy, ORM là một thực tế tồi sau tất cả

Bể bơi Lambda

đúng vậy, ORM là một thực tế tồi sau tất cả

Bể bơi Lambda

có nhưng nó hoạt động theo một cách rất không hiệu quả

Bể bơi Lambda

có nhưng nó hoạt động theo một cách rất không hiệu quả

Bể bơi Lambda

bản thân công cụ cơ sở dữ liệu sẽ tinh vi hơn bất kỳ thư viện ORM nào do người khác tạo ra

Bể bơi Lambda

bản thân công cụ cơ sở dữ liệu sẽ tinh vi hơn bất kỳ thư viện ORM nào do người khác tạo ra

John Bailo

Thật thú vị khi web vẫn không đồng bộ như thế nào. Thật vậy, giống như một chiếc máy trả lời điện thoại, tiện ích của nó nằm ở chỗ

John Bailo

Thật thú vị khi web vẫn không đồng bộ như thế nào. Thật vậy, giống như một chiếc máy trả lời điện thoại, tiện ích của nó nằm ở chỗ

Jayaraj Poroor

Tôi đồng ý - Tôi cũng không phải là người hâm mộ ORM. ORM là một ví dụ cổ điển về sự trừu tượng bị rò rỉ

Jayaraj Poroor

Tôi đồng ý - Tôi cũng không phải là người hâm mộ ORM. ORM là một ví dụ cổ điển về sự trừu tượng bị rò rỉ

Jayaraj Poroor

Về việc sử dụng Node. js với cơ sở dữ liệu quan hệ. Shelloid (http. // vỏ sò. org) là một máy chủ ứng dụng mã nguồn mở cho Node. js mà chúng tôi đã phát triển để đơn giản hóa nhiều tác vụ của lập trình viên. e. g. , Bạn có thể khai báo các truy vấn SQL có tên dưới dạng chú thích và một hàm có tên đó sẽ tự động được thêm vào đối tượng DB để bạn sử dụng

Jayaraj Poroor

Về việc sử dụng Node. js với cơ sở dữ liệu quan hệ. Shelloid (http. // vỏ sò. org) là một máy chủ ứng dụng mã nguồn mở cho Node. js mà chúng tôi đã phát triển để đơn giản hóa nhiều tác vụ của lập trình viên. e. g. , Bạn có thể khai báo các truy vấn SQL có tên dưới dạng chú thích và một hàm có tên đó sẽ tự động được thêm vào đối tượng DB để bạn sử dụng

M

Tôi nghĩ bạn chưa hiểu rõ về lý do cũng như đặc điểm của ORM. ORM không chỉ cô lập các mối quan tâm về dữ liệu, chúng còn cung cấp khả năng kiểm tra và tính linh hoạt cao hơn so với các máy khách SQL truyền thống. ORM cũng cung cấp quyền truy cập bộ nhớ thay cho các phép nối không hiệu quả, vì vậy chúng thực sự có thể hiệu quả hơn nhiều so với SQL trong các tình huống trong thế giới thực. Ngoài ra, với sự lựa chọn thực hiện các hoạt động tập hợp phức tạp trong ngôn ngữ tập hợp thủ tục hạn chế như SQL hoặc phức tạp trong các hoạt động bộ nhớ bằng cách sử dụng ngôn ngữ phong phú hơn, biểu cảm hơn và dễ bảo trì hơn, ngôn ngữ phong phú hơn sẽ chiến thắng nếu bạn mong muốn duy trì hoặc mở rộng ứng dụng

M

Tôi nghĩ bạn chưa hiểu rõ về lý do cũng như đặc điểm của ORM. ORM không chỉ cô lập các mối quan tâm về dữ liệu, chúng còn cung cấp khả năng kiểm tra và tính linh hoạt cao hơn so với các máy khách SQL truyền thống. ORM cũng cung cấp quyền truy cập bộ nhớ thay cho các phép nối không hiệu quả, vì vậy chúng thực sự có thể hiệu quả hơn nhiều so với SQL trong các tình huống trong thế giới thực. Ngoài ra, với sự lựa chọn thực hiện các hoạt động tập hợp phức tạp trong ngôn ngữ tập hợp thủ tục hạn chế như SQL hoặc phức tạp trong các hoạt động bộ nhớ bằng cách sử dụng ngôn ngữ phong phú hơn, biểu cảm hơn và dễ bảo trì hơn, ngôn ngữ phong phú hơn sẽ chiến thắng nếu bạn mong muốn duy trì hoặc mở rộng ứng dụng

M

Bạn không biết những gì bạn đang nói về. Nếu bạn đang viết một ứng dụng không tầm thường và không sử dụng ORM thì tôi chắc chắn rằng sẽ có nhiều nhà phát triển cả hiện tại và trong tương lai sẽ nguyền rủa tên bạn khi họ lướt qua hàng đống SQL lố bịch. Khả năng kiểm tra? . Khi tôi thấy những bình luận lố bịch như thế này đến từ nút. js fanboi, điều đó khiến tôi nghi ngờ rằng họ sẽ hát một giai điệu khác nếu nút. js có khả năng RDBMS tốt

M

Bạn không biết những gì bạn đang nói về. Nếu bạn đang viết một ứng dụng không tầm thường và không sử dụng ORM thì tôi chắc chắn rằng sẽ có nhiều nhà phát triển cả hiện tại và trong tương lai sẽ nguyền rủa tên bạn khi họ lướt qua hàng đống SQL lố bịch. Khả năng kiểm tra? . Khi tôi thấy những bình luận lố bịch như thế này đến từ nút. js fanboi, điều đó khiến tôi nghi ngờ rằng họ sẽ hát một giai điệu khác nếu nút. js có khả năng RDBMS tốt

Bể bơi Lambda

bạn chỉ đánh giá quá cao ORM, chẳng hạn như hầu hết các fanboy OO đều làm

Bể bơi Lambda

bạn chỉ đánh giá quá cao ORM, chẳng hạn như hầu hết các fanboy OO đều làm

Bể bơi Lambda

nhận xét của bạn cũng thật nực cười, ORM không phải là mẫu được mọi người chấp nhận

Bể bơi Lambda

nhận xét của bạn cũng thật nực cười, ORM không phải là mẫu được mọi người chấp nhận

M

Điều trớ trêu là lambda's (hay còn gọi là phương thức ẩn danh) là cơ sở của cả javascript và kỹ thuật ưa thích để triển khai nhiều kiểu gọi lại của C #, mặc dù có kiểu an toàn đầy đủ. Trên thực tế, các đặc điểm chính của nút (2 chiều, nhẹ, không đồng bộ đã được triển khai hiệu quả trong C# dưới dạng "SignalR" và có một số tính năng ngôn ngữ vừa không đồng bộ vừa đa luồng, (không giống như nút. js). Bây giờ tôi có thể hiểu nếu trải nghiệm của bạn với ORM bị giới hạn ở Hibernate (hoàn toàn khủng khiếp, một trong những triển khai tồi tệ nhất của một khái niệm chính mà tôi từng không hài lòng khi làm việc) hoặc thậm chí là EF, ít nhất là khá mạnh mẽ và biểu cảm do . Nhưng một ORM vi mô như Dapper mang lại cho bạn tất cả tính linh hoạt và sức mạnh của SQL trực tiếp với lợi ích của việc thao tác dữ liệu phong phú thông qua các đối tượng và nhanh, rất nhanh. Và tôi xin lỗi, nhưng OOP là một chiến lược thiết kế rất hiệu quả, đã được chứng minh nếu bạn biết mình đang làm gì, tôi. e. , bạn là dân chuyên nghiệp. Tôi thấy có ba vấn đề lớn với nút. js mà dường như không ai có câu trả lời hay cho. Vì vậy, bạn bắt đầu với tiền đề rằng việc chờ đợi IO không hiệu quả đến mức có tiềm năng to lớn ở đó. Vì vậy, vâng, bạn đã có tính đồng thời tuyệt vời, ngay cho đến khi bạn đến thư viện chặn đầu tiên, cơ sở dữ liệu, máy chủ tệp, v.v., thực tế là mọi phần chính của chức năng được viết. Vì vậy, chỉ cần nhanh lên và đợi 10.000 kết nối thay vì 100, ok đó là điều gì đó, nhưng nó sẽ đưa bạn đến đâu? . Bởi vì cuối cùng, mọi cơ sở dữ liệu trên trái đất cuối cùng đều có một cánh tay từ tính lướt qua đĩa hoặc đọc bộ nhớ trạng thái rắn và điều đó giả định rằng bạn đang sử dụng cùng một máy, trái ngược với việc phân phối dữ liệu qua một nhóm kết nối mạng chậm hơn nhiều. Sau đó, bạn có vấn đề đơn luồng. Có lẽ không có ngôn ngữ nào bị lạm dụng nhiều hơn Javascript vì rào cản gia nhập quá thấp. Và mặc dù những người dùng đầu tiên có thể hiểu một cách làm không tốt khi họ nhìn thấy, nhưng hầu hết các lập trình viên javascript chỉ đơn giản là không biết họ đang làm gì. Thứ ba, Javascript không hẳn là một ngôn ngữ đặc biệt nhanh, vì vậy lời khuyên có vẻ là đừng thực hiện các tác vụ chuyên sâu về tính toán. Điều đó đưa bạn đến đâu?

M

Điều trớ trêu là lambda's (hay còn gọi là phương thức ẩn danh) là cơ sở của cả javascript và kỹ thuật ưa thích để triển khai nhiều kiểu gọi lại của C #, mặc dù có kiểu an toàn đầy đủ. Trên thực tế, các đặc điểm chính của nút (2 chiều, nhẹ, không đồng bộ đã được triển khai hiệu quả trong C# dưới dạng "SignalR" và có một số tính năng ngôn ngữ vừa không đồng bộ vừa đa luồng, (không giống như nút. js). Bây giờ tôi có thể hiểu nếu trải nghiệm của bạn với ORM bị giới hạn ở Hibernate (hoàn toàn khủng khiếp, một trong những triển khai tồi tệ nhất của một khái niệm chính mà tôi từng không hài lòng khi làm việc) hoặc thậm chí là EF, ít nhất là khá mạnh mẽ và biểu cảm do . Nhưng một ORM vi mô như Dapper mang lại cho bạn tất cả tính linh hoạt và sức mạnh của SQL trực tiếp với lợi ích của việc thao tác dữ liệu phong phú thông qua các đối tượng và nhanh, rất nhanh. Và tôi xin lỗi, nhưng OOP là một chiến lược thiết kế rất hiệu quả, đã được chứng minh nếu bạn biết mình đang làm gì, tôi. e. , bạn là dân chuyên nghiệp. Tôi thấy có ba vấn đề lớn với nút. js mà dường như không ai có câu trả lời hay cho. Vì vậy, bạn bắt đầu với tiền đề rằng việc chờ đợi IO không hiệu quả đến mức có tiềm năng to lớn ở đó. Vì vậy, vâng, bạn đã có tính đồng thời tuyệt vời, ngay cho đến khi bạn đến thư viện chặn đầu tiên, cơ sở dữ liệu, máy chủ tệp, v.v., thực tế là mọi phần chính của chức năng được viết. Vì vậy, chỉ cần nhanh lên và đợi 10.000 kết nối thay vì 100, ok đó là điều gì đó, nhưng nó sẽ đưa bạn đến đâu? . Bởi vì cuối cùng, mọi cơ sở dữ liệu trên trái đất cuối cùng đều có một cánh tay từ tính lướt qua đĩa hoặc đọc bộ nhớ trạng thái rắn và điều đó giả định rằng bạn đang sử dụng cùng một máy, trái ngược với việc phân phối dữ liệu qua một nhóm kết nối mạng chậm hơn nhiều. Sau đó, bạn có vấn đề đơn luồng. Có lẽ không có ngôn ngữ nào bị lạm dụng nhiều hơn Javascript vì rào cản gia nhập quá thấp. Và mặc dù những người dùng đầu tiên có thể hiểu một cách làm không tốt khi họ nhìn thấy, nhưng hầu hết các lập trình viên javascript chỉ đơn giản là không biết họ đang làm gì. Thứ ba, Javascript không hẳn là một ngôn ngữ đặc biệt nhanh, vì vậy lời khuyên có vẻ là đừng thực hiện các tác vụ chuyên sâu về tính toán. Điều đó đưa bạn đến đâu?

M

Wow, đó là một tuyên bố thiếu hiểu biết nghiêm trọng. Tải tệp lên máy chủ web là *THE* đã nêu lý do của nút. js về lý do tại sao anh ấy muốn có một thư viện không chặn. Vì vậy, khi bạn fanboi thoát ra khỏi thế giới cắt và dán mã đơn luồng, năng động chậm chạp với loại không an toàn, đa luồng và chỉ có một mẹo nhỏ (lambdas) để khớp. nhiều khả năng không đồng bộ của Net, (tất cả là để bạn có thể thu hút thêm gấp 10 lần người dùng nhanh lên và đợi IO), sau đó bạn có thể giảng cho chúng tôi về "sự phức tạp". Các. Net framework có bộ tính năng tiên tiến hơn rất nhiều so với bất kỳ ngôn ngữ nào bạn có thể đặt tên, dấu chấm và IIS, được định cấu hình đúng cách, có thể đánh bại Apache và có thể dễ dàng khớp nginx làm proxy ngược hoặc cho nội dung tĩnh. Cuối cùng, bạn đã có một số vấn đề khó chữa. 1. Javascript chậm và công nghệ bạn chọn là đơn luồng, vì vậy các tác vụ điện toán chuyên sâu không phải bàn. 2. Gỡ lỗi Javascript và thử nghiệm vượt trội so với bất kỳ ngôn ngữ đánh máy nào. Chuyên gia sử dụng thử nghiệm rộng rãi, không bay theo quần 'này, nó hoạt động'. 3. Cách tiếp cận 'mọi thứ đều là mô-đun' không phải là một kiến ​​trúc, nó là một lời mời đến sự hỗn loạn, giống như Perl hoặc PHP. 4. Đồng thời không mua cho bạn những thứ tào lao nếu tất cả những gì bạn đang làm là chờ đợi một số quy trình ràng buộc IO khác, đó là hầu hết mọi thứ đáng để làm với máy tính. 5. Chất lượng và kinh nghiệm của nhiều lập trình viên javascript (không phải nút. js, nhưng sự phổ biến sẽ mang lại cho họ) rất kém, thể hiện qua các bình luận trong đó fanboi chứng minh rằng họ không biết làm thế nào các hệ thống khác thực sự không bỏ qua bất kỳ vấn đề máy tính nào mà họ không thể giải quyết được.

M

Wow, đó là một tuyên bố thiếu hiểu biết nghiêm trọng. Tải tệp lên máy chủ web là *THE* đã nêu lý do của nút. js về lý do tại sao anh ấy muốn có một thư viện không chặn. Vì vậy, khi bạn fanboi thoát ra khỏi thế giới cắt và dán mã đơn luồng, năng động chậm chạp với loại không an toàn, đa luồng và chỉ có một mẹo nhỏ (lambdas) để khớp. nhiều khả năng không đồng bộ của Net, (tất cả là để bạn có thể thu hút thêm gấp 10 lần người dùng nhanh lên và đợi IO), sau đó bạn có thể giảng cho chúng tôi về "sự phức tạp". Các. Net framework có bộ tính năng tiên tiến hơn rất nhiều so với bất kỳ ngôn ngữ nào bạn có thể đặt tên, dấu chấm và IIS, được định cấu hình đúng cách, có thể đánh bại Apache và có thể dễ dàng khớp nginx làm proxy ngược hoặc cho nội dung tĩnh. Cuối cùng, bạn đã có một số vấn đề khó chữa. 1. Javascript chậm và công nghệ bạn chọn là đơn luồng, vì vậy các tác vụ điện toán chuyên sâu không phải bàn. 2. Gỡ lỗi Javascript và thử nghiệm vượt trội so với bất kỳ ngôn ngữ đánh máy nào. Chuyên gia sử dụng thử nghiệm rộng rãi, không bay theo quần 'này, nó hoạt động'. 3. Cách tiếp cận 'mọi thứ đều là mô-đun' không phải là một kiến ​​trúc, nó là một lời mời đến sự hỗn loạn, giống như Perl hoặc PHP. 4. Đồng thời không mua cho bạn những thứ tào lao nếu tất cả những gì bạn đang làm là chờ đợi một số quy trình ràng buộc IO khác, đó là hầu hết mọi thứ đáng để làm với máy tính. 5. Chất lượng và kinh nghiệm của nhiều lập trình viên javascript (không phải nút. js, nhưng sự phổ biến sẽ mang lại cho họ) rất kém, thể hiện qua các bình luận trong đó fanboi chứng minh rằng họ không biết làm thế nào các hệ thống khác thực sự không bỏ qua bất kỳ vấn đề máy tính nào mà họ không thể giải quyết được.

Bể bơi Lambda

ORM chỉ là giải pháp cho vấn đề trở kháng không phù hợp, không có gì khác. Nó không phải là vấn đề lớn, về OO, nó là một mô hình chéo giống như AOP và nó không thực sự dựa trên bất cứ thứ gì khác ngoài sự đóng gói. Không có mô hình thủ tục OO không làm gì cả, mọi lập trình viên lành nghề thực sự đều biết rằng

Bể bơi Lambda

ORM chỉ là giải pháp cho vấn đề trở kháng không phù hợp, không có gì khác. Nó không phải là vấn đề lớn, về OO, nó là một mô hình chéo giống như AOP và nó không thực sự dựa trên bất cứ thứ gì khác ngoài sự đóng gói. Không có mô hình thủ tục OO không làm gì cả, mọi lập trình viên lành nghề thực sự đều biết rằng

M

Sự không phù hợp trở kháng liên quan đến tất cả các loại phân nhánh, đặc biệt là liên quan đến khả năng bảo trì, tính di động, khả năng mở rộng và hiệu suất. Để trích dẫn Ethan ở trên (vì lời giải thích của tôi rõ ràng là không có). ". đó là một công cụ được sử dụng để đóng gói các mối quan tâm về cơ sở dữ liệu, cách ly chúng khỏi ứng dụng. Có một số lợi ích, nhưng cuối cùng, nó giúp các ứng dụng dễ dàng kiểm tra và duy trì trong nhiều năm tới. " "về OO, nó là một mô hình chéo giống như AOP và nó không thực sự dựa trên bất cứ điều gì khác ngoài sự đóng gói. Nếu không có mô hình thủ tục thì OO chẳng làm được gì" Ok, tôi chắc chắn sẽ truyền bá thông điệp rằng chúng ta nên ngừng đùa giỡn với tất cả những thứ OOP bí truyền này và quay lại với một ngôn ngữ cho phép chúng ta thực hiện mọi thứ trực quan hóa sự đóng gói. VB6. Bạn sẽ nghĩ rằng một lập trình viên Javascript có thể muốn đề cập đến tính kế thừa, nếu không phải là tính đa hình, vì javascript có một cơ chế tương đối khác thường đối với nó. nguyên mẫu

M

Sự không phù hợp trở kháng liên quan đến tất cả các loại phân nhánh, đặc biệt là liên quan đến khả năng bảo trì, tính di động, khả năng mở rộng và hiệu suất. Để trích dẫn Ethan ở trên (vì lời giải thích của tôi rõ ràng là không có). ". đó là một công cụ được sử dụng để đóng gói các mối quan tâm về cơ sở dữ liệu, cách ly chúng khỏi ứng dụng. Có một số lợi ích, nhưng cuối cùng, nó giúp các ứng dụng dễ dàng kiểm tra và duy trì trong nhiều năm tới. " "về OO, nó là một mô hình chéo giống như AOP và nó không thực sự dựa trên bất cứ điều gì khác ngoài sự đóng gói. Nếu không có mô hình thủ tục thì OO chẳng làm được gì" Ok, tôi chắc chắn sẽ truyền bá thông điệp rằng chúng ta nên ngừng đùa giỡn với tất cả những thứ OOP bí truyền này và quay lại với một ngôn ngữ cho phép chúng ta thực hiện mọi thứ trực quan hóa sự đóng gói. VB6. Bạn sẽ nghĩ rằng một lập trình viên Javascript có thể muốn đề cập đến tính kế thừa, nếu không phải là tính đa hình, vì javascript có một cơ chế tương đối khác thường đối với nó. nguyên mẫu

M

Một singleton là một đối tượng có thể khởi tạo (không tĩnh) với một hàm tạo riêng để chỉ có thể tạo một cá thể duy nhất. (Hãy tưởng tượng một lớp thể hiện với một thuộc tính tĩnh hiển thị một thể hiện của chính nó phụ thuộc vào một hàm tạo cá thể riêng). Nó đã thực sự được thực hiện trong Java trước đây. mạng tồn tại. Có lẽ những gì bạn đang nghĩ đến là cơ chế Gọi lại không chặn, được xử lý trong C# thông qua các đại biểu, sự kiện (đại biểu phát đa hướng) và các từ khóa async và await mới biến C# tiêu chuẩn thành lambda để được thực thi tại thời điểm biên dịch. Nó cũng xử lý các hoạt động không đồng bộ đa luồng thông qua các tiện ích mở rộng Song song, cho phép trải tải trên nhiều luồng/lõi miễn là công việc đó không có tính chất nối tiếp. Ngoài ra, tôi khuyến khích bạn kiểm tra một ORM vi mô như Dapper. Nó kém toàn diện hơn nhiều so với EF, nhưng nó linh hoạt hơn nhiều và không gây cản trở, cộng với nó hiệu quả hơn đáng kể so với Hibernate và EF (nhanh hơn khoảng 5 lần để đọc)

M

Một singleton là một đối tượng có thể khởi tạo (không tĩnh) với một hàm tạo riêng để chỉ có thể tạo một cá thể duy nhất. (Hãy tưởng tượng một lớp thể hiện với một thuộc tính tĩnh hiển thị một thể hiện của chính nó phụ thuộc vào một hàm tạo cá thể riêng). Nó đã thực sự được thực hiện trong Java trước đây. mạng tồn tại. Có lẽ những gì bạn đang nghĩ đến là cơ chế Gọi lại không chặn, được xử lý trong C# thông qua các đại biểu, sự kiện (đại biểu phát đa hướng) và các từ khóa async và await mới biến C# tiêu chuẩn thành lambda để được thực thi tại thời điểm biên dịch. Nó cũng xử lý các hoạt động không đồng bộ đa luồng thông qua các tiện ích mở rộng Song song, cho phép trải tải trên nhiều luồng/lõi miễn là công việc đó không có tính chất nối tiếp. Ngoài ra, tôi khuyến khích bạn kiểm tra một ORM vi mô như Dapper. Nó kém toàn diện hơn nhiều so với EF, nhưng nó linh hoạt hơn nhiều và không gây cản trở, cộng với nó hiệu quả hơn đáng kể so với Hibernate và EF (nhanh hơn khoảng 5 lần để đọc)

Qalandr

Có bài viết này làm rung chuyển ngực. Esp tốt cho người Croatia có ESL. ;) #nodeboy

Qalandr

Có bài viết này làm rung chuyển ngực. Esp tốt cho người Croatia có ESL. ;) #nodeboy

Ty Turner

Chúng tôi đang tìm kiếm một Nút. nhà phát triển js. Vui lòng xem http. // cao hơn. com/careers/search-jobs/ để biết chi tiết. Cảm ơn bạn

Ty Turner

Chúng tôi đang tìm kiếm một Nút. nhà phát triển js. Vui lòng xem http. // cao hơn. com/careers/search-jobs/ để biết chi tiết. Cảm ơn bạn

Vob Bobily

Vì vậy, sau khi đọc bài viết của bạn, tôi vẫn chưa hiểu tại sao Node js muốn phát minh lại bánh xe. Tôi vẫn nghĩ nút js và lượt thích là tào lao

Vob Bobily

Vì vậy, sau khi đọc bài viết của bạn, tôi vẫn chưa hiểu tại sao Node js muốn phát minh lại bánh xe. Tôi vẫn nghĩ nút js và lượt thích là tào lao

cintalauraramarimari

A great introduction to find out what it is JavaScript and once the answer to from bagaimana tips mengatasi wanita frigid

cintalauraramarimari

A great introduction to find out what it is JavaScript and once the answer to from bagaimana tips mengatasi wanita frigid

Đa-ni-ên

Noob questions. Um, isn't the ease with which you can move request data (i. e. untrusted data) into database (where data is assumed to be trusted) a big hazard? How do you ensure that you never forget to inspect every piece of incoming data when it arrives, before you start trusting it? Generally, I would assume something as popular as Node. js would have thought of this, but I remember back when Rails had blanket model update. That changed real quick when Github's use of this "feature" was exploited (fortunately, by a whitehat). Also, of course, just because you add a conversion speed bump does not mean that people won't make mistakes, but at least they're more likely to give it some thought, which probably means they're going to make less mistakes

Đa-ni-ên

Noob questions. Um, isn't the ease with which you can move request data (i. e. untrusted data) into database (where data is assumed to be trusted) a big hazard? How do you ensure that you never forget to inspect every piece of incoming data when it arrives, before you start trusting it? Generally, I would assume something as popular as Node. js would have thought of this, but I remember back when Rails had blanket model update. That changed real quick when Github's use of this "feature" was exploited (fortunately, by a whitehat). Also, of course, just because you add a conversion speed bump does not mean that people won't make mistakes, but at least they're more likely to give it some thought, which probably means they're going to make less mistakes

Q

I don't understand the angst against using an ORM. Were you in a proper environment where concerns were separated? The ones bashing ORM just sound like they don't know what they're doing or how to engineer proper software. Why on earth would I want to go from writing software in Java/C#/_whatever_ to drop into SQL where it is hard to version, properly test, and can apparently cause severe brain damage? Everything is a double edged sword - an implementation or a convention like using an ORM over raw SQL really doesn't matter. Depending on the situation raw SQL might be best. it might be better to use a NoSQL store. maybe an ORM is fine. Usually, from my experience, I can tell you that an ORM is better for a lot of reasons, and they have been relayed by M. I spent the time to write my own libraries to abstract vendor specific implementations and you need to create your own mappings. You can easily spawn from a certain state or use existing data structures. It took time to write my libraries and it was not easy at all to do it but it was well worth my time to do it since I can now reuse my libraries. Is it the BEST? I don't know. I like it but I certainly won't go around to arbitrary technical articles that have nothing to do about SQL and post something like "Yes this technology is good but stay away from raw SQL. " I just don't see a need to be bashing anything here, especially an ORM when the article is exclusively about JS and NodeJS

Q

I don't understand the angst against using an ORM. Were you in a proper environment where concerns were separated? The ones bashing ORM just sound like they don't know what they're doing or how to engineer proper software. Why on earth would I want to go from writing software in Java/C#/_whatever_ to drop into SQL where it is hard to version, properly test, and can apparently cause severe brain damage? Everything is a double edged sword - an implementation or a convention like using an ORM over raw SQL really doesn't matter. Depending on the situation raw SQL might be best. it might be better to use a NoSQL store. maybe an ORM is fine. Usually, from my experience, I can tell you that an ORM is better for a lot of reasons, and they have been relayed by M. I spent the time to write my own libraries to abstract vendor specific implementations and you need to create your own mappings. You can easily spawn from a certain state or use existing data structures. It took time to write my libraries and it was not easy at all to do it but it was well worth my time to do it since I can now reuse my libraries. Is it the BEST? I don't know. I like it but I certainly won't go around to arbitrary technical articles that have nothing to do about SQL and post something like "Yes this technology is good but stay away from raw SQL. " I just don't see a need to be bashing anything here, especially an ORM when the article is exclusively about JS and NodeJS

Michael

Probably one of the main points of this article, that gives Node is supposed scalability, is the offloading to a Queue or Service Bus that leads to asynchronous processing. That is a well proven architectural pattern, available in many languages, is especially used in CQRS (Command Query Responsibility Segregation) with Event Sourcing, is very well suited to be used by technologies such . Net Reactive Extensions that provide considerably greater functionality and flexibility than Node. Asynchronous programming and handling its pitfalls has been around without Node for years, if you had knowledge of enterprise development. As for the hate against ORMs. you guys crticising it seem to be moving from front-end development into an area where you have no knowledge or expertise in OO, BDD, TDD or any other proven Enterprise level methodology. No concept of integration other than Twitter feeds. No experience of complex Workflow or scalable caching. This is one of the dangers - you know JavaScript, and a bit of SQL. So everything else is superfluous - until you need it, such as the attempts to bring an element of type checking to JavaScript. Nghiêm túc mà nói, mỗi công nghệ đều có vị trí của nó, nhưng không có một cách tiếp cận nào phù hợp với tất cả. Appreciate the strengths of each technology, and use them where appropriate

Michael

Probably one of the main points of this article, that gives Node is supposed scalability, is the offloading to a Queue or Service Bus that leads to asynchronous processing. That is a well proven architectural pattern, available in many languages, is especially used in CQRS (Command Query Responsibility Segregation) with Event Sourcing, is very well suited to be used by technologies such . Net Reactive Extensions that provide considerably greater functionality and flexibility than Node. Asynchronous programming and handling its pitfalls has been around without Node for years, if you had knowledge of enterprise development. As for the hate against ORMs. you guys crticising it seem to be moving from front-end development into an area where you have no knowledge or expertise in OO, BDD, TDD or any other proven Enterprise level methodology. No concept of integration other than Twitter feeds. No experience of complex Workflow or scalable caching. This is one of the dangers - you know JavaScript, and a bit of SQL. So everything else is superfluous - until you need it, such as the attempts to bring an element of type checking to JavaScript. Nghiêm túc mà nói, mỗi công nghệ đều có vị trí của nó, nhưng không có một cách tiếp cận nào phù hợp với tất cả. Appreciate the strengths of each technology, and use them where appropriate

Reo

Great introduction to node. js. Thanks, i samo naprjed

Reo

Great introduction to node. js. Thanks, i samo naprjed

Richard Bellantoni

Because they suck for a complex application. Sure if your scenario where you spent all this time trying to make the ORM work the way you need it to, you could have just put that same effort into writing the SQL properly and making sure it's organized etc and you would be further along in the project and have more control over the application. ORM's are great at saving time on a small to medium scale project, but once you delve into more complex and larger applications, you're going to spend either A. ) A lot of time coding to make the ORM work the way you need it or B. ) Just decide to write the SQL yourself because the time it takes to make the tool work how you need it just isn't worth it

Richard Bellantoni

Because they suck for a complex application. Sure if your scenario where you spent all this time trying to make the ORM work the way you need it to, you could have just put that same effort into writing the SQL properly and making sure it's organized etc and you would be further along in the project and have more control over the application. ORM's are great at saving time on a small to medium scale project, but once you delve into more complex and larger applications, you're going to spend either A. ) A lot of time coding to make the ORM work the way you need it or B. ) Just decide to write the SQL yourself because the time it takes to make the tool work how you need it just isn't worth it

sinta maharani

JavaScript is better than some of the other programming languages. therefore cara menghilangkan gatal keputihan better fit with JavaScript

sinta maharani

JavaScript is better than some of the other programming languages. therefore cara menghilangkan gatal keputihan better fit with JavaScript

naseya10

Great, informative article. Thanks for sharing this. Unlockpwd

naseya10

Great, informative article. Thanks for sharing this. Unlockpwd

Eric Elliott

Pot, meet kettle. Those may be intractable problems if any of them were true. None of them are. 1. a) JavaScript is all JIT these days and delivers 1-2x native code performance (faster than any other dynamic language I'm aware of). b) Non-blocking by default can deliver orders-of-magnitude improvements in code efficiency - transparently. 2. Almost all modern editors support type inference for JS. ESLint, Closure Compiler, and a number of other options offer sophisticated static analysis capabilities. TypeScript even offers a nice structural type system. 3. The opposite of modular is a tightly coupled monolith. That's a bad idea in ANY language. 4. "if all you are doing is waiting for some other IO bound process" - Non-blocking by default means you're NEVER waiting for some other IO bound process. That's why Node delivers such huge improvements on resource utilization. 5. 2006 called. They want their language-snob attitude back. The days when serious engineers considered JS to be a toy are long since over. JS powers sophisticated enterprise applications at just about every fortune 500 today. Additional point. JS is the only language with fully native support for isomorphic code (meaning you reuse most of your application on both servers and clients). You can write JS ONCE, and it will power the server, the web browser, and mobile devices including iOS and Android. See React Native. https. //leanpub. com/learn-javascript-react-nodejs-es6/

Eric Elliott

Pot, meet kettle. Those may be intractable problems if any of them were true. None of them are. 1. a) JavaScript is all JIT these days and delivers 1-2x native code performance (faster than any other dynamic language I'm aware of). b) Non-blocking by default can deliver orders-of-magnitude improvements in code efficiency - transparently. 2. Almost all modern editors support type inference for JS. ESLint, Closure Compiler, and a number of other options offer sophisticated static analysis capabilities. TypeScript even offers a nice structural type system. 3. The opposite of modular is a tightly coupled monolith. That's a bad idea in ANY language. 4. "if all you are doing is waiting for some other IO bound process" - Non-blocking by default means you're NEVER waiting for some other IO bound process. That's why Node delivers such huge improvements on resource utilization. 5. 2006 called. They want their language-snob attitude back. The days when serious engineers considered JS to be a toy are long since over. JS powers sophisticated enterprise applications at just about every fortune 500 today. Additional point. JS is the only language with fully native support for isomorphic code (meaning you reuse most of your application on both servers and clients). You can write JS ONCE, and it will power the server, the web browser, and mobile devices including iOS and Android. See React Native. https. //leanpub. com/learn-javascript-react-nodejs-es6/

M

1) 1-2x native code performance? Do the electrons run faster on node code? Not a good start. 2) Type inference is mapping variable declarations to types without explicit syntax, i. e. , a) it requires actual types, and b) compilers enforce type safety, not editors. And you can dress it up any way you want, but there is no way to enforce sophisticated state analysis with slop-tastic dictionaries of whatever stored in strings & functional delegates. Also, Typescript is not Javascript, it is Javascript with a half-assed type system pasted on top. Even Google is abandoning Js for Typescript in Angular 2. 0 Why? Because Google has decided that an untyped system is insufficient for serious work. But is that type system anywhere near as sophisticated as a compiled language? Nope, not even close. 3) You are misunderstanding what I was characterizing as "modular design". The alternative is not monolithic code, but encapsulation, specialization via inheritance (or prototyping), polymorphism, and externalizing dependencies via IoC. The alternative is SOLID, i. e. , Hướng đối tượng hiện đại. 4) Your process may not be waiting, but your customers are waiting for the callback. My point is that being able to serve more requests doesn't do you any good if every served request then has to wait on yet another operation. In the end, somewhere somehow, you will eventually be going to a disk or waiting for IO, because that's where the information the customer wants lives. 5) I didn't say that JavaScript was a toy language, I said that most JavaScript developers are well-meaning, cut and paste amateurs, and they will invade the ranks of node. js developers as it becomes more popular. I'll take a strong type system over "full native support" (that's not native) for "isometric" code that can run on clients or servers [you say that like that's a good thing] any day. Wow, Js trên Android và iOS. Tôi đoán rằng thời của Apple bổ sung một ngôn ngữ bản địa, được gõ mạnh khác cho iOS đã qua Rõ ràng là bạn chưa bao giờ nghe nói về Mono, nền tảng chéo. Net biên dịch và chạy trên mọi hệ điều hành chính, tạo thời gian chạy gốc cho cả ba nền tảng di động chính và chạy trên mọi thứ từ cụm beowulf đến thiết bị đeo được. Đây là lý do tại sao chúng tôi không tôn trọng bạn. Bạn không biết hoặc không hiểu bất cứ điều gì xảy ra trước đó hoặc bất kỳ điều gì bên ngoài bong bóng javascript của bạn. Bạn không giải quyết bất kỳ vấn đề nào chưa được giải quyết trước đây, nhưng bạn tin rằng mình có tất cả các câu trả lời. That seems to be a common theme with anyone whose education system stressed self-esteem over critical thinking

M

1) 1-2x native code performance? Do the electrons run faster on node code? Not a good start. 2) Type inference is mapping variable declarations to types without explicit syntax, i. e. , a) it requires actual types, and b) compilers enforce type safety, not editors. And you can dress it up any way you want, but there is no way to enforce sophisticated state analysis with slop-tastic dictionaries of whatever stored in strings & functional delegates. Also, Typescript is not Javascript, it is Javascript with a half-assed type system pasted on top. Even Google is abandoning Js for Typescript in Angular 2. 0 Why? Because Google has decided that an untyped system is insufficient for serious work. But is that type system anywhere near as sophisticated as a compiled language? Nope, not even close. 3) You are misunderstanding what I was characterizing as "modular design". The alternative is not monolithic code, but encapsulation, specialization via inheritance (or prototyping), polymorphism, and externalizing dependencies via IoC. The alternative is SOLID, i. e. , Hướng đối tượng hiện đại. 4) Your process may not be waiting, but your customers are waiting for the callback. My point is that being able to serve more requests doesn't do you any good if every served request then has to wait on yet another operation. In the end, somewhere somehow, you will eventually be going to a disk or waiting for IO, because that's where the information the customer wants lives. 5) I didn't say that JavaScript was a toy language, I said that most JavaScript developers are well-meaning, cut and paste amateurs, and they will invade the ranks of node. js developers as it becomes more popular. I'll take a strong type system over "full native support" (that's not native) for "isometric" code that can run on clients or servers [you say that like that's a good thing] any day. Wow, Js trên Android và iOS. Tôi đoán rằng thời của Apple bổ sung một ngôn ngữ bản địa, được gõ mạnh khác cho iOS đã qua Rõ ràng là bạn chưa bao giờ nghe nói về Mono, nền tảng chéo. Net biên dịch và chạy trên mọi hệ điều hành chính, tạo thời gian chạy gốc cho cả ba nền tảng di động chính và chạy trên mọi thứ từ cụm beowulf đến thiết bị đeo được. Đây là lý do tại sao chúng tôi không tôn trọng bạn. Bạn không biết hoặc không hiểu bất cứ điều gì xảy ra trước đó hoặc bất kỳ điều gì bên ngoài bong bóng javascript của bạn. Bạn không giải quyết bất kỳ vấn đề nào chưa được giải quyết trước đây, nhưng bạn tin rằng mình có tất cả các câu trả lời. That seems to be a common theme with anyone whose education system stressed self-esteem over critical thinking

Eric Elliott

This reply just strikes me as willful ignorance. 1. Really? Rather than investigate and learn the truth, you just want to ridicule the answer? I'm not taking the bait. Xem các bài nói chuyện trôi chảy của Brendan Eich nếu bạn thực sự muốn học điều gì đó. 2. I know what types and type inference are, and I know the benefits of static types. I've been in this game since before JavaScript was invented. TypeScript is a superset of JavaScript that compiles to JS & allows for sophisticated static analysis. It's structural type system is better than the type system Java had back when I was coding in Java, and it's much better (as in more reliable and flexible) than C and C++. 3. "encapsulation, specialization via inheritance (or prototyping), polymorphism, and externalizing dependencies via IoC" - these are all forms of modularity, and JavaScript modules provide viable alternatives to all of them - and in the case of class inheritance, it's far superior. See https. //medium. com/javascript-scene/the-two-pillars-of-javascript-ee6f3281e7f3 4. "your customers are waiting for the callback. " Fortunately, that's where the performance I talked about in point 1 shines. JS provides efficient utilization of I/O resources. In fact, dealing with I/O bottlenecks is the entire reason that Node was invented. I've ported several large production projects from PHP and Ruby to Node, and seen dramatic reductions in response times, both average response times and response time ranges - and since a typical Node app utilizes a small fraction of the memory required for C# applications, your customer I/O competes less with the RAM paging you might experience with a compiled C# application. 5. "you say that like that's a good thing" I've seen objectively measurable increases in team velocity ranging from 40% - 60% improvements. Believe it or not, it's a fact, and being more able to adapt to changing needs and experiment more (particularly in the UI layer) delivers very real business value. Why do you think so many enterprise organizations are adopting Node? It's not because some dev prefers JS. It's because they ran the tests themselves and figured out it's a huge win. "Obviously you've never heard of Mono, the cross platform . Net that compiles and runs on every major OS" Yeah, I have - what I haven't heard of is Mono delivering anywhere near the value that Node delivers in enterprise production. Got a good article on that? 'Cause a quick Google search isn't turning up much. Check out this awesome result in the top 3 of the SERP. http. //www. quora. com/Why-isnt-C-with-Mono-popular-for-enterprise-applications-on-Linux-servers . but a quick Google search for Enterprise Node. js delivers quite a bit. Here are the top 3 search results I see. http. //blog. risingstack. com/node-js-is-enterprise-ready/ https. //www. joyent. com/nodejs-support https. //www. centurylinkcloud. com/blog/post/node-js-is-taking-over-the-enterprise-whether-you-like-it-or-not/ There's really no contest here

Eric Elliott

This reply just strikes me as willful ignorance. 1. Really? Rather than investigate and learn the truth, you just want to ridicule the answer? I'm not taking the bait. Xem các bài nói chuyện trôi chảy của Brendan Eich nếu bạn thực sự muốn học điều gì đó. 2. I know what types and type inference are, and I know the benefits of static types. I've been in this game since before JavaScript was invented. TypeScript is a superset of JavaScript that compiles to JS & allows for sophisticated static analysis. It's structural type system is better than the type system Java had back when I was coding in Java, and it's much better (as in more reliable and flexible) than C and C++. 3. "encapsulation, specialization via inheritance (or prototyping), polymorphism, and externalizing dependencies via IoC" - these are all forms of modularity, and JavaScript modules provide viable alternatives to all of them - and in the case of class inheritance, it's far superior. See https. //medium. com/javascript-scene/the-two-pillars-of-javascript-ee6f3281e7f3 4. "your customers are waiting for the callback. " Fortunately, that's where the performance I talked about in point 1 shines. JS provides efficient utilization of I/O resources. In fact, dealing with I/O bottlenecks is the entire reason that Node was invented. I've ported several large production projects from PHP and Ruby to Node, and seen dramatic reductions in response times, both average response times and response time ranges - and since a typical Node app utilizes a small fraction of the memory required for C# applications, your customer I/O competes less with the RAM paging you might experience with a compiled C# application. 5. "you say that like that's a good thing" I've seen objectively measurable increases in team velocity ranging from 40% - 60% improvements. Believe it or not, it's a fact, and being more able to adapt to changing needs and experiment more (particularly in the UI layer) delivers very real business value. Why do you think so many enterprise organizations are adopting Node? It's not because some dev prefers JS. It's because they ran the tests themselves and figured out it's a huge win. "Obviously you've never heard of Mono, the cross platform . Net that compiles and runs on every major OS" Yeah, I have - what I haven't heard of is Mono delivering anywhere near the value that Node delivers in enterprise production. Got a good article on that? 'Cause a quick Google search isn't turning up much. Check out this awesome result in the top 3 of the SERP. http. //www. quora. com/Why-isnt-C-with-Mono-popular-for-enterprise-applications-on-Linux-servers . but a quick Google search for Enterprise Node. js delivers quite a bit. Here are the top 3 search results I see. http. //blog. risingstack. com/node-js-is-enterprise-ready/ https. //www. joyent. com/nodejs-support https. //www. centurylinkcloud. com/blog/post/node-js-is-taking-over-the-enterprise-whether-you-like-it-or-not/ There's really no contest here

M

1, yes, I'm mocking your evidently accidental claim that JavaScript makes electrons run faster, or even as fast as native, because it's patent nonsense. Not only is that impossible, it ignores one of node. js' acknowledged weaknesses. It sucks on compute intensive operations, because it's single threaded, which means compute intensive operations block execution. duh. 2. Your knowledge of Java does not qualify you to understand what a competent type system is. Java's generics are a largely useless, johnny come lately me-too feature when compared against to C# generics because they suffer from run-time erasure, in other words, the generic type safety and reflection only works at compile time, because at run time, everything is cast to an object. So when you are going on about static analysis, you are effectively trying to claim it's as good as compile time + run time type reflection, which is very far from the truth. 3. Meh. Chopping up everything into discrete functions is a form of modularity too, but it's vastly inferior to SOLID, which was my point in the first place. And while prototype based inheritance is interesting, it's hardly better than real inheritance, which permits far more flexible arrangements. 4. Tôi không thấy việc tăng tốc ứng dụng Ruby hay cấu trúc lại một số PHP nhảm nhí thành thứ gì đó nhanh hơn ấn tượng như thế nào. Your memory overhead claims are equally baseless. I can run micro. Net on a watch or on an arduino device. I can write . Net that runs very well on an under-powered phone. Look at the memory chrome consumes for an SPA, or try to run a complex javascript app on a tablet, and then tell me how "lightweight" JavaScript is. 5. The lack of a proper separation of concerns (which is the cause of most maintainability problems) is the number one issue I encounter at enterprise scaled customers, and an impressive team velocity is always how they got there. Why do I think a number of organizations are choosing node? Because typically a mediocre, over-sized team of moderate competence f'd up the previously shiny new thing that was supposed to solve all their problems, so they want to believe the hype that the problem is not them, but their previous technology choices

M

1, yes, I'm mocking your evidently accidental claim that JavaScript makes electrons run faster, or even as fast as native, because it's patent nonsense. Not only is that impossible, it ignores one of node. js' acknowledged weaknesses. It sucks on compute intensive operations, because it's single threaded, which means compute intensive operations block execution. duh. 2. Your knowledge of Java does not qualify you to understand what a competent type system is. Java's generics are a largely useless, johnny come lately me-too feature when compared against to C# generics because they suffer from run-time erasure, in other words, the generic type safety and reflection only works at compile time, because at run time, everything is cast to an object. So when you are going on about static analysis, you are effectively trying to claim it's as good as compile time + run time type reflection, which is very far from the truth. 3. Meh. Chopping up everything into discrete functions is a form of modularity too, but it's vastly inferior to SOLID, which was my point in the first place. And while prototype based inheritance is interesting, it's hardly better than real inheritance, which permits far more flexible arrangements. 4. Tôi không thấy việc tăng tốc ứng dụng Ruby hay cấu trúc lại một số PHP nhảm nhí thành thứ gì đó nhanh hơn ấn tượng như thế nào. Your memory overhead claims are equally baseless. I can run micro. Net on a watch or on an arduino device. I can write . Net that runs very well on an under-powered phone. Look at the memory chrome consumes for an SPA, or try to run a complex javascript app on a tablet, and then tell me how "lightweight" JavaScript is. 5. The lack of a proper separation of concerns (which is the cause of most maintainability problems) is the number one issue I encounter at enterprise scaled customers, and an impressive team velocity is always how they got there. Why do I think a number of organizations are choosing node? Because typically a mediocre, over-sized team of moderate competence f'd up the previously shiny new thing that was supposed to solve all their problems, so they want to believe the hype that the problem is not them, but their previous technology choices

Eric Elliott

1. I think you misunderstood my meaning. JS runs 1-2x SLOWER than native -- much better perf than any other dynamic language I know of. It's fast enough to run AAA game engines like Unreal Engine and Unity in stunning quality at 60+ fps. 2. I actually think that a good native type tool would be a good addition to JavaScript, but only if they're user-definable structural types. That said, JavaScript does support static analysis via type inference, and there are a number of ways to provide type hints for dev tools. In addition, JavaScript also has an impressive array of runtime analysis tools. 3. "hardly better than real inheritance, which permits far more flexible arrangements. " Wrong. https. //medium. com/javascript-scene/the-two-pillars-of-javascript-ee6f3281e7f3 4. My apologies. I was not aware of micro. Net. JavaScript also runs as-is on low-powered devices including Arduino, Tessel, and a number of others. Node works great on most of them. If that's not small enough, you can create a custom Node compile, drop features, even swap out the V8 engine for a different JS engine if you need to. You can also restrict yourself to using tiny JS libraries (of which there are many on npm) to keep your codebase compact. 5. ". they want to believe the hype that the problem is not them, but their previous technology choices. " That might explain an experiment or two, but the Node takeover is much more than that. We're rapidly replacing apps in a variety of languages with Node. Having worked at a fortune 500 during the transition to Node, I can tell you our justifications. Chúng tôi đã thử nghiệm chuyển sang Node, đã tìm thấy. 1. that the app was faster and more reliable, delivering huge wins in both average response time, and the number of requests we could serve with the same machine, and 2. The developers were more productive for a variety of reasons, including the fact that JavaScript specialists could more easily work on both sides of the stack without context switching, and a lot of code could be shared in both the server and the client. Those advantages have real, measurable influences on the company's bottom line. That's why Node is taking over at both startups and enterprise companies

Eric Elliott

1. I think you misunderstood my meaning. JS runs 1-2x SLOWER than native -- much better perf than any other dynamic language I know of. It's fast enough to run AAA game engines like Unreal Engine and Unity in stunning quality at 60+ fps. 2. I actually think that a good native type tool would be a good addition to JavaScript, but only if they're user-definable structural types. That said, JavaScript does support static analysis via type inference, and there are a number of ways to provide type hints for dev tools. In addition, JavaScript also has an impressive array of runtime analysis tools. 3. "hardly better than real inheritance, which permits far more flexible arrangements. " Wrong. https. //medium. com/javascript-scene/the-two-pillars-of-javascript-ee6f3281e7f3 4. My apologies. I was not aware of micro. Net. JavaScript also runs as-is on low-powered devices including Arduino, Tessel, and a number of others. Node works great on most of them. If that's not small enough, you can create a custom Node compile, drop features, even swap out the V8 engine for a different JS engine if you need to. You can also restrict yourself to using tiny JS libraries (of which there are many on npm) to keep your codebase compact. 5. ". they want to believe the hype that the problem is not them, but their previous technology choices. " That might explain an experiment or two, but the Node takeover is much more than that. We're rapidly replacing apps in a variety of languages with Node. Having worked at a fortune 500 during the transition to Node, I can tell you our justifications. Chúng tôi đã thử nghiệm chuyển sang Node, đã tìm thấy. 1. that the app was faster and more reliable, delivering huge wins in both average response time, and the number of requests we could serve with the same machine, and 2. The developers were more productive for a variety of reasons, including the fact that JavaScript specialists could more easily work on both sides of the stack without context switching, and a lot of code could be shared in both the server and the client. Those advantages have real, measurable influences on the company's bottom line. That's why Node is taking over at both startups and enterprise companies

Kesava Velugubantla

especially with edge it is really handy

Kesava Velugubantla

especially with edge it is really handy

pawan kumar

Thanks Tamisalv I was looking for quick reference read for understanding node. js and why projects might use it. Đọc nó giúp tôi hiểu rõ hơn về những ưu điểm của công nghệ này và cả khi người ta có thể sử dụng nó. Cheers

pawan kumar

Thanks Tamisalv I was looking for quick reference read for understanding node. js and why projects might use it. Đọc nó giúp tôi hiểu rõ hơn về những ưu điểm của công nghệ này và cả khi người ta có thể sử dụng nó. Cheers

Jay

"After over 20 years of stateless-web based on the stateless request-response paradigm, we finally have web applications with real-time, two-way connections. " Kết quả là ngày nay chúng tôi có các trang web mất nhiều thời gian tải hơn khi chúng tôi có tốc độ Internet theo thứ tự megabyte trên giây, so với trước đây khi tốc độ của chúng tôi theo thứ tự byte trên giây nhưng các trang web của chúng tôi đơn giản là HTML. Nowadays we have webpages which load halfway and then stop, which crash at the slightest network error i. e. dynamic IP address reassigning, or a momentary lapse in the WiFi signal forcing you to reload the whole page, whereas browsers are designed to gracefully handle those errors or resume once the network connection is restored, buggy Javascript scripts don't handle errors as well

Jay

"After over 20 years of stateless-web based on the stateless request-response paradigm, we finally have web applications with real-time, two-way connections. " Kết quả là ngày nay chúng tôi có các trang web mất nhiều thời gian tải hơn khi chúng tôi có tốc độ Internet theo thứ tự megabyte trên giây, so với trước đây khi tốc độ của chúng tôi theo thứ tự byte trên giây nhưng các trang web của chúng tôi đơn giản là HTML. Nowadays we have webpages which load halfway and then stop, which crash at the slightest network error i. e. dynamic IP address reassigning, or a momentary lapse in the WiFi signal forcing you to reload the whole page, whereas browsers are designed to gracefully handle those errors or resume once the network connection is restored, buggy Javascript scripts don't handle errors as well

adroittech

I only have 1 question here with your statement. "It's structural type system is better than the type system Java had back when I was coding in Java, and it's much better (as in more reliable and flexible) than C and C++. " I can not take that. How? can you examplify? Some Facts (with obviously answer in no) - Why did Node inventor used V8 engine which was made in C++ to power node, if the js type system was so flexible and much better? - Can nodejs decode vp8 codec video by itself as efficiently as C/C++? - Could you build nodejs on top of pure javascript instead of C++? - Is there any such thing as pure javascript? You really have to understand my friend that it is a type system that can take advantage of underlying hardware and makes your program efficient at CPU and memory. Strongly typed C++ can solve any problem, even build node js. Node shines at non-blocking i/o and that is about it, it can not do anything else. Yes you can chop-off node code and make it work on micro devices but will it be efficient and make sense? Can you make product like node where you have to code in C++, yes you can but it would not make sense as power of C/C++ in not in web, its optimizations and hardware. It not like non-blocking I/O is something new, we have had that in many technologies including java, . Net, basic, python and perl, this is very old. The only reason why this thing is in limelight is it has enabled millions of frontend javascript developers, who do not understand pointers and bash about C++, to write server code, which is simply overwhelming, that's why the buzz. And about "Node in particular are actually very well suited to handle distributed computation", why on earth one would write such a statement? Node is not made for computation. it can not compute as efficiently as C/C++/Java. Period. With all due respect, lets not bring C++ in picture here, there is simply no practical comparison at all, or it will be very touchy

adroittech

I only have 1 question here with your statement. "It's structural type system is better than the type system Java had back when I was coding in Java, and it's much better (as in more reliable and flexible) than C and C++. " I can not take that. How? can you examplify? Some Facts (with obviously answer in no) - Why did Node inventor used V8 engine which was made in C++ to power node, if the js type system was so flexible and much better? - Can nodejs decode vp8 codec video by itself as efficiently as C/C++? - Could you build nodejs on top of pure javascript instead of C++? - Is there any such thing as pure javascript? You really have to understand my friend that it is a type system that can take advantage of underlying hardware and makes your program efficient at CPU and memory. Strongly typed C++ can solve any problem, even build node js. Node shines at non-blocking i/o and that is about it, it can not do anything else. Yes you can chop-off node code and make it work on micro devices but will it be efficient and make sense? Can you make product like node where you have to code in C++, yes you can but it would not make sense as power of C/C++ in not in web, its optimizations and hardware. It not like non-blocking I/O is something new, we have had that in many technologies including java, . Net, basic, python and perl, this is very old. The only reason why this thing is in limelight is it has enabled millions of frontend javascript developers, who do not understand pointers and bash about C++, to write server code, which is simply overwhelming, that's why the buzz. And about "Node in particular are actually very well suited to handle distributed computation", why on earth one would write such a statement? Node is not made for computation. it can not compute as efficiently as C/C++/Java. Period. With all due respect, lets not bring C++ in picture here, there is simply no practical comparison at all, or it will be very touchy

Eric Elliott

You may be interested in this. https. //medium. com/javascript-scene/what-is-webassembly-the-dawn-of-a-new-era-61256ec5a8f6

Eric Elliott

You may be interested in this. https. //medium. com/javascript-scene/what-is-webassembly-the-dawn-of-a-new-era-61256ec5a8f6

Ken Kopelson

Actually, Javascript in the V8 server engine is QUITE fast. The statement that Javascript is not fast is outdated. You combine Node with Chrome and you get a very fast environment. If you understand how Node works, it has an event loop that processes all code that is ready to run. So, you call a function that has a blocking database call inside and a callback when finished, it allows the the function to be called, which returns immediately allowing you to get on with other things while the database call is being processed. So you aren't "hurry-up and waiting" as you suppose. You get on with other things, and once the database call finishes, execution will continue to the callback which is invoked after the database call returns. So, you get the same basic abilities as a multi-threaded environment without all the extra overhead incurred by thread-state swapping. Because you don't get "time slicing" you have to be careful that no piece of code takes too long to run, and if it does, you just break it up using packages like "async". I come from a long C, C++, Delphi, Java background, having mastered the multi-threaded paradigm, and I can state assuredly that the Node single-threaded async paradigm is super cool, fast, and highly scalable. IF YOU KNOW WHAT YOU'RE DOING. But that's the same for any of the other technologies as well. None of these technologies are for neophytes

Ken Kopelson

Actually, Javascript in the V8 server engine is QUITE fast. The statement that Javascript is not fast is outdated. You combine Node with Chrome and you get a very fast environment. If you understand how Node works, it has an event loop that processes all code that is ready to run. So, you call a function that has a blocking database call inside and a callback when finished, it allows the the function to be called, which returns immediately allowing you to get on with other things while the database call is being processed. So you aren't "hurry-up and waiting" as you suppose. You get on with other things, and once the database call finishes, execution will continue to the callback which is invoked after the database call returns. So, you get the same basic abilities as a multi-threaded environment without all the extra overhead incurred by thread-state swapping. Because you don't get "time slicing" you have to be careful that no piece of code takes too long to run, and if it does, you just break it up using packages like "async". I come from a long C, C++, Delphi, Java background, having mastered the multi-threaded paradigm, and I can state assuredly that the Node single-threaded async paradigm is super cool, fast, and highly scalable. IF YOU KNOW WHAT YOU'RE DOING. But that's the same for any of the other technologies as well. None of these technologies are for neophytes

M

A complex application is precisely where well tailored Domain objects and properly decoupled subsystems are most necessary. If you are spending all your time trying to get the ORM to work you should either learn that ORM better or get another ORM. I would assume the former goes without saying so if you are still fighting your ORM it's time to choose one that just works

M

A complex application is precisely where well tailored Domain objects and properly decoupled subsystems are most necessary. If you are spending all your time trying to get the ORM to work you should either learn that ORM better or get another ORM. I would assume the former goes without saying so if you are still fighting your ORM it's time to choose one that just works

M

Excepting your last comment that these technologies are not for neophytes, I think you are ignoring the last two paragraphs you were responding to. Even the founder of node. js says to avoid compute intensive operations. Yes, V8 speeds up javascript, but that doesn't solve the problem of a compute intensive operation or IO dependent operations blocking a single thread. You then respond that node. js is non-blocking and therefore it can be awaited. Great, I got that, sure, but what are you waiting on? Some code that isn't written in node. js apparently, (so much for the claimed benefit of "one true language to rule them all"), because your single threaded node. js process is happily moved on to something else until the callback. So, node. js works great just as long as you can rely on other processes handling the workload that is blocking (like waiting for IO), or another instance of single threaded node. js, that will (if written "correctly") undoubtable kick the can down the road to yet another process. And that's the issue. there are a limited subset of stuff done in programs that can be executed in parallel/out of order, and/or doesn't rely on blocking operations. Multi-threading is more complicated and has some overhead every time there is a context switch, but it means that more cores can be thrown at parallelizable units of work, and even discrete operations can be handled by the different threads. Trong một "nút. js solves everything" world, you are either relying on something not written in node. js or waiting for your single threaded node. js application to finish up all the stuff that must be done, one way or another

M

Excepting your last comment that these technologies are not for neophytes, I think you are ignoring the last two paragraphs you were responding to. Even the founder of node. js says to avoid compute intensive operations. Yes, V8 speeds up javascript, but that doesn't solve the problem of a compute intensive operation or IO dependent operations blocking a single thread. You then respond that node. js is non-blocking and therefore it can be awaited. Great, I got that, sure, but what are you waiting on? Some code that isn't written in node. js apparently, (so much for the claimed benefit of "one true language to rule them all"), because your single threaded node. js process is happily moved on to something else until the callback. So, node. js works great just as long as you can rely on other processes handling the workload that is blocking (like waiting for IO), or another instance of single threaded node. js, that will (if written "correctly") undoubtable kick the can down the road to yet another process. And that's the issue. there are a limited subset of stuff done in programs that can be executed in parallel/out of order, and/or doesn't rely on blocking operations. Multi-threading is more complicated and has some overhead every time there is a context switch, but it means that more cores can be thrown at parallelizable units of work, and even discrete operations can be handled by the different threads. Trong một "nút. js solves everything" world, you are either relying on something not written in node. js or waiting for your single threaded node. js application to finish up all the stuff that must be done, one way or another

Ken Kopelson

You know what? You seem to just like spouting on about something you are clearly not qualified to speak about. You obviously have never built anything serious in Node. js. Well, I have, and I can tell you that it works great if you actually program it correctly. That means you use things like job queues, you use the clustering that Node provides, you make sure you do everything with callbacks and promises, you use "async" and "setImmediate" to properly share the processor between code that is waiting and code can now execute, you make sure UI code has priority over CPU intensive code, etc. For example, I wrote an "async" heap sort algorithm that works great, sorting massive lists while not blocking for any appreciable amount of time. I also have a 5000 line heuristic algorithm that is quite complex that I split up so that the main loops are executed using async constructs. I then have these executed from a job queue called "Kue" that allows for efficient use of all cores, no threads, great UI response time, and complex calculation jobs being executed in the background using all available processor power. This is ALL done in javascript with excellent performance in both CPU intensive tasks and response to front-end data requests. In other words mate, the UI is super responsive, and the background processing (complex heuristic calculation) performed quickly and very responsively. This is all done with a single language for both backend and front end, which is a huge deal when it comes to system architecture

Ken Kopelson

You know what? You seem to just like spouting on about something you are clearly not qualified to speak about. You obviously have never built anything serious in Node. js. Well, I have, and I can tell you that it works great if you actually program it correctly. That means you use things like job queues, you use the clustering that Node provides, you make sure you do everything with callbacks and promises, you use "async" and "setImmediate" to properly share the processor between code that is waiting and code can now execute, you make sure UI code has priority over CPU intensive code, etc. For example, I wrote an "async" heap sort algorithm that works great, sorting massive lists while not blocking for any appreciable amount of time. I also have a 5000 line heuristic algorithm that is quite complex that I split up so that the main loops are executed using async constructs. I then have these executed from a job queue called "Kue" that allows for efficient use of all cores, no threads, great UI response time, and complex calculation jobs being executed in the background using all available processor power. This is ALL done in javascript with excellent performance in both CPU intensive tasks and response to front-end data requests. In other words mate, the UI is super responsive, and the background processing (complex heuristic calculation) performed quickly and very responsively. This is all done with a single language for both backend and front end, which is a huge deal when it comes to system architecture

Jacob Ross

Why are they not for "neophytes"? Is it alcoholic?

Jacob Ross

Why are they not for "neophytes"? Is it alcoholic?

Jacob Ross

I agree. Most times that I think an ORM is inadequate for complex queries, I write out raw SQL, later to find out the ORM has an "app for that". I like using an ORM as much as possible, but I won't spend too much time making it work for me, otherwise, as M said, I'll find another ORM

Jacob Ross

I agree. Most times that I think an ORM is inadequate for complex queries, I write out raw SQL, later to find out the ORM has an "app for that". I like using an ORM as much as possible, but I won't spend too much time making it work for me, otherwise, as M said, I'll find another ORM

JF80

Sounds like the words from a "Michael" I know. ;) I agree with your last statement. "each technology has it place". But why do you assume all Node developers are front-end developers with no back-end knowledge? Why is it NOT possible for these developers to make a scalable solution? Like or not Node is being used in Enterprise today and will continue to be adopted

JF80

Sounds like the words from a "Michael" I know. ;) I agree with your last statement. "each technology has it place". But why do you assume all Node developers are front-end developers with no back-end knowledge? Why is it NOT possible for these developers to make a scalable solution? Like or not Node is being used in Enterprise today and will continue to be adopted

TerraT

Javascript is a poor choice of language for enterprise/complex development. It is messy, difficult to read, difficult to organise, doesn't support an entire raft of OO paradigms that save a lot of code repetition and provide readable abstraction, predominantly gives run time errors, no AOP, no by convention, no reflection, no generics/templates, no precision of scope, no rich low level processing, and it is not type safe. We are stuck with it in the browser, and frankly it is only inertia and legacy support that means it is still used there. In all rights it should have gone the way of the dinosaurs 10 years ago. The main driver to move away from scripting languages was that they were a maintenance nightmare and led to ball of mud applications that had constant bugs that couldn't be tracked. It has only been a short 10 years since we breathed a huge sigh of relief when serious development moved off of scripting languages and here we are doing it again unwilling to learn from the past, convinced that this is "new and cutting edge", rather than just old, tired and regurgitated. It will end up the same way as it did last time, being talked about with disgust like classic asp and perl cgi. I can only conclude the developers championing it now were just not around to see the fallout of this last time around. Every new generation of developer is convinced they have discovered "the truth", those of us who have seen this cycle of pain just have to sit back and shake our heads in disbelief. Unfortunately you can't teach experience, it is something you have to learn the hard way. Sure if you are an amateur and know nothing else then by all means, but anyone trying to do a professional job needs to leave this alone and stop making populist technology choices without considering the outcomes. If you can't evaluate the long term limitations of a technology for yourself you shouldn't be working in development. Developers need to stop being so childish, acting like a bunch of deluded fan boys, this is a serious business, not a game

TerraT

Javascript is a poor choice of language for enterprise/complex development. It is messy, difficult to read, difficult to organise, doesn't support an entire raft of OO paradigms that save a lot of code repetition and provide readable abstraction, predominantly gives run time errors, no AOP, no by convention, no reflection, no generics/templates, no precision of scope, no rich low level processing, and it is not type safe. We are stuck with it in the browser, and frankly it is only inertia and legacy support that means it is still used there. In all rights it should have gone the way of the dinosaurs 10 years ago. The main driver to move away from scripting languages was that they were a maintenance nightmare and led to ball of mud applications that had constant bugs that couldn't be tracked. It has only been a short 10 years since we breathed a huge sigh of relief when serious development moved off of scripting languages and here we are doing it again unwilling to learn from the past, convinced that this is "new and cutting edge", rather than just old, tired and regurgitated. It will end up the same way as it did last time, being talked about with disgust like classic asp and perl cgi. I can only conclude the developers championing it now were just not around to see the fallout of this last time around. Every new generation of developer is convinced they have discovered "the truth", those of us who have seen this cycle of pain just have to sit back and shake our heads in disbelief. Unfortunately you can't teach experience, it is something you have to learn the hard way. Sure if you are an amateur and know nothing else then by all means, but anyone trying to do a professional job needs to leave this alone and stop making populist technology choices without considering the outcomes. If you can't evaluate the long term limitations of a technology for yourself you shouldn't be working in development. Developers need to stop being so childish, acting like a bunch of deluded fan boys, this is a serious business, not a game

adroittech

OMG. Eric . Are you for real? Do you even know how Nodejs works? Did you even try to look at backbone of Nodejs? Just download yourself a source-code and checkout. IT IS IN PLAIN C/C++. http_parcer is C++ lib. libuv is another and single most important C++ library in nodejs backbone which makes nodejs async, event driven and non blocking. Bản thân Javascript là một cơ thể không có linh hồn và sự sống. JAVASCRIPT is just a script that you use to script your logic. One day if smeoene ports lua with this libs, he will not need Javascript to code. tương tự cho python, v.v. But the basic fact remains the same. IT IS C++ code that makes what nodejs is, not that javascript is too fast. in fact javascript is slowest in all of the scripting language. So don't flatter yourself in believing that just java-script is great and other things are shit. And do not insult C/C++ if you have no knowledge of it. So, again, i urge you to take back your words. "Hệ thống kiểu Javascript tốt hơn C++". (Javascript has no type system. and if you still believe that it has one, you are in a very wrong field, go build some scaffolding) Also, these companies are not choosing nodejs for the reason you mentioned. This is possible in almost all languages. The reason why companies are choosing nodejs is that, they get ready made javascript coders, which are in millions and can not do c++/java code, to do server side because it is cheaper. Another reason -> its ecosystem. Yet another reason -> Its lot easier to conduct load tests in nodejs than other scripts. The link you mentioned is work that is intended to be started. Why do not you suggest them that please write this web-assembly compiler in nodejs rather than c/c++/assembly because according to you that is superior. C'Mon man, how can you compare Nodejs (A technology) with a C++ (language) they are not in the same league. C++ makes node possible, its not visa versa

adroittech

OMG. Eric . Are you for real? Do you even know how Nodejs works? Did you even try to look at backbone of Nodejs? Just download yourself a source-code and checkout. IT IS IN PLAIN C/C++. http_parcer is C++ lib. libuv is another and single most important C++ library in nodejs backbone which makes nodejs async, event driven and non blocking. Bản thân Javascript là một cơ thể không có linh hồn và sự sống. JAVASCRIPT is just a script that you use to script your logic. One day if smeoene ports lua with this libs, he will not need Javascript to code. tương tự cho python, v.v. But the basic fact remains the same. IT IS C++ code that makes what nodejs is, not that javascript is too fast. in fact javascript is slowest in all of the scripting language. So don't flatter yourself in believing that just java-script is great and other things are shit. And do not insult C/C++ if you have no knowledge of it. So, again, i urge you to take back your words. "Hệ thống kiểu Javascript tốt hơn C++". (Javascript has no type system. and if you still believe that it has one, you are in a very wrong field, go build some scaffolding) Also, these companies are not choosing nodejs for the reason you mentioned. This is possible in almost all languages. The reason why companies are choosing nodejs is that, they get ready made javascript coders, which are in millions and can not do c++/java code, to do server side because it is cheaper. Another reason -> its ecosystem. Yet another reason -> Its lot easier to conduct load tests in nodejs than other scripts. The link you mentioned is work that is intended to be started. Why do not you suggest them that please write this web-assembly compiler in nodejs rather than c/c++/assembly because according to you that is superior. C'Mon man, how can you compare Nodejs (A technology) with a C++ (language) they are not in the same league. C++ makes node possible, its not visa versa

oberona

"The main driver to move away from scripting languages was that they were a maintenance nightmare and led to ball of mud applications" -- could you clarify what you mean by scripting languages, and what replacements "serious developers" migrated to over the past ten years? I was pleased to see a reference to Django in the article and have not run across maintainability issues caused by the use of Python, SQL, or ORMs in general. On the contrary, Python is my go-to language precisely for its maintainability. Your criticisms of js are spot on, but I can't see how they apply across the entire universe of scripting languages

oberona

"The main driver to move away from scripting languages was that they were a maintenance nightmare and led to ball of mud applications" -- could you clarify what you mean by scripting languages, and what replacements "serious developers" migrated to over the past ten years? I was pleased to see a reference to Django in the article and have not run across maintainability issues caused by the use of Python, SQL, or ORMs in general. On the contrary, Python is my go-to language precisely for its maintainability. Your criticisms of js are spot on, but I can't see how they apply across the entire universe of scripting languages

TerraT

Well I define scripting languages as runtime compilation languages, but there is a lot of overlap these days. I prefer the reassurance of compile time verification of at least coding accuracy but that is not the only factor. The depth of invasion into the inner workings of the compiler that tend to be exposed by compiled languages these days allow for a whole range of design constructs and patterns that allow programming to be more "intelligent", I just don't find this level of sophistication in the scripting languages I have used. It is a severe limitation for serious enterprise development. ORMs are an ugly approach to data access on relational databases, but you would probably have to be a database developer to realise why. Data design and Program design have different constraints, ORMs do either an injustice or have to be modified so much that they provide no productivity. There are many issues such as security, isolation, atomic operations that ORMs break, and remember a database is a living system and may require changes in between code releases as a matter of course. ORMs are a blunt tool if you want real performance from your database and want high concurrency without locking. Its a detailed subject I could probably write a book on it, so sorry if this isn't conclusive enough for you. Can't say much about Python other than I have heard good things in general. I'm the other end of the market on . Net, I crucify the open source guys next door in productivity and my defect level is about 1% of theirs. I think you need a large system before it makes significant differences, as you need to invest in framework and substrate to get the main benefits back, its "mass coding" that is the enemy here. When you have over a 100,000 code files you need a higher level of maintainability as it is simply beyond human capability to do it file by file (and certainly beyond maintenance budgets). By making core services that consume code as content you can achieve a high level of quality while keeping everything granular and ensuring release are small and targeted rather than entire system drops. Each to their own, but if you are an IT pro you must have seen the millions of script based systems festering away in businesses because no one can find anything or understand how it works. It's such a common complaint I should think it doesn't need justifying

TerraT

Well I define scripting languages as runtime compilation languages, but there is a lot of overlap these days. I prefer the reassurance of compile time verification of at least coding accuracy but that is not the only factor. The depth of invasion into the inner workings of the compiler that tend to be exposed by compiled languages these days allow for a whole range of design constructs and patterns that allow programming to be more "intelligent", I just don't find this level of sophistication in the scripting languages I have used. It is a severe limitation for serious enterprise development. ORMs are an ugly approach to data access on relational databases, but you would probably have to be a database developer to realise why. Data design and Program design have different constraints, ORMs do either an injustice or have to be modified so much that they provide no productivity. There are many issues such as security, isolation, atomic operations that ORMs break, and remember a database is a living system and may require changes in between code releases as a matter of course. ORMs are a blunt tool if you want real performance from your database and want high concurrency without locking. Its a detailed subject I could probably write a book on it, so sorry if this isn't conclusive enough for you. Can't say much about Python other than I have heard good things in general. I'm the other end of the market on . Net, I crucify the open source guys next door in productivity and my defect level is about 1% of theirs. I think you need a large system before it makes significant differences, as you need to invest in framework and substrate to get the main benefits back, its "mass coding" that is the enemy here. When you have over a 100,000 code files you need a higher level of maintainability as it is simply beyond human capability to do it file by file (and certainly beyond maintenance budgets). By making core services that consume code as content you can achieve a high level of quality while keeping everything granular and ensuring release are small and targeted rather than entire system drops. Each to their own, but if you are an IT pro you must have seen the millions of script based systems festering away in businesses because no one can find anything or understand how it works. It's such a common complaint I should think it doesn't need justifying

TerraT

P. S. I think "serious developers" have migrated to either Java, C# or back to C++ (along with their associated web techs etc). I wasn't really intending to be derogatory but these three probably account for 90% of all commercial development atm. C# wins out on the commercial front for me solely on Microsoft's considerable ongoing investment and new found modernist approach. C++ is not very productive and Java is really starting to look a little dated. Still I work in all three and they get the job done, each have their place

TerraT

P. S. I think "serious developers" have migrated to either Java, C# or back to C++ (along with their associated web techs etc). I wasn't really intending to be derogatory but these three probably account for 90% of all commercial development atm. C# wins out on the commercial front for me solely on Microsoft's considerable ongoing investment and new found modernist approach. C++ is not very productive and Java is really starting to look a little dated. Still I work in all three and they get the job done, each have their place

TerraT

P. P. S. "Python is my go-to language precisely for its maintainability". What do you consider maintainability? It is often not what people think it is (or is not as simple as they think). It encompasses the cost of change and that is the primary cost on the business for a living project. Example. I have a service with 1000 public methods and the business asks me to de-prioritise all calls that take over 2 seconds. If I have to modify any of the code in those 1000 calls then my code has seriously poor maintainability. What I should be making is one code change in my service substrate pipeline. I should not even be modifying the substrate I should be probably writing a statistics module and a de-prioritise module for that substrate loaded in a separate dll that can be loaded dynamically. Now my testing is isolated to just this dll (reverse harness testing) and when ready for release I can add this dll and maybe make one small config change, that's it, no regression testing and no risk to existing code, so no production bugs in the service methods. So many typical code bases would require all 1000 methods to be altered or at least marked for an AOP operation. Enterprise design requires upfront anticipation of future "crazy" business requests. I find with most scripting languages and even with Java that finding insertion angles later on is nearly impossible. Even if I have a complete mare in C# I can emit the code directly into the methods using reflection, I have never seen this level of access on a scripting language and even if it was there it would be dangerous code to emit into runtime compiled operations (because I am literally changing the operations content so I would need to test the result of each). This is just one example I could probably come up with 100s. I'm a technical architect (framework and substrate) so it is my place to "save" my devs from backing themselves into a corner. If I do a good job I can reduce the coding and testing effort to 1% of a "mass coded" system. Có một cấp độ phát triển hoàn toàn khác mà hầu hết các nhà phát triển sẽ không bao giờ nhìn thấy hoặc đánh giá cao, điều này có nghĩa là họ không bao giờ được trang bị để đưa ra lựa chọn công nghệ phù hợp nhất

TerraT

P. P. S. "Python is my go-to language precisely for its maintainability". What do you consider maintainability? It is often not what people think it is (or is not as simple as they think). It encompasses the cost of change and that is the primary cost on the business for a living project. Example. I have a service with 1000 public methods and the business asks me to de-prioritise all calls that take over 2 seconds. If I have to modify any of the code in those 1000 calls then my code has seriously poor maintainability. What I should be making is one code change in my service substrate pipeline. I should not even be modifying the substrate I should be probably writing a statistics module and a de-prioritise module for that substrate loaded in a separate dll that can be loaded dynamically. Now my testing is isolated to just this dll (reverse harness testing) and when ready for release I can add this dll and maybe make one small config change, that's it, no regression testing and no risk to existing code, so no production bugs in the service methods. So many typical code bases would require all 1000 methods to be altered or at least marked for an AOP operation. Enterprise design requires upfront anticipation of future "crazy" business requests. I find with most scripting languages and even with Java that finding insertion angles later on is nearly impossible. Even if I have a complete mare in C# I can emit the code directly into the methods using reflection, I have never seen this level of access on a scripting language and even if it was there it would be dangerous code to emit into runtime compiled operations (because I am literally changing the operations content so I would need to test the result of each). This is just one example I could probably come up with 100s. I'm a technical architect (framework and substrate) so it is my place to "save" my devs from backing themselves into a corner. If I do a good job I can reduce the coding and testing effort to 1% of a "mass coded" system. Có một cấp độ phát triển hoàn toàn khác mà hầu hết các nhà phát triển sẽ không bao giờ nhìn thấy hoặc đánh giá cao, điều này có nghĩa là họ không bao giờ được trang bị để đưa ra lựa chọn công nghệ phù hợp nhất

Josh Morgan

Interesting article, I've got quite a bit of experience in other realms but I'm somewhat new to Node. js. There's a few things I'd like to clear up. Flash was always async as well, it merely emulated threads much like it sounds like node does by using an event queue. However, I believe it is technical ignorance to claim that trusting thread management to a 3rd or 4th generation language would be better than trusting a well-tuned JRE or operating system optimized for it's multi-core chipset. How exactly do you think threads work in the lower levels anyway? It isn't some "magic", the only way to get true simultaneous code execution is via multiple processors, something you simply can't accomplish with a single thread. It's also a mistake to say that a new "event" does not add memory or clock cycles taken to a stack just because said events are managed by an interpreted scripting language rather than optimized, compiled C++. I'd bet my lunch that a well-written multi-threaded web application written in C or C++ will blow away any node. js app performance-wise, and that's even without getting into servers and their current multi-core processor architecture. If you've got a quad or 8-core server running a single node thread. you're only firing on one piston (quite ironic that Google calls their engine "V8" when considering such a fact). Another thing to realize is that while Flash (or even Java applets) ran in their own runtimes, so does node -- it's just hidden to the user. That is nothing more than "good" (perhaps hostile?) business moves on Google's part. Lets be honest here, if all browsers came with Flash automatically installed on them, and Apple actually supported Flash on their mobile devices, node probably wouldn't even exist today. I have other concerns about security. What kind of protection does it have against cross-site scripting and other attacks? Earlier today I stumbled across a TOR/Bittorrent client that ran in my browser window, and after opening it my computer wouldn't shut down nicely (it scares me to think what it could have been seeding. ). No warnings about security or what types of connections my browser window was opening up, just went along with it's P2P business. the hacker side of me could have a real hay day with those kind of "features". I doubt that kind of stuff has been tested much either which means there's a lot of room for bugs, and where there's a lot of room for bugs there's a lot of room for vulnerabilities. But hey, at least your entire stack is all in the same language. Means you can hire less experienced developers for less money, right? ;)

Josh Morgan

Interesting article, I've got quite a bit of experience in other realms but I'm somewhat new to Node. js. There's a few things I'd like to clear up. Flash was always async as well, it merely emulated threads much like it sounds like node does by using an event queue. However, I believe it is technical ignorance to claim that trusting thread management to a 3rd or 4th generation language would be better than trusting a well-tuned JRE or operating system optimized for it's multi-core chipset. How exactly do you think threads work in the lower levels anyway? It isn't some "magic", the only way to get true simultaneous code execution is via multiple processors, something you simply can't accomplish with a single thread. It's also a mistake to say that a new "event" does not add memory or clock cycles taken to a stack just because said events are managed by an interpreted scripting language rather than optimized, compiled C++. I'd bet my lunch that a well-written multi-threaded web application written in C or C++ will blow away any node. js app performance-wise, and that's even without getting into servers and their current multi-core processor architecture. If you've got a quad or 8-core server running a single node thread. you're only firing on one piston (quite ironic that Google calls their engine "V8" when considering such a fact). Another thing to realize is that while Flash (or even Java applets) ran in their own runtimes, so does node -- it's just hidden to the user. That is nothing more than "good" (perhaps hostile?) business moves on Google's part. Lets be honest here, if all browsers came with Flash automatically installed on them, and Apple actually supported Flash on their mobile devices, node probably wouldn't even exist today. I have other concerns about security. What kind of protection does it have against cross-site scripting and other attacks? Earlier today I stumbled across a TOR/Bittorrent client that ran in my browser window, and after opening it my computer wouldn't shut down nicely (it scares me to think what it could have been seeding. ). No warnings about security or what types of connections my browser window was opening up, just went along with it's P2P business. the hacker side of me could have a real hay day with those kind of "features". I doubt that kind of stuff has been tested much either which means there's a lot of room for bugs, and where there's a lot of room for bugs there's a lot of room for vulnerabilities. But hey, at least your entire stack is all in the same language. Means you can hire less experienced developers for less money, right? ;)

iwebworld

Good Article for Node JS, you can learn Node JS online in http. //iwebworld. info or send a email iwebworldinfo@gmail. com

iwebworld

Good Article for Node JS, you can learn Node JS online in http. //iwebworld. info or send a email iwebworldinfo@gmail. com

Avinash Shah

You could remove all the pitfalls of JS by using the its superset aka TypeScript

Avinash Shah

You could remove all the pitfalls of JS by using the its superset aka TypeScript

evanplaice

Tl;dr Use node for IO-heavy processing and delegating CPU-intensive processing to a cluster of specialized worker nodes (ex database, media processing, etc). This isn't exactly new information. I covered this topic back in '12. http. //programmers. stackexchange. com/a/179499/1256 Ideally, the HTTP and API servers should be mostly stateless (excl session management) and disposable. They're just a functional pipeline that translates the raw data into consumable representations. That way, the servers are easy to provision/destroy dynamically to meet the spikey nature of demand. I'm not sure why so many of the commenters are vehemently arguing in favor of multi-purpose vertically-scalable server architectures. By nature, vertical scaling will always have an upper limit predicated by hardware capacity. No matter how efficient the code is. The writing is on the wall. You can spend a fortune on hardware and lose sleep questioning the validity of your risk assessment (aka WAG). At the end of the day, bare metal is a fixed asset. Best case, it meets expected demand and justifies the cost. Worst case, it either costs more than it's worth or lacks the capacity to meet demand. Alternatively, you can embrace distributive computing and automate the infrastructure to grow/contract relative to demand. For the people fighting religious wars over which language is best, node . C#. java. Who cares. All 3 allow 'functional-style' programming. All 3, support async processing (natively or through extensions). All 3 can be managed via provisioning. All 3 are perfectly valid for building distributive infrastructure. Choosing which one to use depends on the quality of the tools, whether or not it will be used to extend existing infrastructure, and the perception of the client. Xây dựng bất cứ thứ gì bạn giỏi xây dựng. If you're really good; build whatever is easiest to implement, support, and generate the most profit (or save the most on cost). BTW, kudos to the author. It's nice to see somebody do a comprehensive (and mostly objective) writeup on this topic

evanplaice

Tl;dr Use node for IO-heavy processing and delegating CPU-intensive processing to a cluster of specialized worker nodes (ex database, media processing, etc). This isn't exactly new information. I covered this topic back in '12. http. //programmers. stackexchange. com/a/179499/1256 Ideally, the HTTP and API servers should be mostly stateless (excl session management) and disposable. They're just a functional pipeline that translates the raw data into consumable representations. That way, the servers are easy to provision/destroy dynamically to meet the spikey nature of demand. I'm not sure why so many of the commenters are vehemently arguing in favor of multi-purpose vertically-scalable server architectures. By nature, vertical scaling will always have an upper limit predicated by hardware capacity. No matter how efficient the code is. The writing is on the wall. You can spend a fortune on hardware and lose sleep questioning the validity of your risk assessment (aka WAG). At the end of the day, bare metal is a fixed asset. Best case, it meets expected demand and justifies the cost. Worst case, it either costs more than it's worth or lacks the capacity to meet demand. Alternatively, you can embrace distributive computing and automate the infrastructure to grow/contract relative to demand. For the people fighting religious wars over which language is best, node . C#. java. Who cares. All 3 allow 'functional-style' programming. All 3, support async processing (natively or through extensions). All 3 can be managed via provisioning. All 3 are perfectly valid for building distributive infrastructure. Choosing which one to use depends on the quality of the tools, whether or not it will be used to extend existing infrastructure, and the perception of the client. Xây dựng bất cứ thứ gì bạn giỏi xây dựng. If you're really good; build whatever is easiest to implement, support, and generate the most profit (or save the most on cost). BTW, kudos to the author. It's nice to see somebody do a comprehensive (and mostly objective) writeup on this topic

evanplaice

Yes, both languages support horizontal scaling with asynchronous message management infrastructure. CQRS is nothing but an API implementation pattern. CRUD is the typical use case (as it should be) but Node doesn't automagically scaffold 1. 1 mappings between DB and CRUD (see rails/laravel/django for that). Node isn't a framework at all, it's just a HTTP server. You can leverage frameworks (ex Express) to make life easier by providing sane defaults and better structure but you still have to manually specify your API routes. . Net Reactive Extensions have been ported to JS. https. //www. npmjs. com/package/rx In fact, even LINQ has been ported to JS (yes, seriously). http. //linqjs. codeplex. com/ "Any application that can be written in Javascript, will be written in Javascript" - Atwood's Law ORMs are only an issue because they require an additional layer of abstraction from the underlying data. If (read when) the data models need to change to adapt to business demands, both the ORM and the database schema will need to be updated and tested to reflect the changes. Which is not really a big deal if there's a good update strategy in place. As for the rest of your comment, you'd do well if you stepped out of your comfort zone once in a while to see how JS development really works. 1. JS classes are currently supported now via ES6 (also, available client-side via polyfills). Prototypes really aren't much different than classes in terms of encapsulation (except they're a lot more flexible). Compile-time static type checking is even supported via TypeScript/Dart if that's what floats your boat, it's just not the default. 2. TDD/BDD isn't a feature exclusive to statically typed languages. There are a lot of great testing frameworks available in JS (both server/client-side). Choose your flavor, unit testing (Mocha), behavior driven unit testing (Chai), api testing (SuperTest), and continuous integration testing (TravisCI, and many others) are all used extensively throughout the community. JSUnit (the JS equivalent of JUnit/NUnit) is even available if you miss unit testing in Java/. NET. If anything, testing is a basic requirement of any non-trivial JS app that goes into production because you don't have a compile-time type checker to hold your hand. 3. Complex workflow? Seriously? So, you've never heard of NPM scripting, grunt, gulp? Automating any-and-everything in JS is pretty easy. Style enforcement, linting, documentation generation, scaffolding, one-click-deployment, language transpilation, bundling, distribution building, package/dependency management, release management, etc. 4. . cringe. nếu bạn chỉ dựa vào hệ thống kiểm tra kiểu tĩnh thời gian biên dịch để xác thực đầu vào của người dùng, thì bạn đang làm sai. Building a data layer in any language requires constraints above-and-beyond what the default types provide. So, either way you'll have to extend your data models with custom validation checks. The cool part about handling validation in JS is you can use the same routines to check user input on both the client/server-side. Less duplication of effort FTW. Contrary to what you think. Javascript thực sự là cách tiếp cận 'một kích thước phù hợp với tất cả' nếu bạn thích sử dụng nó như vậy. Nghiêm túc mà nói, bạn thậm chí có thể biên dịch C/C++ trực tiếp sang javascript bằng cách sử dụng asm. js. Điều đó có nghĩa là bạn phải sử dụng nó? . Bất kỳ nhà phát triển nào có một chút ý thức sẽ không có lỗi với bạn khi chọn C #, đó là một ngôn ngữ tuyệt vời. Tôi có kinh nghiệm viết mã bằng nhiều ngôn ngữ, bao gồm xây dựng các ứng dụng máy tính để bàn không tầm thường bằng C#. Được lựa chọn, tôi muốn sử dụng Javascript hơn. Sự pha trộn của các ràng buộc lỏng lẻo hơn và các phong cách chức năng/mệnh lệnh/nguyên mẫu cho phép mức độ sáng tạo mà tôi chưa từng trải nghiệm trong bất kỳ ngôn ngữ nào khác. The tools are great, the module system is amazing, and the language itself is getting substantially better with each update

evanplaice

Yes, both languages support horizontal scaling with asynchronous message management infrastructure. CQRS is nothing but an API implementation pattern. CRUD is the typical use case (as it should be) but Node doesn't automagically scaffold 1. 1 mappings between DB and CRUD (see rails/laravel/django for that). Node isn't a framework at all, it's just a HTTP server. You can leverage frameworks (ex Express) to make life easier by providing sane defaults and better structure but you still have to manually specify your API routes. . Net Reactive Extensions have been ported to JS. https. //www. npmjs. com/package/rx In fact, even LINQ has been ported to JS (yes, seriously). http. //linqjs. codeplex. com/ "Any application that can be written in Javascript, will be written in Javascript" - Atwood's Law ORMs are only an issue because they require an additional layer of abstraction from the underlying data. If (read when) the data models need to change to adapt to business demands, both the ORM and the database schema will need to be updated and tested to reflect the changes. Which is not really a big deal if there's a good update strategy in place. As for the rest of your comment, you'd do well if you stepped out of your comfort zone once in a while to see how JS development really works. 1. JS classes are currently supported now via ES6 (also, available client-side via polyfills). Prototypes really aren't much different than classes in terms of encapsulation (except they're a lot more flexible). Compile-time static type checking is even supported via TypeScript/Dart if that's what floats your boat, it's just not the default. 2. TDD/BDD isn't a feature exclusive to statically typed languages. There are a lot of great testing frameworks available in JS (both server/client-side). Choose your flavor, unit testing (Mocha), behavior driven unit testing (Chai), api testing (SuperTest), and continuous integration testing (TravisCI, and many others) are all used extensively throughout the community. JSUnit (the JS equivalent of JUnit/NUnit) is even available if you miss unit testing in Java/. NET. If anything, testing is a basic requirement of any non-trivial JS app that goes into production because you don't have a compile-time type checker to hold your hand. 3. Complex workflow? Seriously? So, you've never heard of NPM scripting, grunt, gulp? Automating any-and-everything in JS is pretty easy. Style enforcement, linting, documentation generation, scaffolding, one-click-deployment, language transpilation, bundling, distribution building, package/dependency management, release management, etc. 4. . cringe. nếu bạn chỉ dựa vào hệ thống kiểm tra kiểu tĩnh thời gian biên dịch để xác thực đầu vào của người dùng, thì bạn đang làm sai. Building a data layer in any language requires constraints above-and-beyond what the default types provide. So, either way you'll have to extend your data models with custom validation checks. The cool part about handling validation in JS is you can use the same routines to check user input on both the client/server-side. Less duplication of effort FTW. Contrary to what you think. Javascript thực sự là cách tiếp cận 'một kích thước phù hợp với tất cả' nếu bạn thích sử dụng nó như vậy. Nghiêm túc mà nói, bạn thậm chí có thể biên dịch C/C++ trực tiếp sang javascript bằng cách sử dụng asm. js. Điều đó có nghĩa là bạn phải sử dụng nó? . Bất kỳ nhà phát triển nào có một chút ý thức sẽ không có lỗi với bạn khi chọn C #, đó là một ngôn ngữ tuyệt vời. Tôi có kinh nghiệm viết mã bằng nhiều ngôn ngữ, bao gồm xây dựng các ứng dụng máy tính để bàn không tầm thường bằng C#. Được lựa chọn, tôi muốn sử dụng Javascript hơn. Sự pha trộn của các ràng buộc lỏng lẻo hơn và các phong cách chức năng/mệnh lệnh/nguyên mẫu cho phép mức độ sáng tạo mà tôi chưa từng trải nghiệm trong bất kỳ ngôn ngữ nào khác. The tools are great, the module system is amazing, and the language itself is getting substantially better with each update

evanplaice

Tải tệp lên. http. //howtonode. org/really-simple-file-uploads "Tất cả các hoạt động I/O được xử lý bởi Node. js đang sử dụng nhiều luồng nội bộ; . " http. // stackoverflow. com/a/22981768/290340 Libuv sử dụng nhóm luồng để xử lý các hoạt động I/O (tệp, ổ cắm, v.v.) theo cách không đồng bộ. Trong đó hầu hết các ngôn ngữ bị chặn theo mặc định trong các hoạt động I/O nặng của CPU, thì Node không. Nó chỉ kích hoạt một sự kiện khi thao tác I/O hoàn thành trên worker thread. Thư mục hoạt động. https. //github. com/gheeres/node-activedirectory https. //github. com/auth0/hộ chiếu-windowsauth

evanplaice

Tải tệp lên. http. //howtonode. org/really-simple-file-uploads "Tất cả các hoạt động I/O được xử lý bởi Node. js đang sử dụng nhiều luồng nội bộ; . " http. // stackoverflow. com/a/22981768/290340 Libuv sử dụng nhóm luồng để xử lý các hoạt động I/O (tệp, ổ cắm, v.v.) theo cách không đồng bộ. Trong đó hầu hết các ngôn ngữ bị chặn theo mặc định trong các hoạt động I/O nặng của CPU, thì Node không. Nó chỉ kích hoạt một sự kiện khi thao tác I/O hoàn thành trên worker thread. Thư mục hoạt động. https. //github. com/gheeres/node-activedirectory https. //github. com/auth0/hộ chiếu-windowsauth

evanplaice

Điểm khác biệt là Node mặc định là không đồng bộ Vì vậy, số lượng nhà phát triển thực hiện lập trình không đồng bộ bằng các ngôn ngữ khác là thiểu số nên họ không được đại diện nhiều. "Tôi không thể đưa ra bất kỳ lý do chính đáng nào để sử dụng nó ở phía máy chủ có lợi cho các ngôn ngữ có sẵn khác. " Không nói dối đâu, lúc đầu sử dụng Node là. Thách thức để nói ít nhất. Làm quen với async-by-default không phải là một quá trình chuyển đổi dễ dàng. Phần hay của Node là, trọng tâm chính của nền tảng là xây dựng máy chủ/máy khách để hệ sinh thái có rất nhiều công cụ mạnh mẽ để làm bất cứ điều gì liên quan đến phát triển web. ". có thư viện, công cụ và tài nguyên tiêu chuẩn tốt hơn. "Tôi không chắc điều gì đã cho bạn ấn tượng đó. Nó không sử dụng cách tiếp cận thư viện lớp cơ sở nguyên khối-mọi thứ và nhà bếp. Bản thân lõi rất nhỏ nhưng đó là một lợi ích vì nó nhẹ hơn nhiều khi triển khai. Nó cũng bao gồm một trình quản lý gói rất mạnh mẽ, đầy đủ tính năng theo mặc định, do đó bạn sẽ phải thêm các phụ thuộc mà dự án của bạn cần. NPM (Trình quản lý gói nút) có hơn 200 nghìn gói và đang tiếp tục tăng. Vì phần lớn các mô-đun được phát triển độc lập với lõi, chúng lặp lại và cải thiện nhanh hơn nhiều so với các thư viện lõi tương đương trong các ngôn ngữ khác. Các phụ thuộc được quản lý cục bộ trên cơ sở từng dự án trong gói. tập tin json. Thông thường, việc tác giả mô-đun yêu cầu gói của họ phải được cài đặt trên toàn cầu là một hình thức tồi. Việc cài đặt các gói cục bộ sẽ ngăn xung đột phiên bản ở cấp độ toàn cầu và đảm bảo rằng -- khi bạn cài đặt một gói -- mọi thứ cần thiết để sử dụng mô-đun đều được bao gồm. Thoạt nhìn, nó có vẻ không hiệu quả vì nhiều phụ thuộc có thể có các bản sao của cùng một phụ thuộc phụ (hoặc phụ thuộc, v.v.) nhưng so với chi phí bao gồm một thư viện tiêu chuẩn đồ sộ, không gian lưu trữ là không đáng kể. Quy trình làm việc để thiết lập một dự án là. - sao chép nguồn - chạy 'npm install' NPM sẽ tự động tải xuống và cài đặt tất cả các phụ thuộc (bao gồm sub-deps, sub-sub-deps, v.v.). Vì các phụ thuộc (và các phiên bản cụ thể của chúng) được xác định rõ ràng trong cấu hình, nên bạn không cần kiểm tra chúng trong kiểm soát nguồn. Ngoài ra, với ES6 (bao gồm trình tải mô-đun ES6 mới) sắp được phát hành, một JSPM mới (Trình quản lý gói JavaScript) đã được tạo để quản lý các phụ thuộc javascript phía máy khách. Nhập mô-đun trong trình duyệt cuối cùng đã được chính thức hóa trong thông số ngôn ngữ, vì vậy Bower và nhiều tiêu chuẩn giả tải mô-đun (ví dụ: AMD, CommonJS, UMD) sẽ biến mất

evanplaice

Điểm khác biệt là Node mặc định là không đồng bộ Vì vậy, số lượng nhà phát triển thực hiện lập trình không đồng bộ bằng các ngôn ngữ khác là thiểu số nên họ không được đại diện nhiều. "Tôi không thể đưa ra bất kỳ lý do chính đáng nào để sử dụng nó ở phía máy chủ có lợi cho các ngôn ngữ có sẵn khác. " Không nói dối đâu, lúc đầu sử dụng Node là. Thách thức để nói ít nhất. Làm quen với async-by-default không phải là một quá trình chuyển đổi dễ dàng. Phần hay của Node là, trọng tâm chính của nền tảng là xây dựng máy chủ/máy khách để hệ sinh thái có rất nhiều công cụ mạnh mẽ để làm bất cứ điều gì liên quan đến phát triển web. ". có thư viện, công cụ và tài nguyên tiêu chuẩn tốt hơn. "Tôi không chắc điều gì đã cho bạn ấn tượng đó. Nó không sử dụng cách tiếp cận thư viện lớp cơ sở nguyên khối-mọi thứ và nhà bếp. Bản thân lõi rất nhỏ nhưng đó là một lợi ích vì nó nhẹ hơn nhiều khi triển khai. Nó cũng bao gồm một trình quản lý gói rất mạnh mẽ, đầy đủ tính năng theo mặc định, do đó bạn sẽ phải thêm các phụ thuộc mà dự án của bạn cần. NPM (Trình quản lý gói nút) có hơn 200 nghìn gói và đang tiếp tục tăng. Vì phần lớn các mô-đun được phát triển độc lập với lõi, chúng lặp lại và cải thiện nhanh hơn nhiều so với các thư viện lõi tương đương trong các ngôn ngữ khác. Các phụ thuộc được quản lý cục bộ trên cơ sở từng dự án trong gói. tập tin json. Thông thường, việc tác giả mô-đun yêu cầu gói của họ phải được cài đặt trên toàn cầu là một hình thức tồi. Việc cài đặt các gói cục bộ sẽ ngăn xung đột phiên bản ở cấp độ toàn cầu và đảm bảo rằng -- khi bạn cài đặt một gói -- mọi thứ cần thiết để sử dụng mô-đun đều được bao gồm. Thoạt nhìn, nó có vẻ không hiệu quả vì nhiều phụ thuộc có thể có các bản sao của cùng một phụ thuộc phụ (hoặc phụ thuộc, v.v.) nhưng so với chi phí bao gồm một thư viện tiêu chuẩn đồ sộ, không gian lưu trữ là không đáng kể. Quy trình làm việc để thiết lập một dự án là. - sao chép nguồn - chạy 'npm install' NPM sẽ tự động tải xuống và cài đặt tất cả các phụ thuộc (bao gồm sub-deps, sub-sub-deps, v.v.). Vì các phụ thuộc (và các phiên bản cụ thể của chúng) được xác định rõ ràng trong cấu hình, nên bạn không cần kiểm tra chúng trong kiểm soát nguồn. Ngoài ra, với ES6 (bao gồm trình tải mô-đun ES6 mới) sắp được phát hành, một JSPM mới (Trình quản lý gói JavaScript) đã được tạo để quản lý các phụ thuộc javascript phía máy khách. Nhập mô-đun trong trình duyệt cuối cùng đã được chính thức hóa trong thông số ngôn ngữ, vì vậy Bower và nhiều tiêu chuẩn giả tải mô-đun (ví dụ: AMD, CommonJS, UMD) sẽ biến mất

TerraT

Như đã nói ở trên, các ngôn ngữ OO hiện đại có rất nhiều tùy chọn để chính thức hóa và kiểm soát mã của bạn cũng như các giải pháp mà các ngôn ngữ kịch bản không có. Đó chỉ là sự thật đơn giản, không có sự kìm kẹp nào có thể thay đổi được điều đó. Quan điểm của tôi là có rất nhiều nhà phát triển chọn công nghệ theo mức độ phổ biến hơn là sự phù hợp, đó là điều khiến họ hâm mộ các chàng trai. Công cụ phù hợp cho công việc phù hợp, áp dụng trong mọi giao dịch ngoại trừ phát triển phần mềm. Nhưng đó có lẽ là do hầu hết các nhà phát triển không phải là "Người thợ" thực thụ, mà là "Người tự làm" được tôn vinh hơn. Ngành công nghiệp đầy những người nghiệp dư, những người thậm chí không biết đủ để biết rằng họ không biết gì. Họ nghĩ bởi vì họ có thể viết câu lệnh if và vòng lặp while nên họ giỏi. công nghệ

TerraT

Như đã nói ở trên, các ngôn ngữ OO hiện đại có rất nhiều tùy chọn để chính thức hóa và kiểm soát mã của bạn cũng như các giải pháp mà các ngôn ngữ kịch bản không có. Đó chỉ là sự thật đơn giản, không có sự kìm kẹp nào có thể thay đổi được điều đó. Quan điểm của tôi là có rất nhiều nhà phát triển chọn công nghệ theo mức độ phổ biến hơn là sự phù hợp, đó là điều khiến họ hâm mộ các chàng trai. Công cụ phù hợp cho công việc phù hợp, áp dụng trong mọi giao dịch ngoại trừ phát triển phần mềm. Nhưng đó có lẽ là do hầu hết các nhà phát triển không phải là "Người thợ" thực thụ, mà là "Người tự làm" được tôn vinh hơn. Ngành công nghiệp đầy những người nghiệp dư, những người thậm chí không biết đủ để biết rằng họ không biết gì. Họ nghĩ bởi vì họ có thể viết câu lệnh if và vòng lặp while nên họ giỏi. công nghệ

evanplaice

Các hoạt động I/O cấp hệ thống (chẳng hạn như tệp, ổ cắm) trong Nút được xử lý bởi libuv sử dụng nhóm luồng nền. Sự khác biệt là, luồng chính có thể kích hoạt và quên nhiệm vụ đối với luồng nền và luồng nền sẽ thông báo cho luồng chính (thông qua kích hoạt một sự kiện) khi thao tác hoàn tất. Ngay cả khi xử lý luồng nền, thực hiện nhiều thao tác I/O cũng không mở rộng tốt. Đối với các tác vụ sử dụng nhiều CPU trong thời gian dài (mã hóa hình ảnh/phim cũ), việc giảm tải các tác vụ cho các nút worker vẫn được ưu tiên hơn. Trong hầu hết các ngôn ngữ, các thao tác I/O được xử lý theo cách đồng bộ, vì vậy nếu chúng yêu cầu được thực hiện trên luồng chính, chúng sẽ chặn thực thi cho đến khi hoàn thành. Lý do bạn không thấy một khoảng dừng đáng chú ý trong giao diện người dùng khi điều này xảy ra là do giao diện người dùng không đồng bộ/dựa trên sự kiện và chạy trên một chuỗi tách biệt với ngữ cảnh chính

evanplaice

Các hoạt động I/O cấp hệ thống (chẳng hạn như tệp, ổ cắm) trong Nút được xử lý bởi libuv sử dụng nhóm luồng nền. Sự khác biệt là, luồng chính có thể kích hoạt và quên nhiệm vụ đối với luồng nền và luồng nền sẽ thông báo cho luồng chính (thông qua kích hoạt một sự kiện) khi thao tác hoàn tất. Ngay cả khi xử lý luồng nền, thực hiện nhiều thao tác I/O cũng không mở rộng tốt. Đối với các tác vụ sử dụng nhiều CPU trong thời gian dài (mã hóa hình ảnh/phim cũ), việc giảm tải các tác vụ cho các nút worker vẫn được ưu tiên hơn. Trong hầu hết các ngôn ngữ, các thao tác I/O được xử lý theo cách đồng bộ, vì vậy nếu chúng yêu cầu được thực hiện trên luồng chính, chúng sẽ chặn thực thi cho đến khi hoàn thành. Lý do bạn không thấy một khoảng dừng đáng chú ý trong giao diện người dùng khi điều này xảy ra là do giao diện người dùng không đồng bộ/dựa trên sự kiện và chạy trên một chuỗi tách biệt với ngữ cảnh chính

evanplaice

Không có gì ngăn cản bạn hiển thị API dưới dạng microservice. WebKit chỉ cho phép bạn chạy ứng dụng khách JS gốc. Tôi có thể sai nhưng theo những gì tôi hiểu, không giống như trình duyệt, ứng dụng khách webkit không được hộp cát nghiêm ngặt để bạn có thể thực hiện các cuộc gọi hệ thống (ví dụ: mở/lưu tệp mà không cần người dùng nhập)

evanplaice

Không có gì ngăn cản bạn hiển thị API dưới dạng microservice. WebKit chỉ cho phép bạn chạy ứng dụng khách JS gốc. Tôi có thể sai nhưng theo những gì tôi hiểu, không giống như trình duyệt, ứng dụng khách webkit không được hộp cát nghiêm ngặt để bạn có thể thực hiện các cuộc gọi hệ thống (ví dụ: mở/lưu tệp mà không cần người dùng nhập)

TerraT

Tôi nghĩ rằng bạn đã đưa ra quan điểm của mình cho tôi, nói ra những điều vô nghĩa thiếu suy nghĩ, vô nghĩa về cảm xúc, với rất ít sự thật, từ một tâm trí quá cuồng tín về một thứ mà nó thậm chí không thể nhìn thấy những thất bại của nó. Có vẻ như bạn đã đưa ra một vài giả định hợp lý về những gì tôi biết và không biết, tôi đã làm Javascript được 20 năm, tôi biết những hạn chế của nó, tôi có thể làm việc hiệu quả với hơn 30 ngôn ngữ, tôi sử dụng những gì phù hợp, . Bạn cần trưởng thành hoặc tìm một ngành mới để làm việc. Những người như bạn là vấn đề với Phát triển phần mềm, không biết gì về những người thậm chí không thể tạo ra một trường hợp cho một công nghệ, chứ đừng nói đến việc sử dụng một công nghệ. Vui lòng tránh xa bàn phím và giúp đỡ phần còn lại của chúng tôi

TerraT

Tôi nghĩ rằng bạn đã đưa ra quan điểm của mình cho tôi, nói ra những điều vô nghĩa thiếu suy nghĩ, vô nghĩa về cảm xúc, với rất ít sự thật, từ một tâm trí quá cuồng tín về một thứ mà nó thậm chí không thể nhìn thấy những thất bại của nó. Có vẻ như bạn đã đưa ra một vài giả định hợp lý về những gì tôi biết và không biết, tôi đã làm Javascript được 20 năm, tôi biết những hạn chế của nó, tôi có thể làm việc hiệu quả với hơn 30 ngôn ngữ, tôi sử dụng những gì phù hợp, . Bạn cần trưởng thành hoặc tìm một ngành mới để làm việc. Những người như bạn là vấn đề với Phát triển phần mềm, không biết gì về những người thậm chí không thể tạo ra một trường hợp cho một công nghệ, chứ đừng nói đến việc sử dụng một công nghệ. Vui lòng tránh xa bàn phím và giúp đỡ phần còn lại của chúng tôi

evanplaice

Bạn có sử dụng kiểm soát phiên bản với quy trình làm việc tiêu chuẩn (quy trình làm việc Gitflow cũ) nơi các nhà phát triển thực hiện các thay đổi trên các nhánh tính năng và mã được xem xét ngang hàng trước khi được hợp nhất không? . Tất cả các ví dụ có sẵn trực tuyến đều bị hỏng khá nhiều nên tôi đã theo dõi quá trình phát triển dự án trên Github. Tỷ lệ mà các nhà phát triển cốt lõi đang đạt được trên cơ sở mã thực sự đáng chú ý. Điều tuyệt vời hơn nữa là mọi PR đều được kiểm tra đơn vị và kiểm tra tích hợp liên tục đủ tốt để mọi bản phát hành được đảm bảo hoạt động đầy đủ (theo như họ đã triển khai cho đến nay)

evanplaice

Bạn có sử dụng kiểm soát phiên bản với quy trình làm việc tiêu chuẩn (quy trình làm việc Gitflow cũ) nơi các nhà phát triển thực hiện các thay đổi trên các nhánh tính năng và mã được xem xét ngang hàng trước khi được hợp nhất không? . Tất cả các ví dụ có sẵn trực tuyến đều bị hỏng khá nhiều nên tôi đã theo dõi quá trình phát triển dự án trên Github. Tỷ lệ mà các nhà phát triển cốt lõi đang đạt được trên cơ sở mã thực sự đáng chú ý. Điều tuyệt vời hơn nữa là mọi PR đều được kiểm tra đơn vị và kiểm tra tích hợp liên tục đủ tốt để mọi bản phát hành được đảm bảo hoạt động đầy đủ (theo như họ đã triển khai cho đến nay)

evanplaice

Làm theo những gì Tracker1 đang nói. Linting tương đương với việc kiểm tra thời gian biên dịch trong JS. Tôi thậm chí còn sử dụng tiện ích mở rộng Sublime hiển thị lỗi kẻ nói dối trực tiếp trong trình soạn thảo khi tôi đang viết mã. Nếu bạn muốn kiểm tra chặt chẽ hơn, bạn có thể thêm trình kiểm tra kiểu, chẳng hạn như 'bán tiêu chuẩn', đảm bảo kiểu mã trên cơ sở toàn dự án. Điều đó có nghĩa là dấu cách không phải tab, thụt lề 2 dấu cách, hàm nhất quán, dấu ngoặc nhọn, v.v. Kiểm tra kiểu tốt cho các lỗi bề ngoài (biến chưa khởi tạo cũ, nhánh chết, giá trị không hợp lệ) nhưng cuối cùng bạn sẽ phải xác minh mã không có lỗi logic thông qua kiểm tra đơn vị, kiểm tra tích hợp liên tục, kiểm tra api

evanplaice

Làm theo những gì Tracker1 đang nói. Linting tương đương với việc kiểm tra thời gian biên dịch trong JS. Tôi thậm chí còn sử dụng tiện ích mở rộng Sublime hiển thị lỗi kẻ nói dối trực tiếp trong trình soạn thảo khi tôi đang viết mã. Nếu bạn muốn kiểm tra chặt chẽ hơn, bạn có thể thêm trình kiểm tra kiểu, chẳng hạn như 'bán tiêu chuẩn', đảm bảo kiểu mã trên cơ sở toàn dự án. Điều đó có nghĩa là dấu cách không phải tab, thụt lề 2 dấu cách, hàm nhất quán, dấu ngoặc nhọn, v.v. Kiểm tra kiểu tốt cho các lỗi bề ngoài (biến chưa khởi tạo cũ, nhánh chết, giá trị không hợp lệ) nhưng cuối cùng bạn sẽ phải xác minh mã không có lỗi logic thông qua kiểm tra đơn vị, kiểm tra tích hợp liên tục, kiểm tra api

evanplaice

Nút sử dụng I/O dựa trên sự kiện không đồng bộ thông qua libuv (bao gồm một nhóm luồng dành riêng cho các yêu cầu I/O). Luồng chính hoàn toàn không bị chặn trong quá trình hoạt động I/O. Nó hoạt động giống như cách cụm ngoại trừ nó được tích hợp vào Node. Kiểm tra một trong những bài thuyết trình trên libuv để biết thêm chi tiết

evanplaice

Nút sử dụng I/O dựa trên sự kiện không đồng bộ thông qua libuv (bao gồm một nhóm luồng dành riêng cho các yêu cầu I/O). Luồng chính hoàn toàn không bị chặn trong quá trình hoạt động I/O. Nó hoạt động giống như cách cụm ngoại trừ nó được tích hợp vào Node. Kiểm tra một trong những bài thuyết trình trên libuv để biết thêm chi tiết

evanplaice

Hiệu suất khôn ngoan, PayPal dường như nghĩ những điều tốt về Node http. //đồng ghi chú. blogspot. com/2013/12/paypals-node js-vs-java-benchmark. html Để bảo mật, mô-đun 'cors' có thể cắm vào Express và có thể được sử dụng cho tất cả các nội dung kiểm soát CORS thông thường. Mô-đun 'mũ bảo hiểm' -- cũng có thể cắm vào Express -- hiển thị một bộ tính năng nhỏ để bảo vệ chống lại những người dùng độc hại bao gồm bảo vệ tập lệnh chéo trang bổ sung. Tôi không chắc mình có gọi một nhà phát triển Fullstack JS là 'thiếu kinh nghiệm' hay không. Có một sự hiểu biết vững chắc về nhiều lĩnh vực trong một hệ sinh thái phát triển không ngừng phát triển thật khó chịu. bạn biết đấy, "10 năm kinh nghiệm so với 1 năm kinh nghiệm 10 lần"

evanplaice

Hiệu suất khôn ngoan, PayPal dường như nghĩ những điều tốt về Node http. //đồng ghi chú. blogspot. com/2013/12/paypals-node js-vs-java-benchmark. html Để bảo mật, mô-đun 'cors' có thể cắm vào Express và có thể được sử dụng cho tất cả các nội dung kiểm soát CORS thông thường. Mô-đun 'mũ bảo hiểm' -- cũng có thể cắm vào Express -- hiển thị một bộ tính năng nhỏ để bảo vệ chống lại những người dùng độc hại bao gồm bảo vệ tập lệnh chéo trang bổ sung. Tôi không chắc mình có gọi một nhà phát triển Fullstack JS là 'thiếu kinh nghiệm' hay không. Có một sự hiểu biết vững chắc về nhiều lĩnh vực trong một hệ sinh thái phát triển không ngừng phát triển thật khó chịu. bạn biết đấy, "10 năm kinh nghiệm so với 1 năm kinh nghiệm 10 lần"

Josh Morgan

Nút. js thậm chí đã không tồn tại được 10 năm (thật buồn cười khi tôi đã thấy các bài đăng công việc thực sự yêu cầu 10 năm kinh nghiệm với nó). Tôi hiểu rằng việc theo kịp sự phát triển của công nghệ là một thách thức và sau 20 năm nữa, tôi có thể nói với bạn rằng vào thời điểm bạn hoàn toàn cảm thấy thoải mái với bất kỳ "full stack" nào thì nó sẽ ít liên quan hơn vì công nghệ luôn phát triển. Sẽ không có gì thay đổi được điều đó, đó chỉ là cách mọi thứ vận hành. Tuy nhiên, bạn không thể thực sự có bánh của bạn và ăn nó ở đó. Công nghệ mới ít được thử nghiệm hơn và do đó kém an toàn hơn, nhưng công nghệ cũ hơn không có nhiều tính năng. Luôn luôn có một sự đánh đổi ở đó. Bất cứ ai tuyên bố khác đang bán cho bạn thứ gì đó

Josh Morgan

Nút. js thậm chí đã không tồn tại được 10 năm (thật buồn cười khi tôi đã thấy các bài đăng công việc thực sự yêu cầu 10 năm kinh nghiệm với nó). Tôi hiểu rằng việc theo kịp sự phát triển của công nghệ là một thách thức và sau 20 năm nữa, tôi có thể nói với bạn rằng vào thời điểm bạn hoàn toàn cảm thấy thoải mái với bất kỳ "full stack" nào thì nó sẽ ít liên quan hơn vì công nghệ luôn phát triển. Sẽ không có gì thay đổi được điều đó, đó chỉ là cách mọi thứ vận hành. Tuy nhiên, bạn không thể thực sự có bánh của bạn và ăn nó ở đó. Công nghệ mới ít được thử nghiệm hơn và do đó kém an toàn hơn, nhưng công nghệ cũ hơn không có nhiều tính năng. Luôn luôn có một sự đánh đổi ở đó. Bất cứ ai tuyên bố khác đang bán cho bạn thứ gì đó

Anil Verma

Tôi được bán trên Node. JS (nếu ứng dụng của bạn đang xây dựng các ứng dụng mạng có khả năng mở rộng cao), Node. JS là con đường để đi vào năm 2015. Không có thắc mắc tại sao rất nhiều công ty mới thành lập và các tập đoàn lớn đang áp dụng nó. C ++, Java, Ruby và Python có vị trí của chúng trong các lĩnh vực tương ứng. Các công ty và sản phẩm mới sẽ được xây dựng trên nhiều ngôn ngữ. Tôi dự đoán việc áp dụng ROR sẽ vẫn cao trong những năm tới để xây dựng các ứng dụng web (đơn giản vì các nhà phát triển ROR dễ dàng có sẵn và thời gian đưa ra thị trường quá ngắn). Bài báo xuất sắc mặc dù Tomislav

Anil Verma

Tôi được bán trên Node. JS (nếu ứng dụng của bạn đang xây dựng các ứng dụng mạng có khả năng mở rộng cao), Node. JS là con đường để đi vào năm 2015. Không có thắc mắc tại sao rất nhiều công ty mới thành lập và các tập đoàn lớn đang áp dụng nó. C ++, Java, Ruby và Python có vị trí của chúng trong các lĩnh vực tương ứng. Các công ty và sản phẩm mới sẽ được xây dựng trên nhiều ngôn ngữ. Tôi dự đoán việc áp dụng ROR sẽ vẫn cao trong những năm tới để xây dựng các ứng dụng web (đơn giản vì các nhà phát triển ROR dễ dàng có sẵn và thời gian đưa ra thị trường quá ngắn). Bài báo xuất sắc mặc dù Tomislav

Daniel Jawna

rất đúng. Công việc của tôi là bảo trì các ứng dụng cũ, thường là truy cập SQL Server dB's + ms hoặc giao diện người dùng php. Những thứ này thường được làm bởi "cháu trai giỏi máy tính". Không có khóa ngoại, nhưng chức năng ngày + giờ tùy chỉnh. bài viết của bạn là tâm trạng của tôi chính xác

Daniel Jawna

rất đúng. Công việc của tôi là bảo trì các ứng dụng cũ, thường là truy cập SQL Server dB's + ms hoặc giao diện người dùng php. Những thứ này thường được làm bởi "cháu trai giỏi máy tính". Không có khóa ngoại, nhưng chức năng ngày + giờ tùy chỉnh. bài viết của bạn là tâm trạng của tôi chính xác

JPoet

I find Java very unproductive and very expensive for a lot of low level tedious work. C++ is for programmers who can handle memory access/pointers. Most corporate programmers cannot. Back in the day you had PL/1 and C for software engineers and COBOL for information technology programmers

JPoet

I find Java very unproductive and very expensive for a lot of low level tedious work. C++ is for programmers who can handle memory access/pointers. Most corporate programmers cannot. Back in the day you had PL/1 and C for software engineers and COBOL for information technology programmers

joselie castañeda

cảm ơn. this is so helpful as i am going to make a heavy-computation enterprise application. i think i'll try node. js on other application. for now, i'll use ruby on rails

joselie castañeda

cảm ơn. this is so helpful as i am going to make a heavy-computation enterprise application. i think i'll try node. js on other application. for now, i'll use ruby on rails

Túlio Spuri

When this article was written ?

Túlio Spuri

When this article was written ?

armandoali

Great article

armandoali

Great article

Olivier

Thanks for this article I think than the argument of same langage for front and dev is the worst I can liste or read. Organized à good coding with js is the more horrible things append in a team. I work since last year on backend project and where this should be coded in some times with mature framework like django it took too much time understand hundreds bugs. Where mongodb feels cool ? Never. Tôi thực sự nghĩ rằng nút js là một trò đùa lớn và không hay lắm. The package manager give us some cool package to patch and hide the bad side of node but there is nothing to do about the callback hell. Finally the code looks like a big sand box than i hatte to open a file for debug or add some lines of code. So my conclusion is than for small app why not but for big and evolutive project not use nor nodejs and mongodb. Regards

Olivier

Thanks for this article I think than the argument of same langage for front and dev is the worst I can liste or read. Organized à good coding with js is the more horrible things append in a team. I work since last year on backend project and where this should be coded in some times with mature framework like django it took too much time understand hundreds bugs. Where mongodb feels cool ? Never. Tôi thực sự nghĩ rằng nút js là một trò đùa lớn và không hay lắm. The package manager give us some cool package to patch and hide the bad side of node but there is nothing to do about the callback hell. Finally the code looks like a big sand box than i hatte to open a file for debug or add some lines of code. So my conclusion is than for small app why not but for big and evolutive project not use nor nodejs and mongodb. Regards

buffonomics

This is a fairly ill-informed comment as ES6 was alive and well as at a year ago. Besides the OO from ES6, there is also TypeScript which adds even more enterprise-level OO and enforcable static-typing to JavaScript. Giống. NET is compiled to raw clr, TypeScript may also be "transpiled" to raw Javascript. NodeJS allows for pretty much all of this now with an even still better utilization of server resources and no OS lock-in. Think cutting your infrastructure costs by over 2000% because you really don't need to scale too vertically or pay for those . NET licenses per node of scale. Ngay cả khi bạn đang đi theo con đường Mono, lol. Tôi sẽ để bạn tự nghiên cứu cách so sánh đó. Các công ty công nghệ tài chính như Paypal biết một hoặc hai điều về tải cũng đang vui vẻ làm những điều tuyệt vời với nút, vì vậy tôi thực sự nghi ngờ nhận xét này của bạn xuất phát từ kiến ​​thức về những gì hệ sinh thái NodeJS thực sự cung cấp cho sản phẩm táo bạo được xây dựng . Ngoài ra, bất kể bạn có thể có ý kiến ​​cá nhân nào về ORM, thực tế hợp lý của tất cả là ORMS sử dụng nhiều tài nguyên bộ nhớ hơn mức cần thiết để chạy phụ trợ. Họ cũng đánh vào nguồn dữ liệu của bạn nhiều hơn mức cần thiết. Bạn cũng đã nói điều gì đó liên quan đến bộ nhớ đệm và ORM mà tôi đoán bạn đang đề cập đến bộ nhớ đệm cấp ORM (e. g. Bộ đệm L1/2 trong chế độ Ngủ đông). Tôi hy vọng bạn hiểu rằng bạn KHÔNG THỰC SỰ CẦN ORM để thực hiện bộ nhớ đệm cho bạn. Bạn có thể làm điều này bằng cách sử dụng các công cụ tách rời hiệu quả và đẹp mắt. và tại đó linh hoạt hơn. Điều quan trọng cần ghi nhớ là ngay cả bây giờ, vẫn có người bảo vệ Fortran là công cụ thực sự duy nhất để xây dựng phần mềm. Mọi thứ di chuyển khá nhanh trong ngành này. Niềm tự hào là điều dễ hiểu, nhưng lời khuyên của tôi dành cho bạn là hãy tham gia vào ít nhất 1 thế giới công nghệ mới nhiều nhất là vài năm một lần. Bạn sẽ ở lại có liên quan và cảm ơn tôi sau

buffonomics

This is a fairly ill-informed comment as ES6 was alive and well as at a year ago. Besides the OO from ES6, there is also TypeScript which adds even more enterprise-level OO and enforcable static-typing to JavaScript. Giống. NET is compiled to raw clr, TypeScript may also be "transpiled" to raw Javascript. NodeJS allows for pretty much all of this now with an even still better utilization of server resources and no OS lock-in. Think cutting your infrastructure costs by over 2000% because you really don't need to scale too vertically or pay for those . NET licenses per node of scale. Ngay cả khi bạn đang đi theo con đường Mono, lol. Tôi sẽ để bạn tự nghiên cứu cách so sánh đó. Các công ty công nghệ tài chính như Paypal biết một hoặc hai điều về tải cũng đang vui vẻ làm những điều tuyệt vời với nút, vì vậy tôi thực sự nghi ngờ nhận xét này của bạn xuất phát từ kiến ​​thức về những gì hệ sinh thái NodeJS thực sự cung cấp cho sản phẩm táo bạo được xây dựng . Ngoài ra, bất kể bạn có thể có ý kiến ​​cá nhân nào về ORM, thực tế hợp lý của tất cả là ORMS sử dụng nhiều tài nguyên bộ nhớ hơn mức cần thiết để chạy phụ trợ. Họ cũng đánh vào nguồn dữ liệu của bạn nhiều hơn mức cần thiết. Bạn cũng đã nói điều gì đó liên quan đến bộ nhớ đệm và ORM mà tôi đoán bạn đang đề cập đến bộ nhớ đệm cấp ORM (e. g. Bộ đệm L1/2 trong chế độ Ngủ đông). Tôi hy vọng bạn hiểu rằng bạn KHÔNG THỰC SỰ CẦN ORM để thực hiện bộ nhớ đệm cho bạn. Bạn có thể làm điều này bằng cách sử dụng các công cụ tách rời hiệu quả và đẹp mắt. và tại đó linh hoạt hơn. Điều quan trọng cần ghi nhớ là ngay cả bây giờ, vẫn có người bảo vệ Fortran là công cụ thực sự duy nhất để xây dựng phần mềm. Mọi thứ di chuyển khá nhanh trong ngành này. Niềm tự hào là điều dễ hiểu, nhưng lời khuyên của tôi dành cho bạn là hãy tham gia vào ít nhất 1 thế giới công nghệ mới nhiều nhất là vài năm một lần. Bạn sẽ ở lại có liên quan và cảm ơn tôi sau

biên tập

I really wanna be able to try out Node. js nhưng thật khó để có được một cái gì đó đang chạy. Cài đặt một ứng dụng "đơn giản" luôn dẫn đến một danh sách những việc bạn cần làm, cài đặt toàn cầu (không phải lúc nào cũng có thể), chỉnh sửa tệp, cố gắng tìm hiểu ý nghĩa của các nhà phát triển chết tiệt trong các hướng dẫn ít ỏi của họ. Nó sẽ nhanh chóng trở nên tồi tệ nếu bạn làm sai một điều nhỏ nhất. Nếu nó tuyệt vời như vậy, tại sao không ai tìm ra cách tạo các trình cài đặt đơn giản với thứ này?

biên tập

I really wanna be able to try out Node. js nhưng thật khó để có được một cái gì đó đang chạy. Cài đặt một ứng dụng "đơn giản" luôn dẫn đến một danh sách những việc bạn cần làm, cài đặt toàn cầu (không phải lúc nào cũng có thể), chỉnh sửa tệp, cố gắng tìm hiểu ý nghĩa của các nhà phát triển chết tiệt trong các hướng dẫn ít ỏi của họ. Nó sẽ nhanh chóng trở nên tồi tệ nếu bạn làm sai một điều nhỏ nhất. Nếu nó tuyệt vời như vậy, tại sao không ai tìm ra cách tạo các trình cài đặt đơn giản với thứ này?

Alexis Menest

Nền tảng blog ma https. //github. com/TryGhost/Ghost/blob/master/gói. json

Alexis Menest

Nền tảng blog ma https. //github. com/TryGhost/Ghost/blob/master/gói. json

David

Vâng, thật tuyệt nếu có một buổi hẹn hò. Tôi cho rằng họ không hiển thị nó vì họ biết mọi người có thành kiến ​​như thế nào đối với thông tin mới - nhưng sẽ không có ý nghĩa gì nếu che giấu nó trong một bài báo về công nghệ đang phát triển nhanh chóng

David

Vâng, thật tuyệt nếu có một buổi hẹn hò. Tôi cho rằng họ không hiển thị nó vì họ biết mọi người có thành kiến ​​như thế nào đối với thông tin mới - nhưng sẽ không có ý nghĩa gì nếu che giấu nó trong một bài báo về công nghệ đang phát triển nhanh chóng

Samuel_Ogden

Nút sẽ là một ý tưởng tồi cho một cái gì đó như 9gag. com thì sao?

Samuel_Ogden

Nút sẽ là một ý tưởng tồi cho một cái gì đó như 9gag. com thì sao?

chaitanya

Này Tomislav, Bài báo tuyệt vời. Tôi muốn biết rằng nếu giả sử tôi muốn nhận đầu ra phần cứng bên ngoài trong ứng dụng của mình, e. g, máy quét hoặc chữ ký điện tử (nếu người dùng đang thực hiện chữ ký điện tử hoặc nhận bản sao được quét từ máy quét), thì tôi có thể truy cập trực tiếp vào ứng dụng của mình không?

chaitanya

Này Tomislav, Bài báo tuyệt vời. Tôi muốn biết rằng nếu giả sử tôi muốn nhận đầu ra phần cứng bên ngoài trong ứng dụng của mình, e. g, máy quét hoặc chữ ký điện tử (nếu người dùng đang thực hiện chữ ký điện tử hoặc nhận bản sao được quét từ máy quét), thì tôi có thể truy cập trực tiếp vào ứng dụng của mình không?

Misha R

TypeScript là trình bao bọc cú pháp trên JavaScript tiêu chuẩn và biên dịch thành JavaScript tiêu chuẩn. Nó được phát minh để làm cho mã có thể bảo trì được và cho phép nó được sử dụng giống như một ngôn ngữ lập trình thực sự. Cho rằng bạn phải sử dụng JS khi thích hợp, nó làm cho việc viết nó trở nên quen thuộc hơn với các lập trình viên thực thụ và làm cho nó có thể bảo trì được. Điều đó nói rằng, mọi thứ JS và Node đều phù hợp với các ứng dụng web mỏng, nhẹ cần được kết hợp với nhau một cách nhanh chóng và hiệu quả, cho những thứ như ASP. NET, JSP, Ruby, v.v. hơi quá mức cần thiết. Tin rằng người ta không thể sử dụng Node thần kỳ mới cho mọi thứ chỉ vì một anh chàng có thể viết cả front và back end là nghiệp dư

Misha R

TypeScript là trình bao bọc cú pháp trên JavaScript tiêu chuẩn và biên dịch thành JavaScript tiêu chuẩn. Nó được phát minh để làm cho mã có thể bảo trì được và cho phép nó được sử dụng giống như một ngôn ngữ lập trình thực sự. Cho rằng bạn phải sử dụng JS khi thích hợp, nó làm cho việc viết nó trở nên quen thuộc hơn với các lập trình viên thực thụ và làm cho nó có thể bảo trì được. Điều đó nói rằng, mọi thứ JS và Node đều phù hợp với các ứng dụng web mỏng, nhẹ cần được kết hợp với nhau một cách nhanh chóng và hiệu quả, cho những thứ như ASP. NET, JSP, Ruby, v.v. hơi quá mức cần thiết. Tin rằng người ta không thể sử dụng Node thần kỳ mới cho mọi thứ chỉ vì một anh chàng có thể viết cả front và back end là nghiệp dư

ellisgl

Đóng gói một ngôn ngữ bằng một ngôn ngữ khác mà bạn phải dịch sẽ thêm chi phí. Ngoài ra có những thứ không dịch được, chỉ là trong cuộc sống thực, dịch giữa các ngôn ngữ, bạn mất một cái gì đó. Trong trường hợp này, bạn mất tốc độ (phải dịch từ cái này sang cái khác) và tối ưu hóa, vì lý do một. ORM không làm tất cả. Ban đầu, tôi dành cho ORM, sau đó tôi tìm hiểu sâu về nó và bạn kết thúc với câu "Tôi làm điều này như thế nào?", "Ồ, bạn không thể dễ dàng, bạn phải thực hiện 10 truy vấn khác", hoặc bạn kết thúc . ORM đơn giản là "Chọn blah blah từ bảng trong đó x = y". Yếu tố đổi thưởng nhỏ duy nhất của một số ORM là chúng sẽ chuyển đổi ngôn ngữ của chúng sang bất kỳ DB nào. Nhưng nếu bạn được trả tiền để làm việc trên một ứng dụng cấp doanh nghiệp, thì bạn chỉ đang xử lý 1 - 3 cơ sở dữ liệu, được sử dụng cho những thứ riêng biệt. Nếu bạn có 500 nhân viên và 10.000 khách hàng, ORM có thể bị tắc nghẽn

ellisgl

Đóng gói một ngôn ngữ bằng một ngôn ngữ khác mà bạn phải dịch sẽ thêm chi phí. Ngoài ra có những thứ không dịch được, chỉ là trong cuộc sống thực, dịch giữa các ngôn ngữ, bạn mất một cái gì đó. Trong trường hợp này, bạn mất tốc độ (phải dịch từ cái này sang cái khác) và tối ưu hóa, vì lý do một. ORM không làm tất cả. Ban đầu, tôi dành cho ORM, sau đó tôi tìm hiểu sâu về nó và bạn kết thúc với câu "Tôi làm điều này như thế nào?", "Ồ, bạn không thể dễ dàng, bạn phải thực hiện 10 truy vấn khác", hoặc bạn kết thúc . ORM đơn giản là "Chọn blah blah từ bảng trong đó x = y". Yếu tố đổi thưởng nhỏ duy nhất của một số ORM là chúng sẽ chuyển đổi ngôn ngữ của chúng sang bất kỳ DB nào. Nhưng nếu bạn được trả tiền để làm việc trên một ứng dụng cấp doanh nghiệp, thì bạn chỉ đang xử lý 1 - 3 cơ sở dữ liệu, được sử dụng cho những thứ riêng biệt. Nếu bạn có 500 nhân viên và 10.000 khách hàng, ORM có thể bị tắc nghẽn

quả cầu Nils

Hey, is there a library/tool you used to creste the graphics ?

quả cầu Nils

Hey, is there a library/tool you used to creste the graphics ?

Praveen kumar Pamani

Thank you for this article , I would suggest this article if people want to know what is node and what can we do with nodejs

Praveen kumar Pamani

Thank you for this article , I would suggest this article if people want to know what is node and what can we do with nodejs

dohkoo

Great article, thanks for the overview. http. //www. steshadoku. com

dohkoo

Great article, thanks for the overview. http. //www. steshadoku. com

subkuchsell. com

thanks for great article really very helpful to understand the node. js subkuchsell. com

subkuchsell. com

thanks for great article really very helpful to understand the node. js subkuchsell. com

Tomislav Capan

Yes, this is true, article was authored and published in August 2013. (sorry for such a late confirmation, haven't seen this earlier)

Tomislav Capan

Yes, this is true, article was authored and published in August 2013. (sorry for such a late confirmation, haven't seen this earlier)

người chơi gôn484

In what universe can Mongo DB be referred to as an Object DB? It doesn't support inheritance. It's a Document Oriented DB not an Object Oriented DB. I just don't want any of the kiddies to get confused

người chơi gôn484

In what universe can Mongo DB be referred to as an Object DB? It doesn't support inheritance. It's a Document Oriented DB not an Object Oriented DB. I just don't want any of the kiddies to get confused

người chơi gôn484

We switched to one language for backend and UI but we decided to keep the language that runs lightning bolt fast at runtime and has type safety and supports standard ORMs with lazy loading etc. , We didn't want to throw all those things away, which is what you have to do when you go with a JS solution on your backend. Java on the backend is a no brainer (so long as you don't over engineer and over complicate your app with memory and CPU sapping Spring). The key to using Java for the UI is use a Java framework that does all the JS for you - so you can live in a world devoid of having to deal with JS and stick with compiled, typesafe, enterprise suitable code. This solution is also scalable - J2SE has supported clustering for nearly two decades now. One such Java UI framework that covers all our JS needs and gives us all the 'partial updates' goodness with an AJAX event driven model with websockets option is Wicket

người chơi gôn484

We switched to one language for backend and UI but we decided to keep the language that runs lightning bolt fast at runtime and has type safety and supports standard ORMs with lazy loading etc. , We didn't want to throw all those things away, which is what you have to do when you go with a JS solution on your backend. Java on the backend is a no brainer (so long as you don't over engineer and over complicate your app with memory and CPU sapping Spring). The key to using Java for the UI is use a Java framework that does all the JS for you - so you can live in a world devoid of having to deal with JS and stick with compiled, typesafe, enterprise suitable code. This solution is also scalable - J2SE has supported clustering for nearly two decades now. One such Java UI framework that covers all our JS needs and gives us all the 'partial updates' goodness with an AJAX event driven model with websockets option is Wicket

Rumana Amin

Hi Tomislav, your article is really nice and informative. It helped me a lot to understand Node. js and it's uses

Rumana Amin

Hi Tomislav, your article is really nice and informative. It helped me a lot to understand Node. js and it's uses

WarrEagle

The simple answer is do not use Node. js for that. What part of that are you missing? You want to serve GEO data coordinates to 500K connected clients?. easy. Do a massive JOIN statement across a million rows on a RDBS? You're screwed. Surgeons do not work with chainsaws. Neither should programmers

WarrEagle

The simple answer is do not use Node. js for that. What part of that are you missing? You want to serve GEO data coordinates to 500K connected clients?. easy. Do a massive JOIN statement across a million rows on a RDBS? You're screwed. Surgeons do not work with chainsaws. Neither should programmers

người chơi gôn484

You underate ORM as most of the people who have never built an OO system with a decent highly performant ORM that rocks do (and by 'decent' ORM I'm NOT referring to the ORM most people think of using, Hibernate. )

người chơi gôn484

You underate ORM as most of the people who have never built an OO system with a decent highly performant ORM that rocks do (and by 'decent' ORM I'm NOT referring to the ORM most people think of using, Hibernate. )

người chơi gôn484

I agree - this article and associated comments by the JS fan boys confirms my fears that most JavaScript apps must have anemic domain models (https. //martinfowler. com/bliki/AnemicDomainModel. html) that are quite trivial and virtually expression less - all the work will be done in disassociated (not encapsulated and definitely not polymorphic) business logic

người chơi gôn484

I agree - this article and associated comments by the JS fan boys confirms my fears that most JavaScript apps must have anemic domain models (https. //martinfowler. com/bliki/AnemicDomainModel. html) that are quite trivial and virtually expression less - all the work will be done in disassociated (not encapsulated and definitely not polymorphic) business logic

người chơi gôn484

I'm guessing your experience with 'ORMs' is limited to Hibernate. I had a similar experience until I thought there must be better ORMs out there - look around - others exist

người chơi gôn484

I'm guessing your experience with 'ORMs' is limited to Hibernate. I had a similar experience until I thought there must be better ORMs out there - look around - others exist

người chơi gôn484

Good points Adin - I was about to make the same ones. In regard to the article's claim that traditional frameworks "spawn a new thread for each connection (request)". So, so wrong. Must have made more than a few people livid to see such an error which either a) the author knows is clearly wrong and persists with the view or b) has never used any other backend framework and so doesn't realize that he is so wrong. The conflation of connection with request is also interesting. Does his knowledge not extend to understand the concept of connection "keep alives". A connection does not have a one to one relationship to requests as he suggests. This kind of skewed, twisted view of how intelligent, mature, highly evolved frameworks (eg. , Java/Tomcat and I'm sure . net/ASP) handle requests makes me feel like this article is tainted and not representing the truth about alternatives. In regard to moving away from the Request/Response mentality - many existing frameworks have done this also and created a component oriented architecture that supports asynchronous model based updates. eg. , Java Wicket or Angular JS. It's almost like running JS (a type unsafe, non OO language - if you're a believer that manual, self assembly 'prototype' inheritance is in the true OO spirit) on the server is not a concept that has enough merit without twisting the truth about how traditional server side frameworks work. It's like that or maybe it is that

người chơi gôn484

Good points Adin - I was about to make the same ones. In regard to the article's claim that traditional frameworks "spawn a new thread for each connection (request)". So, so wrong. Must have made more than a few people livid to see such an error which either a) the author knows is clearly wrong and persists with the view or b) has never used any other backend framework and so doesn't realize that he is so wrong. The conflation of connection with request is also interesting. Does his knowledge not extend to understand the concept of connection "keep alives". A connection does not have a one to one relationship to requests as he suggests. This kind of skewed, twisted view of how intelligent, mature, highly evolved frameworks (eg. , Java/Tomcat and I'm sure . net/ASP) handle requests makes me feel like this article is tainted and not representing the truth about alternatives. In regard to moving away from the Request/Response mentality - many existing frameworks have done this also and created a component oriented architecture that supports asynchronous model based updates. eg. , Java Wicket or Angular JS. It's almost like running JS (a type unsafe, non OO language - if you're a believer that manual, self assembly 'prototype' inheritance is in the true OO spirit) on the server is not a concept that has enough merit without twisting the truth about how traditional server side frameworks work. It's like that or maybe it is that

người chơi gôn484

Not every client who has an active session needs to be allocated their own thread - threads are shared and each user only needs a thread to service requests. Requests come in in short bursts and don't need to tie up a thread for very long if the back end code is executing in a highly optimized, compiled language and a fast database. For this reason you can't say "System A can support 10,000 threads therefore it can only support 10,000 clients". The number of clients supported is orders of magnitude greater than the number of threads available because of diversity. Most UI's, if well written, only 'phone home' to the server when absolutely necessary - not "all the time"

người chơi gôn484

Not every client who has an active session needs to be allocated their own thread - threads are shared and each user only needs a thread to service requests. Requests come in in short bursts and don't need to tie up a thread for very long if the back end code is executing in a highly optimized, compiled language and a fast database. For this reason you can't say "System A can support 10,000 threads therefore it can only support 10,000 clients". The number of clients supported is orders of magnitude greater than the number of threads available because of diversity. Most UI's, if well written, only 'phone home' to the server when absolutely necessary - not "all the time"

người chơi gôn484

It sounds like the node. js people think that JS is the only language that supports concurrency (although they promote a single threaded web server solution -WTF?) and non blocking I/O - of course it's not that case but you seem so excited about such things that I can only assume you have just discovered concepts that have existed in other languages for 2 decades or more

người chơi gôn484

It sounds like the node. js people think that JS is the only language that supports concurrency (although they promote a single threaded web server solution -WTF?) and non blocking I/O - of course it's not that case but you seem so excited about such things that I can only assume you have just discovered concepts that have existed in other languages for 2 decades or more

Tomislav Capan

Of course, you understand this is an illustration. In practice, it's a thread pool, which is limited by memory available, and is magnitudes of order less than what an event look can support. Thanks for the comment, though

Tomislav Capan

Of course, you understand this is an illustration. In practice, it's a thread pool, which is limited by memory available, and is magnitudes of order less than what an event look can support. Thanks for the comment, though

Dean Radcliffe

Damn, this is an oldie but goodie. I give talks just like this, and may borrow your slides. In light of these original intentions of node to do awesome things like queued db writes, and server-push, it's surprising how most node apps today are still built on the request/response model and synchronously (but non-blockingly) waiting on db writes

Dean Radcliffe

Damn, this is an oldie but goodie. I give talks just like this, and may borrow your slides. In light of these original intentions of node to do awesome things like queued db writes, and server-push, it's surprising how most node apps today are still built on the request/response model and synchronously (but non-blockingly) waiting on db writes

Ulyana

Great insides, thanks for the article. Node. js có rất nhiều lợi thế. nó nhẹ, hiệu quả và cung cấp khả năng sử dụng Javascript trên cả giao diện người dùng và phụ trợ mở ra những khả năng mới. However, it also has drawbacks you should keep in mind. We have tried to describe some in the article https. //www. chuyên gia mạng. co/blog/pros-cons-use-node. js-backend Your opinion would be appreciated a lot

Ulyana

Great insides, thanks for the article. Node. js có rất nhiều lợi thế. nó nhẹ, hiệu quả và cung cấp khả năng sử dụng Javascript trên cả giao diện người dùng và phụ trợ mở ra những khả năng mới. However, it also has drawbacks you should keep in mind. We have tried to describe some in the article https. //www. chuyên gia mạng. co/blog/pros-cons-use-node. js-backend Your opinion would be appreciated a lot

Maq Said

Amazing Article. MongoDB tôi chưa bao giờ khám phá. Bạn có thể nói thêm về nó không và tại sao nó hoạt động tốt với Node. js

Maq Said

Amazing Article. MongoDB tôi chưa bao giờ khám phá. Bạn có thể nói thêm về nó không và tại sao nó hoạt động tốt với Node. js

Misha Kov

Đây chính xác là bài viết tôi đang tìm kiếm, Ví dụ về nơi Node. js có thể được sử dụng. Cảm ơn

Misha Kov

Đây chính xác là bài viết tôi đang tìm kiếm, Ví dụ về nơi Node. js có thể được sử dụng. Cảm ơn

Jessica Barnes

Node.js has the concept of asynchronous execution of Input-output based events through a thread pool. And it concentrates in execution and topping well for low-CPU, highly I/O-bound operations. Just starting to work on Node.js will allow a developers to analyze how to exploit it for maximum performance.

Jessica Barnes

Node.js has the concept of asynchronous execution of Input-output based events through a thread pool. And it concentrates in execution and topping well for low-CPU, highly I/O-bound operations. Just starting to work on Node.js will allow a developers to analyze how to exploit it for maximum performance.

Janguk James Lee

This is a pretty good article motives me to take on Node. js

Janguk James Lee

This is a pretty good article motives me to take on Node. js

Magdalena Mbn

if they ca'tn learn how to handle pointers they can't program

Magdalena Mbn

if they ca'tn learn how to handle pointers they can't program

Orderama Web

TwaT - can you tell me which pub/bar you visit so I can avoid you. I wouldn't be surprised if you OrgASM when you read back your comments

Orderama Web

TwaT - can you tell me which pub/bar you visit so I can avoid you. I wouldn't be surprised if you OrgASM when you read back your comments

philippe

I'd rather have more Java to the client side than more Javascript on the server side. Refactoring Javascript is a nightmare. Whoever work on software with 4000 - 10000 classes like i did knows what i am talking about. I see the threading management as a plus ( if you target to run a site like Facebook otherwise you dont care. Your static content will use cloud flare are 4000 connections AT THE SAME TIME is just insane traffic so i would not compromise maintenance VS scalability ) Not valid from intranet applications at least. I curious if future version of Tomcat will use the reactor pattern, Java itself does provides support for this. You can deal with static content using Nginx which has the reactor pattern implemented https. //www. pascaldimassimo. com/2011/02/10/java-and-the-reactor-pattern Still for dynamic pages i haven't found any clues. A thread does not hold the session context so i am really skeptical about having 2Mb in there. Unless poorly coded

philippe

I'd rather have more Java to the client side than more Javascript on the server side. Refactoring Javascript is a nightmare. Whoever work on software with 4000 - 10000 classes like i did knows what i am talking about. I see the threading management as a plus ( if you target to run a site like Facebook otherwise you dont care. Your static content will use cloud flare are 4000 connections AT THE SAME TIME is just insane traffic so i would not compromise maintenance VS scalability ) Not valid from intranet applications at least. I curious if future version of Tomcat will use the reactor pattern, Java itself does provides support for this. You can deal with static content using Nginx which has the reactor pattern implemented https. //www. pascaldimassimo. com/2011/02/10/java-and-the-reactor-pattern Still for dynamic pages i haven't found any clues. A thread does not hold the session context so i am really skeptical about having 2Mb in there. Unless poorly coded

Cody Donelson

Event though the article is a few years old it brings up some great points about Node. js. Reading through the comments I've seen some posts about how Node. js is a wonderful thing, and others about how the leading languages are C#, Java, or Ruby. We know that JavaScript is going to offer some complexities as it relates to Object Oriented Programming, Object Relational Mapping, relational databases, and more. I think most developers/project managers are losing sight of what makes JavaScript and Node. js (as well as AngularJS) so wonderful. We were able to implement a client side language on the server side and make it do the exact same thing as any other server side language. I personally love using Node. js, although it was difficult to wrap my head around being fully immersed in a type-less language. Once I grasped the fact that the sky was the limit when it came to my objects and that I didn't have to map my objects from one type to another (like you would in C# or Java) my ability to write a code that performed quickly and effectively grew. I've recently been teaching a couple PC techs at the company I work for the ins and outs of programming. My boss is very adamant that Node. js is the way of the future (especially the deprecation of Java plug-ins within the coming years) I would tend to agree. It's lost on me as to why there's such an argument as far as objects are concerned in Node. js/JavaScript. I find it easier to use objects and I can use them more dynamically BECAUSE of JavaScript. Very soon I'll be implementing HTML properties within objects for my Express 4 applications. I've found that PUG (formerly Jade) is extremely capable of handling objects and arrays, thus, making it easier for someone to dynamically change a type, a value, or a tag, based on the object that gets sent through a GET or POST request. I believe once everyone gets on board with understanding the way Node. js operates, how you can effectively implement standards that are usually enforced in typed languages, and over the fact that Node. js has some quirks about it, will we truly be able to move forward and make this language as powerful as the languages that came before it. Lastly, I'll add that the ability to utilize Node. js virtually anywhere makes it that much better. Whether its an Express application deployed on a Linux server, an Electron application that's deployed on a terminal server, Node. js is practically a perfect fit for whatever amount of work that needs to be done

Cody Donelson

Event though the article is a few years old it brings up some great points about Node. js. Reading through the comments I've seen some posts about how Node. js is a wonderful thing, and others about how the leading languages are C#, Java, or Ruby. We know that JavaScript is going to offer some complexities as it relates to Object Oriented Programming, Object Relational Mapping, relational databases, and more. I think most developers/project managers are losing sight of what makes JavaScript and Node. js (as well as AngularJS) so wonderful. We were able to implement a client side language on the server side and make it do the exact same thing as any other server side language. I personally love using Node. js, although it was difficult to wrap my head around being fully immersed in a type-less language. Once I grasped the fact that the sky was the limit when it came to my objects and that I didn't have to map my objects from one type to another (like you would in C# or Java) my ability to write a code that performed quickly and effectively grew. I've recently been teaching a couple PC techs at the company I work for the ins and outs of programming. My boss is very adamant that Node. js is the way of the future (especially the deprecation of Java plug-ins within the coming years) I would tend to agree. It's lost on me as to why there's such an argument as far as objects are concerned in Node. js/JavaScript. I find it easier to use objects and I can use them more dynamically BECAUSE of JavaScript. Very soon I'll be implementing HTML properties within objects for my Express 4 applications. I've found that PUG (formerly Jade) is extremely capable of handling objects and arrays, thus, making it easier for someone to dynamically change a type, a value, or a tag, based on the object that gets sent through a GET or POST request. I believe once everyone gets on board with understanding the way Node. js operates, how you can effectively implement standards that are usually enforced in typed languages, and over the fact that Node. js has some quirks about it, will we truly be able to move forward and make this language as powerful as the languages that came before it. Lastly, I'll add that the ability to utilize Node. js virtually anywhere makes it that much better. Whether its an Express application deployed on a Linux server, an Electron application that's deployed on a terminal server, Node. js is practically a perfect fit for whatever amount of work that needs to be done

Gage Poon

Lightening fast, lightweight, smoother development and better performance these are some of the revolutionary changes brought by Node js in the web development field. Node js offers the freedom to creativity, abundant resources like NPM (Node Package Manager), which is a shared library of modules and tools. Additionally, web applications developed using this web development framework are more scalable. This JavaScript framework is very popular among the startups. However, big names like Netflix, Paypal, eBay, Microsoft, Uber, DivBox. in etc. are also using this feature-rich web development framework

Gage Poon

Lightening fast, lightweight, smoother development and better performance these are some of the revolutionary changes brought by Node js in the web development field. Node js offers the freedom to creativity, abundant resources like NPM (Node Package Manager), which is a shared library of modules and tools. Additionally, web applications developed using this web development framework are more scalable. This JavaScript framework is very popular among the startups. However, big names like Netflix, Paypal, eBay, Microsoft, Uber, DivBox. in etc. are also using this feature-rich web development framework

rajivkumar bonam

what is node js how to write code in node js

rajivkumar bonam

what is node js how to write code in node js

Minarchism Leads To Freedom

Great article, thanks

Minarchism Leads To Freedom

Great article, thanks

csps1343

Nice node.js tutorials, thanks for sharing.

csps1343

Nice node.js tutorials, thanks for sharing.

Rahul Raut

thank you so much. learn node https://monkelite.com/what-is-node-js-learn-step-by-step/

Rahul Raut

thank you so much. learn node https://monkelite.com/what-is-node-js-learn-step-by-step/

Chapter247- Software Dev

"Why The Hell Would I Use Node.js? A Case-by-Case Tutorial". Every beginner must required to read this article. It's so easy to understand main Node.Js concept and programming overviews. Hire Node js development company

Sam Watt

Wow, this is a very detailed and insightful article based on cases. I loved reading it, and hoping to see more such articles. Thank you

ThinkStart Pvt Ltd

Useful post. Thanks you for sharing this wonderful information

w3villa

Hi, I like to read your informative blog. Thanks for sharing

Marie adams

I made several successful investments with this broker before losing 40% of my savings to the trading scam. Tôi đã tốn rất nhiều tiền và đau đớn khi đầu tư vào một khoản đầu tư thậm chí không có thật. I was able to recover the majority of the funds, and we are still attempting to recover the rest. I highly recommend SECURE TO INVEST WELL for anyone involved in an online trading scam Trading scam $350,000 recovered BELOW IS THEIR CONTACT. secure2investwell@gmail. cuộc gọi / whatsapp. +14638887391

Marie adams

I made several successful investments with this broker before losing 40% of my savings to the trading scam. It cost me so much money and pain to invest in an investment that was not even real. I was able to recover the majority of the funds, and we are still attempting to recover the rest. Tôi thực sự khuyên bạn nên AN TOÀN ĐỂ ĐẦU TƯ TỐT cho bất kỳ ai tham gia vào một vụ lừa đảo giao dịch trực tuyến Lừa đảo giao dịch đã thu hồi 350.000 đô la DƯỚI ĐÂY LÀ LIÊN HỆ CỦA HỌ. safe2investwell@gmail. cuộc gọi / whatsapp. +14638887391

Joshua Flynn

Viết rất tốt nhưng bạn có thể làm điều tương tự bằng cách sử dụng ngăn xếp đèn thông thường với lệnh gọi JQuery thông qua AJAX giống như tất cả các trình nhắn tin tức thời trước đây đã thực hiện mà không gặp rắc rối nào không? . Tôi đã đọc hàng trăm bài báo trên web về lý do tại sao ai đó nên sử dụng nút nhưng tất cả chúng đều đề cập đến điều gì đó có thể được thực hiện với công nghệ mà chúng tôi đã có từ những năm 90. Vậy nút có gì đặc biệt mà tôi nên tìm hiểu về nó với công nghệ 30 năm tuổi đã hỗ trợ các loại ứng dụng giống như bạn đã đề cập trong bài viết này 15 năm trước khi nút xuất hiện và quay trở lại khi quay số nhanh. Vì vậy, nếu nó đủ nhanh để thực hiện điều tương tự qua kết nối quay số thì nút đã làm gì để cải thiện hệ sinh thái của internet