Introduction To Java Frameworks


Generally, framework can be defined as a real or conceptual structure intended to serve as a support or guide for developing or building of something that results in something useful or meaningful.

In the world of computer systems, a framework can be considered as the layered structure suggesting what kind of program can or should be built and how they would interrelate to provide something fruitful. Sometimes frameworks also include actual programs, specify programming interface, or provide programming tools for using the frameworks.

More precisely, a software framework is a huge prewritten program which can be used to add in our program or code to solve a specific domain problem. Actually, framework uses our code because it is usually the framework that is in control. We can make use of a framework by calling it ‘method’, ‘inheritance’ and supplying ‘callbacks’, listeners or other implementations of observer types.

A framework is a collection of software libraries or components which provide a defined application programming interface (API).

The framework is having such key features that can differentiate a framework from libraries we are talking about. The key features are as following:

  • Inverted flow of control:

    A framework employs an inverted flow of control between itself and its clients. When using a framework, we usually just implement a few callback functions or specialize a few classes, and then invoke a single method or procedure. At this point, the framework does the rest of the work for us, invoking any necessary client callbacks or methods at the appropriate time and place. This is why frameworks are often said to abide by the Hollywood Principle ("Don't call us, we'll call you.") or the Greyhound Principle ("Leave the driving to us.").

  • Extensibility:

    A framework can be extended by the user usually by selective overriding or specialized by user code providing specific functionality.

  • Non-modifiable:

    Generally, a framework code is not allowed to be modified. Users can only extend the framework, but cannot modify it.

Frameworks are of different kinds depending upon the need of the problem. They are component, development, domain, services, conceptual, application, platform, etc. If we see it more precisely then have a look a the below table.

Java GUI frameworksSWT, AWT, JavaFX
ORM frameworkHibernate
Web frameworksSpring, Struts, Play
View frameworksApache Wicket, JSF, JTwig
Big Data/ETL frameworksApache crunch, Apache Hadoop, Apache Spark

Use of frameworks

A framework is very helpful in building complex applications because it often dictates the structure of the application program. Some frameworks even supply so much code that you need to do very little to write or complete your task. This can be good or bad, depending on how easy it is to use in different domain problems.

By Wil Shipley:

“Frameworks are the substance of programming. You build on top of a good one, your program is solid and fast and comes together beautifully. You build on top of a bad one, your life is miserable, brutish, and short.”

Frameworks in Java

In Java technology, plenty of frameworks are there which can be used by the programmers or developers to build the complex applications of programs. The frameworks in Java are like ‘Hibernate’, ‘Spring’, ‘Struts’, etc.


In Java, a very common example of frameworks is GUI frameworks such as Java Swing and AWT classes. As they have a big bundle of code to manage the user interface, and there is an inverted flow of control, because we start the GUI framework and then wait for it to call our listeners for further processing.

Sometimes the Collections classes are also called as a framework, perhaps largely because of the size and complexity. But it is actually referred to as a library because there is no inverted flow of control as our programs simply call methods in these predefined or extended classes to get the further response.

That’s all for the introduction part of framework. We will further move to learn a framework – Hibernate - in the next part of this article.

Thank you, keep learning and sharing.

Read more articles on Java: