A framework is a group of cooperating classes that constitute a reusable design for a specific type of software. The framework specifies the application architecture, which defines the overall structure, the division of classes, and objects, the main responsibilities of each department, how classes and objects collaborate, and the control flow. The framework predefines these design parameters. In order to allow application designers or implementers to focus on the details of the application itself, the framework places more emphasis on design reuse.
It can be seen from its definition that a framework refers to the low-level code that has been implemented by others. To a certain extent, it is also a layer of abstraction of the problem, making it Developers do not have to consider everything or rewrite everything when developing, so that developers can focus on writing professional business logic, which is easy to test and saves development time.
So, this is The framework is required to have good correctness, fault tolerance, ease of use and operating efficiency. Programming using frameworks is a popular modern programming method. For example, applications under the .NET platform and JAVA platform are all based on framework programming. More What makes people happy is that even JavaScript client programming has several frameworks. One of the more classic ones is the currently popular jQuery framework.
Framework programming is a good programming idea, both It simplifies programming and ensures the correctness of the program. Therefore, it is necessary to establish your own framework in projects or team development.
For example, Spring framework:
Spring's goal is to simplify Java development in all aspects. This will inevitably lead to more explanations. How does Spring simplify Java development?
In order to reduce the complexity of Java development, Spring has adopted the following four key strategies:
Lightweight and minimally intrusive programming based on POJO;
Achieve loose coupling through dependency injection and interface orientation;
Declarative programming based on aspects and conventions;
Reduce boilerplate code through aspects and templates.
Almost everything Spring does can be traced back to one or more of the above strategies.
Spring perfectly fulfills its promise, which is to simplify Java development.
POJO
Spring strives to avoid cluttering your application code with its own API. Spring does not force you to implement Spring specification interfaces or inherit Spring specification classes. On the contrary, in applications built on Spring, its classes usually have no trace that you use Spring. The worst scenario is that a class may use Spring annotations, but it is still POJO
Dependency Injection
Any application with practical significance (certainly better than Hello World examples are more complex) and will consist of two or more classes that collaborate with each other to complete specific business logic. According to the traditional approach, each object is responsible for managing references to the objects it collaborates with (that is, the objects it depends on), which will lead to highly coupled and difficult-to-test code.
Application Aspects
DI can keep cooperating software components loosely coupled, while aspect-oriented programming (AOP) allows you to integrate aspects throughout the application. Separate functionality into reusable components.
The above is the detailed content of What is the use of learning Java framework well?. For more information, please follow other related articles on the PHP Chinese website!