liveBook · Manning

Framework

As explained in Spring Start Here, Second Edition

A software framework is a reusable foundation of components, conventions, and extension points for developing software.

A framework is a pre-built software foundation with a predefined structure and an opinionated architecture. It supplies common functionality so you can focus on the logic specific to your application rather than writing everything from scratch. You choose the framework features that fit your requirements. section 1.1

A framework differs from a library in how control flows. Your code calls a library for a particular task; a framework provides a larger application structure and often calls your code. section 1.1

Figure 1.1 David ordered a wardrobe from the UAssemble store. But the store (framework) doesn’t deliver to David (the programmer) just the components (software capabilities) he needs to build his new wardrobe (the app). The store ships him all the possible parts he might need to build the wardrobe. It’s David’s (the programmer’s) choice on which components (software capabilities) are right and how to assemble them to get the right result (the application).

The furniture analogy shows why choosing framework components matters: the available parts can support many different applications, not just the one you want to build. section 1.1

Spring is an application framework for the Java/JVM ecosystem. It can support backend applications, testing tools, and other software. Spring is also an ecosystem of projects, including Spring Core, Spring Data, and Spring Boot. section 1.0 section 1.7

A framework is not automatically the right tool. Consider its purpose, alternatives, maturity, and community, as well as the needs of your application. section 1.7 section 1.4

Consider avoiding a framework when:

  • The application needs the smallest possible storage footprint, or security requirements mandate custom code. section 1.4
  • Customizing its components would require more code than building the functionality without it. An alternative framework may fit better. section 1.4.3
  • A working application would gain no meaningful benefit from switching. Weigh potential improvements in maintainability, performance, or security against the cost and uncertainty of change. section 1.4.4

Replacing database code

An application using JDBC to query an Oracle database had repetitive code. Hibernate offered an alternative: treating database tables and relationships as objects and relationships. Used correctly, it can reduce code; misused, it can make an application slower, less intuitive, or buggy. A switch therefore needs a clear benefit, not just a popular tool. section 1.4.4

How Spring Start Here, Second Edition covers it

How deep it goes
Defines frameworks, contrasts them with libraries, and examines selection and migration trade-offs without implementing a framework.
Examples
Uses a furniture-assembly analogy and a JDBC-to-Hibernate migration scenario to illustrate component selection and trade-offs.
What you can do after
Evaluate whether a framework fits an application and whether switching a working application offers a meaningful benefit.
How it connects
Connects frameworks to libraries, inversion of control, business logic, and application architecture.

Also explained in

Compare how 8 books explain framework →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring Start Here, Second Edition. The section links point to the parts of the book it draws on.