A terminology question appeared when I was comparing EJB 3 and Spring.
Wikipedia says that
Enterprise JavaBeans (EJB) is a managed, server-side component
architecture for modular construction of enterprise applications.
and also
The Spring Framework is an open source application framework and
inversion of control container for the Java platform.
“EJB 3 in Action” suggests that
Together, the components, or EJBs, and the container can be viewed as
a framework that provides valuable services for enterprise application
development.
Is any framework an architecture? If not, what is the difference between these terms? Could EJB be considered a framework?
1
An architecture is the the abstract design concept of an application. Basically, a structure of the moving parts and how they’re connected.
A framework is a pre-built general or special purpose architecture that’s designed to be extended.
If an architecture is the design of a structure, a framework is the architecture of a foundation. Frameworks are specifically designed to be built on or extended.
Some frameworks deal primarily with scaffolding. Meaning, they provide pre-built modules that are easy to use/extend to save the developer from having to create them from scratch. For instance, most MVC web frameworks (ex django, pylons, codeigniter) make it much easier to implement sessions, database connections, templating, etc…
Other frameworks deal primarily with augmenting the capabilities of the language itself, filling in what some may consider to be ‘missing pieces’. They add features that come from other languages, synctatic sugar, or extend the language. The Underscore lib is a perfect example of this. It doesn’t do much to assist in building applications, it’s primary purpose is to extend the core functionality of javascript.
Some frameworks exist to add new features to a language, or re-hash existing capabilities in a new way. For instance, jQuery took the — previously painful — process of querying the HTML DOM and made it trivial. They also provided a means to write cross browser compatible AJAX requests. While jQuery appears to add a new style of syntax, behind the scenes it runs on vanilla JavaScript. AngularJS is another framework that leverages JS/HTML in new and interesting ways using vanilla JS.
In your case. Spring and EJB are both scaffolding MVC frameworks, each with their own trade-offs.
Generally speaking, architecture is an abstract plan that can include design patterns, modules, and their interactions. Frameworks are architected “physical” structures on which you build your application.
Your architecture may incorporate multiple frameworks. And multiple layers of framework. At each layer, the “architecture” is the oft-documented “thinking” from which the layer is built. The frameworks are the “physical” components used to build it.
When you call a target environment an “architecture”, you’re referring to the design implications on your software. When you call it a “framework”, you’re referring to the functionality it gives you.
In software, a Framework is a software module or set of modules that supports a generic programming concept by abstracting common functionality (code in a software sense) into a reusable format.
An Architecture is an assembly of systems that solves business needs. According to TOGAF
The definition of an architecture used in ANSI/IEEE Std 1471-2000 is:
“The fundamental organization of a system, embodied in its components,
their relationships to each other and the environment, and the
principles governing its design and evolution.”
In itself TOGAF is a framework because it abstracts the reusable parts of architecture into a reusable format. It does so through documentation instead of code.