search
HomeWeb Front-endJS TutorialExpress author TJ bids farewell to Node.js and heads to Go_node.js

First of all, this is an article translated from TJ's Farewell Node.js. I was really shocked after reading this article, but I don't agree with some of the author's views. For example, I think Node. js's package register is one of its many advantages, but Go is slightly lacking in this aspect. Due to my personal limitations, there were many things I didn’t understand when translating. I also went to the author’s blog and stackoverflow to ask some questions and got answers. There are still many imperfections in the translation, and I hope you can get some pointers.

PS. As a newbie in Node.js, I would like to thank TJ for his hard work and have a good journey.

Text:

Farewell Node.js

Leave Node.js realm

I've been fighting with Node.js in production for long enough, and unfortunately now that I no longer enjoy doing the job, at least for the moment, this is my official farewell. More importantly, I need maintainers.

Node is great in some ways, but it’s not the right tool for the type of software I’m interested in these days. I still plan to use Node for the website, but if you are interested in maintaining any projects, just leave a comment with your Github username, npm username, and project name to let me know. Usually all I ask is that you don't completely change the existing API. If you really want to do this, it's better to start a new project.

Koa is a project that I will continue to maintain. (With Co and friends)

The Story of the Holy Grail

I have always loved C, but everyone who works in C development knows that it is valuable but error-prone. It's hard to justify language choice in day-to-day work because it's not exactly the fastest for the job. Simplicity is also why it's always praised, but you won't get very far without a ton of templates.

As I get more involved in the development of distributed systems, the trend of Node performance being higher than availability and robustness makes me more and more frustrated. Over the past week, I have rewritten a relatively large distributed system in Go to make it more robust, performant, and easier to maintain, and because synchronous code is generally more elegant and easier to develop, it has more Good testable coverage.

I’m not saying Go is the Holy Grail, it’s not perfect, but for many languages ​​that exist today, Go is an excellent answer to me. As more of these "next generation" languages ​​like Rust and Julia find their niche and mature, I'm sure we'll have more great solutions.

Personally, I am very excited about GO language because of his iterative speed. I was very excited to see them eager to reach version 2.0, and according to the news I heard, they were not afraid and broke the original Great things. I'd love it if it were true, mostly because I believe that if it's really good for the language, it should break existing things quickly. But I'm also not a software giant running a lot of systems. :D

Editor: I must have misinterpreted some of the submissions to the mailing list; they were not eager to make breaking changes at any time. @enneff

Why Go?

If Node works for you and you have nothing to worry about, it's still a great tool. But if something bothers you, don't forget to step outside your box and see what's outside the box - within the first few hours of building a product with Go, I was already hooked.

Again, I'm not saying that Go is the absolute best language and you have to use it. But it is very mature and strong for its age. (Roughly when I was the same age as Node). Type refactoring is fun and simple, the job and debugging tools provided by Go are great, and the community has very strong regulations on documentation, formats, benchmarks, and API design.

Being so used to the extreme modularity of Node and having experienced Ruby’s rotten standard library, when I first heard about Go, I thought its standard library was terrible. After I got deeper into this language, I realized that most of the standard libraries at this stage are very necessary, such as compression, json, IO, buffered IO, string operations, etc. Most of these APIS are well defined and powerful. It is easy to write entire programs just by using these standard libraries.

Third-party Go packages

Most of the Go libraries look similar, and most of the third-party code I've used so far is of high quality, which is hard to find in Node because JavaScript attracts different skill levels developers within scope.

For Go packages, there is no registration center, so you usually see 5 or 6 of the same packages at the same time. This can cause some confusion at times, but it has the interesting side effect that you have to carefully review each package to decide which one is the best solution. By Node there are usually canonical packages like "redis", "mongodb-native" or "zeromq", so you'll stop there and just deduce that they are the best one.

If you’re doing some distributed work, you’ll find Go’s impressive concurrency base data types to be very helpful. We can achieve something similar with generators in Node, but in my opinion, generators are only half the job. Without independent error handling, the reporting stack is still mundane at its best. When these solutions are working well, I don't want to wait for three years for the community to reorganize.

In my opinion, Go’s error handling is outstanding. Node is great in the sense that you have to consider every error and decide what to do. However, Node fails at:

You may perform callbacks repeatedly

You may not make callbacks at all and get lost in an unstable state (for example, if you forget to pass an error handling callback, when an error occurs, Node will swallow the error without any feedback)

You may get out-of-box errors

emitters may get multiple wrong events

Forgetting the wrong event handling will ruin everything

Often unsure of what needs to be done incorrectly

Error handling is very redundant

Callbacks suck
In Go, when my code ends, it ends and you can't re-execute within the statement. In Node this is undefined. You would think that a program is completely executed until a library accidentally calls a callback multiple times, or fails to clear handlers properly and causes the code to be executed again. It's quite difficult to find these reasons in actual production code, so why bother? Other languages ​​don't put you through this pain.

Node of the future

I still hope Node does well and many people invest heavily in it, it does have such potential. I think Joyent and the team need to focus on usability - performance is meaningless if your application is brittle and difficult to debug, refactor, and develop.

The fact that we will still have this vague error "Error: getaddrinfo EADDRINFO" in 4-5 years tells us where Node's development priorities are. Understandably, it's easy to miss these things when you focus on building the core of the system. I think users have voiced their opinions on this type of thing time and time again without seeing any results. We usually get a handful of responses to claims that what we have is already perfect. In practice, this is not the case.

Streams are interrupted, callbacks are not easy to use, errors are unclear, and tools are not easy to use. There are community regulations, but they are lacking compared to Go. Despite this, I may continue to use Node for some specific tasks, such as creating web pages, or some scattered APIs or prototypes. If Node can fix some of its fundamental problems, it has a chance of staying relevant, but the argument for performance over availability doesn't go very far when there's an alternative that is both higher performance and higher availability.

If the Node community decides to embrace generators and implement them in a very core part of Node, and properly propagate errors, there is a chance that this can be referenced. This will drastically improve Node's availability and robustness.

The good news is that a while ago I spoke with the amazing and talented guys who contribute the core code to StrongLoop. They are taking a clear approach by listening to developer responses to the platform, and plan to find the right way to fix these issues to make Node easier to work with in the future. I'm not sure how the conflict over simultaneous development of core parts by multiple companies will end, but I hope the developer-driven side will win out.

This isn’t meant to be a personal attack, there are a lot of really talented people working with or on top of Node, but that’s not where I’m interested anymore. I've had a great time in the Node community and met some really interesting people.

The moral of the story is, don’t be limited by your own circle! See what's available elsewhere and you might enjoy programming again. There are so many great solutions out there, I made the mistake of waiting too long to play with them!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Python vs. JavaScript: Which Language Should You Learn?Python vs. JavaScript: Which Language Should You Learn?May 03, 2025 am 12:10 AM

Choosing Python or JavaScript should be based on career development, learning curve and ecosystem: 1) Career development: Python is suitable for data science and back-end development, while JavaScript is suitable for front-end and full-stack development. 2) Learning curve: Python syntax is concise and suitable for beginners; JavaScript syntax is flexible. 3) Ecosystem: Python has rich scientific computing libraries, and JavaScript has a powerful front-end framework.

JavaScript Frameworks: Powering Modern Web DevelopmentJavaScript Frameworks: Powering Modern Web DevelopmentMay 02, 2025 am 12:04 AM

The power of the JavaScript framework lies in simplifying development, improving user experience and application performance. When choosing a framework, consider: 1. Project size and complexity, 2. Team experience, 3. Ecosystem and community support.

The Relationship Between JavaScript, C  , and BrowsersThe Relationship Between JavaScript, C , and BrowsersMay 01, 2025 am 12:06 AM

Introduction I know you may find it strange, what exactly does JavaScript, C and browser have to do? They seem to be unrelated, but in fact, they play a very important role in modern web development. Today we will discuss the close connection between these three. Through this article, you will learn how JavaScript runs in the browser, the role of C in the browser engine, and how they work together to drive rendering and interaction of web pages. We all know the relationship between JavaScript and browser. JavaScript is the core language of front-end development. It runs directly in the browser, making web pages vivid and interesting. Have you ever wondered why JavaScr

Node.js Streams with TypeScriptNode.js Streams with TypeScriptApr 30, 2025 am 08:22 AM

Node.js excels at efficient I/O, largely thanks to streams. Streams process data incrementally, avoiding memory overload—ideal for large files, network tasks, and real-time applications. Combining streams with TypeScript's type safety creates a powe

Python vs. JavaScript: Performance and Efficiency ConsiderationsPython vs. JavaScript: Performance and Efficiency ConsiderationsApr 30, 2025 am 12:08 AM

The differences in performance and efficiency between Python and JavaScript are mainly reflected in: 1) As an interpreted language, Python runs slowly but has high development efficiency and is suitable for rapid prototype development; 2) JavaScript is limited to single thread in the browser, but multi-threading and asynchronous I/O can be used to improve performance in Node.js, and both have advantages in actual projects.

The Origins of JavaScript: Exploring Its Implementation LanguageThe Origins of JavaScript: Exploring Its Implementation LanguageApr 29, 2025 am 12:51 AM

JavaScript originated in 1995 and was created by Brandon Ike, and realized the language into C. 1.C language provides high performance and system-level programming capabilities for JavaScript. 2. JavaScript's memory management and performance optimization rely on C language. 3. The cross-platform feature of C language helps JavaScript run efficiently on different operating systems.

Behind the Scenes: What Language Powers JavaScript?Behind the Scenes: What Language Powers JavaScript?Apr 28, 2025 am 12:01 AM

JavaScript runs in browsers and Node.js environments and relies on the JavaScript engine to parse and execute code. 1) Generate abstract syntax tree (AST) in the parsing stage; 2) convert AST into bytecode or machine code in the compilation stage; 3) execute the compiled code in the execution stage.

The Future of Python and JavaScript: Trends and PredictionsThe Future of Python and JavaScript: Trends and PredictionsApr 27, 2025 am 12:21 AM

The future trends of Python and JavaScript include: 1. Python will consolidate its position in the fields of scientific computing and AI, 2. JavaScript will promote the development of web technology, 3. Cross-platform development will become a hot topic, and 4. Performance optimization will be the focus. Both will continue to expand application scenarios in their respective fields and make more breakthroughs in performance.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.