Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ What have we learn from the front-end application Nodejs     - EChart simple and practical control on chart (Programming)

- Fedora 20, Fedora 19, CentOS 6 and RHEL6 users how to install Wine 1.7.15 (Linux)

- CentOS 6.6 x64 Oracle Database 11gR2 RAC automated installation scripts (Database)

- MySQL master recovery from failure using binlog (Database)

- How to compare PDF files on Ubuntu (Linux)

- VMware virtual machine to install CentOS 6.2 (Linux)

- Java implementation of stacks and queues (Programming)

- command-line tool for send e-mail (Linux)

- Sshuttle A VPN-based transparent proxy that uses ssh (Server)

- Java memory area Explanation (Programming)

- Iptables small summary (Linux)

- MySQL development common query summary (Database)

- Java development environment to build under Ubuntu (Linux)

- RedHat Performance Tuning (Server)

- Whisker Menu 1.4.3 Install menu Linux (Linux)

- Analysis of potential problems through custom Orabbix monitoring Oracle (Database)

- Android use canvas board painting (Programming)

- Linux system Iptables Firewall User Manual (Linux)

- About Linux iptables firewall interview questions and answers (Linux)

- To configure parameter configuration and software installation and uninstallation under Linux (Linux)

  What have we learn from the front-end application Nodejs
  Add Date : 2018-11-21      
  Will Binns-Smith is a love of full-stack JavaScript engineer, likes to solve real problems through technology. He developed Bonobos.com front-end shopping cart functionality. Will like to work one on one with designers, PC site will be converted to the site for smaller touch devices. Recently, Will wrote an article, which talked about the Node.js practices and characteristics of front-end applications worth studying.

In the Web platform from Node.js learn anything in this article, we explore the benefits created by the developer for developers of small-scale abstract brings. In this article, we come to understand how and why this style of development should be incorporated into your own Web front end.

Choose your own way

As a user of small module, if you do not accept the changes made to rely on, then you can rely on for another. Perhaps the application will use the new version of a module (for example 2.x), while another application is dependent on the use of the old version (for example 1.x). In Node, because dependent lookup is from neighboring node_modules catalog Start, and then step by step up the file system, even if the required number of different versions of the same module, this approach is to meet the demand. If the versions match, then only use one copy.

Browser npm module? It is not Node things?

You may be wondering how can without the use of hundreds of script tag or not RequireJS profile entries using so much so much dependent on the maintenance situation. Maybe you want to know how to use modules from npm browser to easily create SVG elements. And other such modern tools Webpack Browserify and let it become possible, they will be tracked by the same Node CommonJS require statements used in the application dependency graph. They make a large package file module visible to each other, and you will be incorporated in the page, you can come in a single script tag.

Another common problem is that doing so will increase the transmission to the browser JavaScript file size. In the new version of npm, this module tree using a flat form, and will apply to each of the dependent to provide the required version. By this way, you will not need to pass any copies of the library, while meeting the requirements of each module. In addition, there is a more novel called rollup package manager, it uses the ES2015 module format, only a subset of the package you are importing module.

I know a lot of people to put multiple versions of the browser jQuery idea surprised. Yes, some do indeed terror, although made to streamline and gzip compression, but jQuery will still be 30KB in size. However, transfer two, three, or even four 2KB size replica of the library has been insignificant compared to them, in particular able to avoid doing so manually resolve dependencies and upgrade jQuery plug-ins as well as those installed. Even so, you should only be included in the application in a number of modules, and these modules are also dependent on many incompatible modules and the circumstances to do so, because npm 3 by default will try to tie the module catalog. Feel free to use more than 100,000 registered npm modules through a simple installation.

Where the boundaries

We start to understand some of the terminology: the package refers to the npm registry can be published or unit uses the git repository. But CommonJS, the module file is one to one. Therefore, a package can include a plurality of modules, but usually, a npm package is itself a module.

Responsibilities package definition is a most difficult thing. If the scope of the package is too large, then there will be disruptive change, the consequence is the destruction of the ecosystem. Similarly, if a package has many dependencies so disruptive changes and Bug would cause the entire system cascading updates, whether open source or internal use is true. In the scope of the package design, the principle is a good software components cohesion. Essentially, if several components vary together, then they should belong to the same package. If not, then please be extracted!

Remember, with the majority of the aid package manager npm, a packet does not necessarily need a dedicated warehouse. If the burden of excessive Pull Request prevented the release of new modules process, then please consider creating a new repository, also released each packet. Babel is an open source JavaScript compiler, in this way it is maintained in a single repository of more than 100 packages, which greatly enhance the efficiency, but will also be published to each package in the npm.

It is worth noting that a limit (another JavaScript Package Manager) The Bower is that it uses Git repository (or tarballs) as a receiver module code the way, so it needs to create one repository for each package. My suggestion is to use npm.


To build applications by small modules than you think much simpler. Your application may have a lot of abstraction, abstract to determine which should have its own package is actually a very difficult thing. First, if only abstract platform, and to provide general-purpose facade, it is preferable to provide an open-source package. Such as GitHub and Bitbucket and other services are well suited to this, if you are using a browser or Node, then of course you should publish the results of their work to the npm registry. Of course, the ecosystem in other languages ​​also has its own package management solution.

If the application is internal business logic provides a reusable abstraction, such as internal services or API wrapper, then the others in the organization who would benefit from a separate package. In Atlassian, we have a lot of small JavaScript client to access and other reports or analysis services. In addition, there is a general-purpose package, which is used to quickly start Atlassian Connect implementation in new products. For source code management, my advice is not to serve as a basis for each warehouse, so as to create an internal ecosystem composed of many small modules posed. Bitbucket Cloud may change with the size of the team and the horizontal expansion and Bitbucket Server. When publishing packages, npm provided on its cloud service for proprietary modules, and provides a self-hosted services to warehouse management as a source of beneficial supplement. You can even by Bitbucket Cloud Storage module to be easily installed npm: Just Run npm install bitbucket: user / repo can be.

Once you have a lot of small modules, you can iterate their designs, which combined to build a higher level of abstraction. You can fearlessly destroy APIs, because modern tools and semantic version can ensure that consumers are able to choose from, everything will be rapidly evolving. This is the true meaning of the change.
- How to install and configure in Ubuntu 14.10 'Weather Information Indicator' (Linux)
- APT-GET commonly used Linux command (Linux)
- Cobbler batch install Ubuntu / CentOS system (Linux)
- JIRA 3.6.2 Upgrade from older version to the new version 6.0.8 (Linux)
- Ubuntu install Vendetta Online 14.04 (Linux)
- Clojure programming languages: take full advantage of the Clojure plug-in Eclipse (Programming)
- Ubuntu security settings and tools (Linux)
- Linux Network Programming - signal blocking and shielding (block, unblock) (Programming)
- GAMIT10.5 install and update failed Solution (Linux)
- Linux operating system must know the security command (Linux)
- Oracle capability i / o (stress test database server i / o performance) (Database)
- Netcat Example (Linux)
- Python in os.path Magical (Programming)
- SVN hook code set to synchronize Web directory (Server)
- Subquery Oracle study notes (Database)
- Use dump restore mode fast backup and recovery system FreeBSD (Linux)
- Ubuntu 12.04 installation OpenCV2.4.1 and compile test (Linux)
- Install Git on CentOS (Linux)
- MySQL concat function is SQL injection (Linux)
- RedHat6.4 installation tutorial --- Minimal Edition (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.