js选择树的节点及子节点
We start a series of blogs where we are going to compare the trendiest programming languages to help you choose the best technology for your project.
我们开始创建一系列博客,在这些博客中,我们将比较最流行的编程语言,以帮助您为项目选择最佳技术。
The first battle is going to be between .NET Core and Node.js. These are two renowned, publicly available development environments that scale, fasten, speed up, and empower the development process. Both .NET Core and Node.js have pros and cons, and each is better with every release. When it comes to the choice, the crucial point is the project needs.
第一个战役将在.NET Core和Node.js之间进行。 这是两个著名的,公开可用的开发环境,它们可以扩展,固定,加速并授权开发过程。 .NET Core和Node.js都有优点和缺点,并且每个版本都更好。 当涉及到选择时,关键点是项目需求。
For instance, Node.js is considered to provide a wide diversity of the tools that are free of charge. On the contrary .NET Core is thought to be a limited environment because of the Microsoft tag. However, these are just assumptions that do not reveal a complete picture.
例如,Node.js被认为提供了许多免费的工具。 相反,由于Microsoft标签,.NET Core被认为是受限制的环境。 但是,这些只是假设,并不能说明全部情况。
We want to reassure you that both programming platforms offer an awesome range of features that meet performance requirements. Let’s see what development environment is best for your business or project.
我们想向您保证,两个编程平台都提供了满足性能要求的出色功能。 让我们看看哪种开发环境最适合您的业务或项目。
As an alternative to Apache HTTP Server, Node.js was created for Apple’s and Linux operating systems. By being a JavaScript-based language Node.js is used for backend and frontend development and can be used with any JavaScript compliable language.
作为Apache HTTP Server的替代,Node.js是为Apple和Linux操作系统创建的。 通过成为基于JavaScript的语言,Node.js用于后端和前端开发,并且可以与任何JavaScript兼容语言一起使用。
Within packages, you can find modules (code that has been prewritten) that allows you to cope with programming faster. You can find approximately a million packages within the Node.js repository. To easily secure new dependencies you can use an automatic lock-file mechanism.
在软件包中,您可以找到模块(已预先编写的代码),这些模块使您可以更快地应对编程。 您可以在Node.js存储库中找到大约一百万个软件包。 为了轻松保护新的依赖关系,可以使用自动锁定文件机制。
In this aspect .NET Core is totally different, as it is based on C# and is solely used for .NET projects. .NET Core allows developers to use various languages like F# or C++.
在这方面,.NET Core完全不同,因为它基于C#,并且仅用于.NET项目。 .NET Core允许开发人员使用各种语言,例如F#或C ++。
.NET libraries incorporate prewritten code, so that data structures were supported. It also has different libraries for encryption, security, and database access. The class libraries are used to render graphics, interact with databases, and deal with XML.
.NET库包含预编写的代码,因此支持数据结构。 它还具有用于加密,安全性和数据库访问的不同库。 类库用于渲染图形,与数据库交互以及处理XML。
There’s also NuGet, a package management tool that tracks and saves versions and updates within dynamic link libraries and handles dependency chains during package installation.
还有NuGet ,一个软件包管理工具,该工具可以在动态链接库中跟踪和保存版本和更新,并在软件包安装过程中处理依赖项链。
ASP.NET and Node.js have utterly different processing models.
ASP.NET和Node.js具有完全不同的处理模型。
Being an asynchronous platform, Node.js server handles multiple requests simultaneously and doesn’t block them. While the code is executed in the main thread, it spawns on different threads to perform other tasks. This is a secret to efficient and lightweight solutions even if the app must be heavily loaded with data.
作为一个异步平台,Node.js服务器可以同时处理多个请求,并且不会阻止它们。 在主线程中执行代码时,它会在不同的线程上生成以执行其他任务。 这是高效轻便的解决方案的秘诀,即使该应用程序必须大量加载数据。
On the contrary, ASP.NET is synchronous by nature and has multiple threads which means that every request is processed one by one within its own thread. The drawback here is that in case there are no free threads left for new tasks, they must wait for a free one. What’s more, building more threads isn’t an answer, because it requires a lot of memory.
相反,ASP.NET本质上是同步的,并且具有多个线程,这意味着每个请求都在其自己的线程中一个接一个地处理。 这里的缺点是,如果没有空闲线程可用于新任务,则它们必须等待空闲线程。 而且,构建更多线程不是解决方案,因为它需要大量内存。
Both development environments can boast having active and strong community support which ultimately means it won’t be burdensome to find a solution to the problem. However, keep in mind that .NET has more community support on Stack Overflow whereas Node.js is supported more via GitHub. The best example is the Stack Overflow question and answer website that has around 4 million registered users.
两种开发环境都可以拥有积极而强大的社区支持,这最终意味着找到解决问题的方法不会很麻烦。 但是,请记住,.NET在Stack Overflow上提供了更多社区支持,而Node.js在GitHub上得到了更多支持。 最好的例子是Stack Overflow问答网站,该网站拥有大约400万注册用户。
Node.js runs on multiple platforms and this attribute makes Node.js an attractive platform. Node.js is officially supported by Windows, Linux, macOS, SmartOS, FreeBSD and IBM AIX.
Node.js在多个平台上运行,并且此属性使Node.js成为有吸引力的平台。 Windows,Linux,macOS,SmartOS,FreeBSD和IBM AIX正式支持Node.js。
Being solely Windows platform based before 2018, .NET went through a transformation and now it runs on Linux and macOS too.
.NET是2018年之前的唯一基于Windows平台的平台,它经历了一次转型,现在也可以在Linux和macOS上运行。
Node.js is perfectly designed for distributed systems. Microservices-based software enables components to scale autonomously which prevents an app from falling apart due to its weight. As more and more enterprises prefer to develop the software on top of microservices, Node.js has gained tremendous popularity among businesses like eBay, Netflix, Twitter, Uber, and others.
Node.js是为分布式系统完美设计的。 基于微服务的软件使组件能够自动扩展,从而防止应用因其重量而崩溃。 随着越来越多的企业倾向于在微服务之上开发软件,Node.js在eBay,Netflix,Twitter,Uber等企业中获得了极大的欢迎。
.NET Core is also a very scalable platform. It uses monolithic architecture which means adding more machines will help you to scale up.
.NET Core还是一个非常可扩展的平台。 它使用单片式架构,这意味着添加更多计算机将有助于您扩展规模。
Due to the asynchronous model, Node.js apps have high performance without being too heavy in comparison to other solutions. According to Nodejs.org, 48% of companies identified increased app performance when they switched to Node.js.
由于采用了异步模型,Node.js应用程序具有高性能,而与其他解决方案相比却不会太繁重。 根据Nodejs.org的调查 ,有48%的公司发现切换到Node.js时可以提高应用程序的性能。
However, other tests showcase that ASP.NET has better performance than Node.js.
但是, 其他测试表明,ASP.NET的性能优于Node.js。
There’s no final victory here, as it depends upon the structure and the purpose of the application which leads us back to asynchronous and synchronous processing models.
这里没有最终的胜利,因为它取决于应用程序的结构和目的,这使我们回到异步和同步处理模型。
ASP.NET is definitely a winner in this category. The security and reliability the platform provides make it a great option to create robust software with C# language. Node.js is more reliable for complex enterprise software developed with TypeScript than on its own.
ASP.NET绝对是该类别的赢家。 该平台提供的安全性和可靠性使其成为使用C#语言创建功能强大的软件的绝佳选择。 对于使用TypeScript开发的复杂企业软件,Node.js比单独使用更为可靠。
.NET Core is easier to get it to work and work WELL. It puts you, as a developer, into a certain limits which are very precise, yet very flexible when you approach things in a right way.
.NET Core更容易使其正常运行。 当您以正确的方式处理问题时,它使您(作为开发人员)处于某些限制中,这些限制非常精确,但也非常灵活。
Many big names armed their products with Node.js. Netflix, PayPal,Medium, eBay. Node.js is very popular among start-ups as it allows you to build products faster and cheaper, especially on early stages of the product.
许多知名企业使用Node.js武装他们的产品。 Netflix,PayPal,Medium,eBay。 Node.js在新兴企业中非常受欢迎,因为它使您可以更快,更便宜地构建产品,尤其是在产品的早期阶段。
Dell, Stack Overflow, Intel, Intuit, Cisco, Morgan Stanley, Siemens and many more are using .NET Core for enterprise application development for years.
多年来,戴尔,Stack Overflow,英特尔,Intuit,思科,摩根士丹利,西门子等公司都在使用.NET Core进行企业应用程序开发。
Node.js vs .NET Core? If you know the type of app or software you want to develop it will be easier for you to choose the solution. If you still have doubts, give inVerita a hint and we will help you to make the right decision based on your project requirements.
Node.js与.NET Core? 如果您知道要开发的应用程序或软件的类型,则可以轻松选择解决方案。 如果您仍然有疑问,请给inVerita一个提示,我们将帮助您根据项目要求做出正确的决定。
Originally published at inveritasoft.com on September 8, 2020
最初于 2020 年9月8日 发布在 inveritasoft.com 上
翻译自: https://medium.com/swlh/net-core-vs-node-js-what-should-you-choose-3d7a96cd40
js选择树的节点及子节点
相关资源:纯js的树形菜单(添加删除节点)