Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ What have we learn from the front-end application Nodejs     - MySQL script incremental backups (innobackupex) (Database)

- Dalvik heap memory management and recycling (Linux)

- Ubuntu 15.10 install the latest Arduino IDE 1.6.7 (Linux)

- Update GAMIT10.6 command (Linux)

- SQLite3 simple operation (Database)

- HBase Application Development Review and Summary of Series (Database)

- Oracle Incident Packaging Service (Database)

- How to install Nginx on FreeBSD 10.2 as an Apache reverse proxy (Server)

- Comparison of one-time transaction and CTE insert data (Database)

- ARP spoofing prevent Linux environment LAN (Linux)

- Install Oracle JDK 8 and JVM class loading mechanism in Linux (Linux)

- Glibc support encryption by modifying the DNS (Programming)

- Oracle Database Delete Delete million or more common method of heap table data (Database)

- Android development environment to build under Fedora 13 (Linux)

- Binary tree to the next node (Programming)

- Linux command -nohup & (Linux)

- Use HttpClient remote interface testing (Programming)

- Oracle RAC node on the expulsion of the inspection process on OEL6.3 (Database)

- Linux operating system, the internal and external security overview (Linux)

- How to modify the Sublime in Tab four spaces (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.
- init level settings for Linux / etc / inittab file into six (restart) or does not support the level of solution (Linux)
- Linux Regular expressions grep and egrep (Linux)
- Windows Desktop use VNC remote connect Linux (Linux)
- Go build the locale under Windows (Linux)
- Linux and Windows Security Topics (Linux)
- Category prevent DoS attacks against Linux (Linux)
- CentOS 5.x install Lua 5.2.3 error (LIBS = -lncurses) (Linux)
- C ++ handling text input (Programming)
- Debian 7 and Debian 8 users how to install Oracle Java 8 (Linux)
- Troubleshooting Linux virtual machine device id and the letter of inconsistencies (Linux)
- Use value type build better applications Swift (Programming)
- How to install Laravel PHP framework on CentOS 7 / Ubuntu 15.04 (Server)
- Android timer use (Programming)
- How to create a cloud encrypted file system in Linux systems (Linux)
- ISO image to use offline upgrade Ubuntu (Linux)
- Actual SSH port forwarding (Linux)
- The callback function used in C ++ (Programming)
- Wildcards and special symbols usage comments under Linux (Linux)
- Linux system security infrastructure Highlights (Linux)
- Save the database data files into Oracle Learning (Database)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.