Semi-static language-principle and value analysis

Source: Internet
Author: User

Introduction

Dynamic type languages are widely used in enterprise development and the Internet, such as Ruby, Velocity, Python, and so on. The dynamic type language performs type inference at run time, is executed in an explanatory way, the modification is effective, the development flexibility is high, and static type language (such as: java,c/c+/c++) performs type checking before execution, needs compiling to run, and is not flexible for the development of Internet front-end.

Therefore, many large-scale Internet stations choose Freemarker, velocity such as dynamic template language as the page development language, to some extent, to meet the needs of the front-end agile development.

However, for large e-commerce sites, not only has the common Internet demand for frequent changes in the characteristics of a more prominent feature is a wide range of business, business model and business relationship is complex. Therefore, Velocity development has also encountered some problems in the development of such applications.

Front-End template development issues

Reduce software Quality

Velocity is a weakly typed dynamic language at runtime to check out type errors. Because of the characteristics of dynamic type, some errors can inspire the execution path when encountering certain parameters, and the software quality can not be guaranteed well.

High test cost

Due to the inability to perform type checking before running, as in static languages, the software has a long test cycle and high test costs.

Development is not agile

Lack of some agile development features such as real-time validation in the IDE, code hints, code refactoring, and so on. Although the modification is effective, it is less efficient for enterprise-level development.

Poor maintenance

For a large system, it is not possible to know which velocity templates are affected when refactoring a business model (Java model) or code, and it often takes a lot of time to search for related templates and then modify and test them. For example: The author of a company's basic product upgrades, due to the number of affected templates, refactoring complex, the project evaluation of thousands of business.

The inherent disadvantages of these dynamic languages are very prominent in enterprise-class and large-scale Web applications, which seriously affect the quality of development and the efficiency of development. Therefore, it is urgent to develop a new high quality and high efficiency technology.

The advantages of static language

After a comprehensive consideration, we find that the greatest advantage of dynamic type language (dynamically Language) "explain how execution and change takes effect" is still not to be discarded. You must start with a problem and find a smooth line to solve the problem.

In the face of these problems, we can not help but praise the advantages of Java:

Static syntax and static type realtime checks.

If the assignment type does not match, the method does not exist, and the parameter type error information can be displayed immediately in the IDE;

Code hint:

Call properties, methods can be code hints, development is very efficient;

Code Hot Links:

Link to the corresponding Java class through variable and class name heat;

Code refactoring:

When you modify a Java class, the affected Java code is validated in real time, with a red error appearing immediately; more powerful refactoring, Java classes, method sensitivity renaming, and automatically modifying references to it in all relevant code.

These advantages of statically typed languages such as Java are the way to solve the problem. So why can't dynamic languages do this? The reason is that the fundamental feature of a dynamic language is that the variable has no type (that is, a weak type feature), and the type is inferred at run time, which makes it impossible for type checking in the development phase.

So how do you combine the advantages of a dynamic and static language? The answer is the semi static language.

Semi-static language (semi-static Language)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.