The Wayback Machine - https://web.archive.org/web/20180608073854/http://java.sys-con.com:80/node/47735

Welcome!

Java IoT Authors: Elizabeth White, Liz McMillan, Zakia Bouachraoui, Pat Romanski, Yeshim Deniz

Related Topics: Java IoT, Linux Containers, SYS-CON MEDIA, IT SOLUTIONS GUIDE

Java IoT: Article

i-Technology Viewpoint: "Spring Good!"

Rick Hightower Gives New Year's Thumbs-Up To Java/J2EE Application Framework

If you have not looked into Spring yet, it is time. Here is why you should!

Grady Booch once said that the great thing about objects is that they can be replaced. The great thing about Spring is it helps you replace them. With Spring, you simply inject collaborating objects called dependencies using JavaBeans properties and configuration files. Then it's easy enough to switch out collaborating objects when you need to. Spring allows you to dynamically add services to objects called aspects. This is similar to the Decorator Design pattern, but does not require you to recompile your code base to apply these services. This allows you to replace objects with objects that enhance the originals.

The ability to inject collaborating objects is often called IoC (inversion of control). Thus, Spring is an IoC container. If you follow the latest developer buzz then you've likely heard of IoC (Inversion of Control) containers and AOP (aspect-oriented programming). Like many developers, however, you may not see where these technologies fit into your development efforts. As the word inversion implies, IoC is like JNDI turned inside out. Instead of using a tangle of abstract factories, service locators, singletons, and straight construction, each object is constructed with its collaborating objects. Thus, the container manages the collaborators. (Collaborators are objects that an object needs to fullfill its role.)

The ability to dynamically add services to objects is called AOP. AOP allows developers to create non-domain concerns, called crosscutting concerns, and insert them in their application code. With AOP, common services like logging, persistence, transactions, and the like can be factored into aspects and applied to domain objects without complicating the object model of the domain objects.

Thus, Spring is an IoC/AOP container. There are many IoC containers. There are also many AOP frameworks. If Spring was only an IoC/AOP container, it would be worth your attention and interest since it seems to be the most mature. Spring is a lot more than an IoC/AOP container.

What makes Spring different than the other frameworks and containers, is Spring goes beyond just being an IoC container or an AOP framework. The other containers are academic interests, and some are quite good. They provide good support of IoC and AOP.

Spring goes one step further by eating its own dog food. It uses IoC and AOP to provide a comprehensive library for simplifying J2EE development. This comprehensive library is written with aspects, dependency injection and OOP best practices.

Spring makes J2EE development easier. It does this with a variety of mechanisms. One common mechanism is its use of templates. A template is a cross between a utility class and execution environment. Spring Templates are an embellishment and extention of the Template design pattern (GOF).

At first glance templates appear to be well written utility classes. However, templates provide a lot more than just utility functions. Templates provide and execution environment. When using a template you first endeavor to use one of its it utility method. If the template doesn't have a utility method you need, you implement a callback object. The callback object has a method that executes a method in the environment of the template. The template therefore takes care of things like exception handling and resource management in a consistent manner. This means your code base will not be littered with try/catch/finally blocks, and it is easier to ensure that resources and exception are handled correctly.

Spring promotes good programming practices. It does this by providing great examples how to use IoC and AOP in a consistent manner. It also does this by showing how to build things like templates to manage resources and exceptions in the consistent manner. It goes even further by building sets of frameworks on top of  IoC, AOP and templates that are the embodiment of good OO programming.

The IoC capabilities allowing injection of dependent objects turns out to be a great mechanism for testing your code. It is easy now to inject mock objects (object for testing), and test your classes in an isolated manner. For example, you can test you business delegates without relying on the DAO (Data access objects) objects talking to the database. Essentially Spring took back development from the design pattern hacks deemed necessary to program J2EE. As Rod Johnson once put it: Spring puts the OO back in J2EE development.

Spring provides portability through abstraction of common services. For example, Spring provides a common interface object relational management (ORM) systems like Hibernate, JDO, Cayenne, Spring JDBC and iBatis. It provides a mechanism for building DAO objects that divorces the client code from the underlying implementation. it does this by providing a common set of exceptions like object not found exception, and making these exception runtime exceptions.

Spring provides a easy on-ramp for many industry-standard projects. And not just industry-standard projects but the de facto industry-standard projects. The projects that people actually use to get their daily work done. For example, Spring provides support for JDO, Hibernate, Quartz, Tapestry, JavaServer faces, and many more frameworks. Its been said that Spring simplifies J2EE development, and that is a primary focus of Spring. However,Spring provides utilities to work with all tiers of an n-tier application. For an MVC application, there are utilities for working with View technologies (Struts, Spring, Rich Client etc.), Model (EJB, AOP based transaction, AOP based security, etc.), etc. You can use Spring to build Swing and SWT applications.

If you have not looked into Spring yet, it is time.

------------------------------------------------
The above started as a reply to Cameron Purdy's prediction list, which I really liked. Then I got carried away and it became a full blown plug for Spring. (Darn Caffiene!)

What is Spring?

Spring is a popular AOP/IoC framework that was developed by Rod Johnson, Juergen Hoeller et al. Spring simplifies J2EE and Java development. Rod Johnson is the famed author who wrote Expert One-on-One J2EE Design and Development.

Spring makes J2EE development easier. Spring is a J2EE framework that simplifies commons tasks and encourages good design based on programming to interfaces. Springs makes your application easier to configure and reduces the need for many J2EE design patterns (quite a few J2EE design patterns are really glorified hacks that clutter your code base). Spring puts the OO design back into your J2EE application.

More Stories By Rick Hightower

Rick Hightower serves as chief technology officer for ArcMind Inc. He is coauthor of the popular book Java Tools for Extreme Programming, which covers applying XP to J2EE development, and also recently co-authored Professional Struts. He has been working with J2EE since the very early days and lately has been working mostly with Maven, Spring, JSF and Hibernate. Rick is a big JSF and Spring fan. Rick has taught several workshops and training courses involving the Spring framework as well as worked on several projects consulting, mentoring and developing with the Spring framework. He blogs at http://jroller.com/page/RickHigh.

Comments (4) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
Rick Hightower 01/08/05 06:26:10 PM EST

The article (like the last one I wrote) started out as being a blog entry (http://jroller.com/page/RickHigh/20050107#spring_plug).

It is nice when the JDJ picks it up and gives it more exposure. The last blog entry turned article I wrote was read quite a bit according to the JDJ folks.

I've written some follow up ideas at:

http://www.arc-mind.com/papers/springIsGood.html

Rick Hightower 01/08/05 05:53:57 PM EST

I've used Spring on a half dozen different projects now (most if not all of them in production).

The first time I used Spring I was amazed how much it helped to simplify the code base.

Once you get rid of all of the service locators, and dynamic creation of implementations, and singletons, etc. then the code base gets a bit smaller.

Also using the Spring templates really helps to keep things simple and yet manage resources well.

I much prefer using Hibernate with Spring then without it. It really simplifies things.

Agreed 01/08/05 05:20:08 AM EST

Spring manages your mappings and helps maintain consistency across your data connections and helps you abstract your business logic, keeping it out of the actual pages. Best of all it also integrates with Struts.

Spring has sprung 01/08/05 05:04:16 AM EST

Wasn't it Purdy who said it's imposible to resist saying the word Spring. ("Yup, it's like trying not to think of pink elephants - impossible once you get that in your head. Spring, spring, spring, spring. La tee dah, spring spring spring.")

What's in a name?

IoT & Smart Cities Stories
Founded in 2000, Chetu Inc. is a global provider of customized software development solutions and IT staff augmentation services for software technology providers. By providing clients with unparalleled niche technology expertise and industry experience, Chetu has become the premiere long-term, back-end software development partner for start-ups, SMBs, and Fortune 500 companies. Chetu is headquartered in Plantation, Florida, with thirteen offices throughout the U.S. and abroad.
Headquartered in Plainsboro, NJ, Synametrics Technologies has provided IT professionals and computer systems developers since 1997. Based on the success of their initial product offerings (WinSQL and DeltaCopy), the company continues to create and hone innovative products that help its customers get more from their computer applications, databases and infrastructure. To date, over one million users around the world have chosen Synametrics solutions to help power their accelerated business or per...
DXWorldEXPO LLC announced today that All in Mobile, a mobile app development company from Poland, will exhibit at the 22nd International CloudEXPO | DXWorldEXPO. All In Mobile is a mobile app development company from Poland. Since 2014, they maintain passion for developing mobile applications for enterprises and startups worldwide.
DXWorldEXPO LLC announced today that ICC-USA, a computer systems integrator and server manufacturing company focused on developing products and product appliances, will exhibit at the 22nd International CloudEXPO | DXWorldEXPO. DXWordEXPO New York 2018, colocated with CloudEXPO New York 2018 will be held November 11-13, 2018, in New York City. ICC is a computer systems integrator and server manufacturing company focused on developing products and product appliances to meet a wide range of ...
The challenges of aggregating data from consumer-oriented devices, such as wearable technologies and smart thermostats, are fairly well-understood. However, there are a new set of challenges for IoT devices that generate megabytes or gigabytes of data per second. Certainly, the infrastructure will have to change, as those volumes of data will likely overwhelm the available bandwidth for aggregating the data into a central repository. Ochandarena discusses a whole new way to think about your next...
If a machine can invent, does this mean the end of the patent system as we know it? The patent system, both in the US and Europe, allows companies to protect their inventions and helps foster innovation. However, Artificial Intelligence (AI) could be set to disrupt the patent system as we know it. This talk will examine how AI may change the patent landscape in the years to come. Furthermore, ways in which companies can best protect their AI related inventions will be examined from both a US and...
Enterprises have taken advantage of IoT to achieve important revenue and cost advantages. What is less apparent is how incumbent enterprises operating at scale have, following success with IoT, built analytic, operations management and software development capabilities - ranging from autonomous vehicles to manageable robotics installations. They have embraced these capabilities as if they were Silicon Valley startups.
The Internet of Things will challenge the status quo of how IT and development organizations operate. Or will it? Certainly the fog layer of IoT requires special insights about data ontology, security and transactional integrity. But the developmental challenges are the same: People, Process and Platform and how we integrate our thinking to solve complicated problems. In his session at 19th Cloud Expo, Craig Sproule, CEO of Metavine, demonstrated how to move beyond today's coding paradigm and sh...
Digital Transformation and Disruption, Amazon Style - What You Can Learn. Chris Kocher is a co-founder of Grey Heron, a management and strategic marketing consulting firm. He has 25+ years in both strategic and hands-on operating experience helping executives and investors build revenues and shareholder value. He has consulted with over 130 companies on innovating with new business models, product strategies and monetization. Chris has held management positions at HP and Symantec in addition to ...
The hierarchical architecture that distributes "compute" within the network specially at the edge can enable new services by harnessing emerging technologies. But Edge-Compute comes at increased cost that needs to be managed and potentially augmented by creative architecture solutions as there will always a catching-up with the capacity demands. Processing power in smartphones has enhanced YoY and there is increasingly spare compute capacity that can be potentially pooled. Uber has successfully ...