Introduction to Java Frameworks

Should I use a Java framework: image of a man thinking with a tick and a cross and a question mark above his head.

I’ve been teaching Java since version 1.0 (yup, I’m that old!), and had been programming for many years before that. When I was younger, I’d hunt for the newest versions of the latest and supposedly greatest languages and tools. I’d want to program everything from scratch too. In my defence, open source software didn’t exist and reusable language libraries were as rare as hen’s teeth.

The more I learned about programming, the more I longed for good, easy-to-use libraries. I got tired of being burnt by the latest versions of development tools that were still riddled with bugs.

Moving to Java was an eye-opener! Here was a portable, platform-independent language with some great libraries. In the early days, the Java API contained just over 200 classes, but it felt like manna from heaven. Since then the APIs have mushroomed in size to well over 4000 classes in Java SE 8.

With all these classes at hand, we can develop a wide variety of applications in Java. On top of the standard library classes, there are countless open source and proprietary libraries to add extra functionality.

Even with all these building block classes, we’re still faced with developing programs in much the same way as we build Lego models — one block at a time. This is regarded as boilerplate code — tedious, repetitive, boring and error-prone.

Surely there must be an easier way? Fortunately, there is: we can use a framework.

What is a Framework?

A framework is a set of well-designed, interoperable classes that provide elegant solutions to common problems within a specific domain.

Domains are areas of interest or concern. If we have to develop a web-based application, that’s a specific area of interest with specific problems we need to address. Interfacing to databases or messaging systems are other domains that have their own problems and own good solutions.

Now we don’t need to build boilerplate Lego code. Instead, we can use framework components that are designed to work together, and they can do the heavy lifting for us.

Pros and Cons of Frameworks

Why do we need a framework at all? It isn’t absolutely necessary to use a framework when developing our applications. But there are some good reasons to use one. Frameworks will:

  • Help us focus on the business requirements of our application instead of all the infrastructural code.
  • Leverage specialist knowledge of domains. We can’t be experts in every problem area.
  • Combine years of experience in the form of design patterns.
  • Lower the time to market for our application.
  • Lower the cost of application development.
  • Help us follow industry standards.
  • Avoid re-inventing the wheel.

Using a framework has some disadvantages too. Frameworks will:

  • Force us to write our application in a specific way which follows the framework’s architectural approach.
  • Tie us to a specific version of the framework libraries.
  • Tie us to a vendor (if the framework is proprietary).
  • Increase the size of our application. The framework code adds to the footprint.
  • Increase the complexity of the application.
  • Require a longer learning curve.

Conclusion

There are no silver bullets when developing software. Choosing to use a framework or not is certainly no exception to that. And even when we decide to use a framework, which one do we choose?

Next week, we’ll look at some Java frameworks, and I’ll give you my opinion.

Until then, stay safe and keep coding!

Leave a Comment

Your email address will not be published. Required fields are marked *

Code like a Java Guru!

Thank You

We're Excited!

Thank you for completing the form. We're excited that you have chosen to contact us about training. We will process the information as soon as we can, and we will do our best to contact you within 1 working day. (Please note that our offices are closed over weekends and public holidays.)

Don't Worry

Our privacy policy ensures your data is safe: Incus Data does not sell or otherwise distribute email addresses. We will not divulge your personal information to anyone unless specifically authorised by you.

If you need any further information, please contact us on tel: (27) 12-666-2020 or email info@incusdata.com

How can we help you?

Let us contact you about your training requirements. Just fill in a few details, and we’ll get right back to you.

Your Java tip is on its way!

Check that incusdata.com is an approved sender, so that your Java tips don’t land up in the spam folder.

Our privacy policy means your data is safe. You can unsubscribe from these tips at any time.