Comparison of libraries and frameworks "translation"

Source: Internet
Author: User

Original: http://www.programcreek.com/2011/09/what-is-the-difference-between-a-java-library-and-a-framework/


Both the original and the translation are only references, if not, please correct me.


What is the difference between a library and a framework? Both of these concepts are important, but sometimes they confuse Java developers.

1. Differences between libraries and frameworks and their respective definitions
Their main difference is in "control inversion". When you call a method from the library, control is on your hand. But when you use the framework, control is reversed, and the framework calls your code.

A library is just a collection of some class definitions. The idea behind this is simple code reuse, such as calling code that other developers have already written. These classes and methods are usually defined in a specific area of the specified operations, such as some mathematical operations library, developers do not have to re-implement the algorithm, directly call the inside of the method can be.


In the framework, all the control processes have been defined, and you just need to fill in some of the predefined blanks with your own code. The framework is more complex than the library, it defines the skeleton, and the application fills the skeleton with its own defined features. This way the framework will call your code at the right time, so the benefit is that the developer doesn't have to worry about the design, just implement the function of the specified domain.

2. Links to libraries and frameworks
They all need to define APIs that are easy for programmers to use. Connecting these, we can think of the library as a function of the program, the framework as a skeleton of the program, and the API is a connector that connects these. A typical development process begins with a framework, followed by a function in the implementation API.

Comparison of libraries and frameworks "translation"

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.