➤ How to Code a Game
➤ Array Programs in Java
➤ Java Inline Thread Creation
➤ Java Custom Exception
➤ Hibernate vs JDBC
➤ Object Relational Mapping
➤ Check Oracle Database Size
➤ Check Oracle Database Version
➤ Generation of Computers
➤ XML Advantages & Disadvantages
➤ Advantages of Open Source Software
➤ How to read and display .class file version
➤ Java Program Without Using User-defined Class
In this post, we will see what are invasive and non-invasive technologies and frameworks? Why some technologies/framework can be called invasive or non-invasive. What are examples of invasive and non-invasive technologies/frameworks developed in the Java programming language?
The Java technologies or frameworks can be categorizes in two types,
1) Invasive technologies/frameworks
2) Non-invasive technologies/frameworks
Let us see the invasive and non-invasive technologies/frameworks developed in the Java programming language in detail.
While developing any technology/framework based application, if the classes of the application are forced to implement technology/framework API given interfaces or forced to extend technology/framework API given specific classes then that technology/framework is called invasive technology/framework.
There is a restriction of making application classes implementing or extending from technology/framework given API interfaces/classes. Therefore, application classes are tightly coupled with technology/framework given API, it means we can’t move these classes to other technology/framework to reuse their logic.
Example:- we are developing Servlet based application. To develop servlet based applications, the class must extend GenericServlet or HttpServlet class. The GenericServlet or HttpServlet classes are given in the Servlet API. Therefore our application is an invasive application, and we are forced to extend our application classes from GenericServlet or HttpServlet.
Limitation of invasive technology/framework:- Once we develop application classes for invasive framework or technologies then they must be used in that framework/technology forever. We can’t move to another technology/framework. Suppose we had developed our application using Servlet technology, and later a better Java technology came to develop web application then we can’t move to that technology. Our application classes are not normal classes, they are heavy classes having links with Servlet API. Forever we must use that application with Servlet or develop another application with new technology from the scratch. Once we have chosen an invasive technology/framework to develop our application, we must stay with those technologies/frameworks until the end.
Examples of invasive Java technology:- JDBC, Servlet, EJB (outdated), and e.t.c. Example of invasive Java framework:- Struts (now outdated).
There are many reasons why EJB technology and Structs framework are outdated, but invasive nature was also the major reason. Similarly, there are many reasons why Servlet is not great in many aspects, but invasive nature is also the major reason. Currently, there is no better alternative to Servlet/JSP technology.
While developing classes for technology/framework based application, if there is no restriction of making those classes implementing or extending from technology/framework API interfaces/classes then that technology/framework is called non-invasive technology/framework.
Here application classes are loosely coupled with technology/framework given API, it means we can move these classes to other technology/framework to reuse our application logic. Once we develop application classes for non-invasive framework or technologies then they must be moved and used in any similar framework/technology.
How is it happing? Generally, non-invasive frameworks are the implementation of common API. If we develop our application by using that common API, then we can move to other frameworks that are implementing that common API. Example:- JPA is a specification to develop Java persistence logic, there are many frameworks that implements JPA. If we develop our application based on JPA, then we can use any framework which implements JPA.
Examples of non-invasive Java frameworks:- Hibernate, Spring, JSF, and e.t.c. As of now, there is no non-invasive Java technology.
If you enjoyed this post, share it with your friends. Do you want to share more information about the topic discussed above or you find anything incorrect? Let us know in the comments. Thank you!