5 Java frameworks to build scalable web applications

Posted on December 18th, 2019

Java is one of the most popular programming languages in 2019, a favorite of more than 7.6 million developers worldwide. Java is not usually associated with web development, but there are some excellent Java web frameworks available for web developers.

Java frameworks for web development simplify the build process by eliminating the need to write basic code like exception handling. As a result, business logic becomes the main focus for developers. 

If you have some experience with Java, you can get started quickly. In this article, we’ll review the 5 best Java web frameworks for 2019, and explain how to stack them.

1. Spring Framework

The Spring Framework is one of the most popular Java frameworks. It has a big ecosystem and a vast community around it. Spring allows you to develop enterprise-level Java web services, applications and microservices.

Developers use the Spring Framework for common programming tasks like data processing, security, and messaging. The modularity of the tools enables you to write clean and accessible code. The active Spring community provides help and answers question regarding how to do certain things or how things work.

Main Features:

  • Excellent documentation and multiple tutorials.
  • Huge ecosystem and community.
  • Enhanced modularity to improve the readability of code.
  • Simplified injection to test data through POJOs (Plain Old Java Objects) simplifies the codebase and makes it more flexible.

Downside: Spring is a complex Web Framework and if you are new to Java programming, then this probably isn’t the best choice for you. Spring requires a lot of prerequisite knowledge, and this makes the learning curve steep.

2. JavaServer Faces (JSF)

JavaServer Faces (JSF) is a framework for building Java web applications, developed by Oracle. It comes with in-depth, complex documentation

Developers use the JSF framework to build UIs of reusable components, manage the state of your components, connect components data sources, and bind user-generated events to event handlers on the server side.

Facelets is the default templating system of JSF, it was created especially for this project. Facelets allows you to use XML instead of Java for view handling. Other technologies such as XUL and plain Java allow you to create views. Web applications created with JSF are portable across different Java EE application servers as well.

Main Features:

  • Oracle provides support for the code base.
  • High-quality documentation.
  • Reliable and stable framework.
  • Official standard, part of the Java Community Process (JCP) program.
  • Extensive set of tools and ecosystem. 

Downside: Non-JSF and JSF components can’t work together, as non-JSF components don’t acknowledge the stages of the JSF process.

3. Struts

Struts is an open-source MVC framework created by the Apache foundation. It’s a reliable platform with a large and supportive community. Java developers use Struts to create Java applications that are easy to maintain.

It is based on the MVC design fundamentals and has an architecture based on plugins. Struts plugins are basic JAR files that help extend the Struts framework to address different project needs. Some plugins such as the REST plugin, JSON plugin, and Config Browser Plugin are included in the MVC framework 

You can perform tasks that are not built into the framework by integrating with other Java frameworks. For example, for object-relational mapping you can use the dependency injection Spring plugin. Developers use to build the front-end applications using the different Struts client-side technologies, such as HTML with Angula or JavaServer Pages.

Main Feature:

  • Exists since 2006, which makes it stable and free of bugs. 
  • Works well with SOAP, REST, and AJAX.
  • Allows modular development and integration with additional components.
  • Supports templates and themes.
  • Uses simple Plain Old Java Objects.

Downside: The Struts framework isn’t flexible, which means you need to get used to a specific set of rules regarding web application development and design. Developers tend to use a specific methodology they are already familiar with, and Struts requires them to use another set of rules.

4. Play!

The Play Framework is reactive and lets you develop scalable Java and Scala web applications. It addresses the problems of other Java frameworks, such as a steep learning curve, complicated architecture, and slow development cycles. 

Play improves developer productivity by offering features like hot code reloading, error messages in the browser and convention over configuration. Play provides a reactive system that follows modern web development principles like responsive images, resilient, elastic, and message-driven design.

Main Feature:

  • Improves developer productivity.
  • Quickly updates configuration changes, templates and java code.
  • There are no no Java Enterprise Edition sessions, all connections are stateless.
  • Can handle error in dev mode for runtime and compile errors.
  • Easy to learn and get started.

Downside: The community isn’t as large as other Java frameworks and there aren’t as many Play plugins.

5. Google Web Toolkit (GWT)

GWT (Google Web Toolkit) is a Java framework for web developers from Google. GWT allows you to write client-side Java code and deploy it in the browser as JavaScript. Google Web Toolkit creates UIs of reusable components, similar to JavaServer Faces.

The GWT framework provides functionalities for standard web development work like bookmarking, history management, remote procedure calls, UI abstraction and more. In addition, you can create dynamic features such as drag and drop UIs using GWT’s pre-designed classes.

Main Feature:

  • Supports responsive web applications with complex client-side design.
  • Provides pre-designed panels and widgets and a set of CLI tools.
  • Provides support for unit testing, internationalization and localization.
  • Easy to learn, many online tutorials available.
  • The code is divided into a number of JavaScript files that help the application load smoothly.
  • Manages static resources in the code like images and CSS, which requires explicit declaration in the Java code.

Downside: Every client-side code change requires a new compilation. That makes GWT development slower, compared to other Java web frameworks. Developers are used to quickly refreshing the browser to see the changes.

Wrap Up

Web frameworks save a lot of development time by simplifying common web development tasks such as configuration changes. They also include features such as add-ons, plugins, integrations with third-party tools or pre-built UI elements.

Before choosing a framework, consider the nature of your application, the scale of the application, and your experience with using Web Frameworks and writing web applications in Java. Then, choose the framework that suits your needs.

21 IntelliJ shortcuts to boost your productivity

Posted on December 9th, 2019

Using keyboard shortcuts in Intellij IDEA can save you a lot of time, increase your productivity and help keep your wrists healthy. We’ve collected the top 21 must-know shortcuts and keystroke combinations to take your Intellij mastery to the next level.

Being productive while coding is not just about avoiding social media and other annoying distractions. When you remove all the external noise, it’s just you, your IDE of choice, your keyboard, mouse, and a caffeinated beverage. One of these is usually unnecessary – the mouse.

Why Keyboard Shortcuts Are Awesome

It’s not that we have anything against pointing devices, but let’s face it – those are the tools of graphic designers. And even graphic designers use (usually one-handed) keyboard shortcuts in their work. When you’re in that lightning-speed code-typing mode, looking for menu items is nothing but a distraction, even when you know exactly what you are looking for.

morpheus and keyboard shortcuts

For a developer to waste precious time moving their hand from the keyboard to the mouse and back is simply ineffective. All those little seconds really do add up in damaging the overall efficiency of your work. In addition, it can cause fatigue and pain in the wrist and arm from the frequent switching between input devices.

Top 21 Productivity-Boosting Intellij IDEA Shortcuts

Now that you installed some plugins, you’re fully convinced of the value of memorizing and using keyboard shortcuts instead of clicking on menus, we have some great news! Intellij IDEA can do pretty much all you need it to without you even touching the computer mouse of trackpad to execute a command. 

That said, there’s really no reason for you to memorize the full Intellij IDEA default keymap sheet, though you might want to print the page applicable to your OS of choice and hang it somewhere you can easily see around your workstation.

So which of the 100+ shortcuts should you memorize? We picked the top 21 in boosting productivity, and sorted them into categories according to use. Note that we used the default OS and Intellij keymap, and the key combinations assume a Windows OS. If you use a Mac or run Linux, you can easily “convert” the shortcuts using the official Intellij IDEA keymap sheet.

teach keyboard shortcuts

Navigating

One of the main challenges in “quitting the mouse” with Intellij IDEA is learning to navigate between files, tabs and sections of code using keyboard shortcuts. It’s actually more effective than using a mouse and guess what? No leaning on the up and down keys is involved!

1. Go to declaration / implementation – Ctrl + B / Ctrl + Alt + B

When you need to find the declaration of a method, all you need to do is select the method and press Ctrl+B on your keyboard. Need the implementation section instead? Press Ctrl + Alt + B to jump to the method implementation.

2. Navigate to last edit location – Ctrl + Shift + Backspace

“Wait, so where was I typing last?” will never be a question you ask yourself when going back to work after lunch. Simply press Ctrl + Shift + Backspace and you’ll be taken to the last edit location in the file.

3. Switch between tabs – Ctrl + Tab

Everyone knows how useful the Alt + Tab key combination is, especially when switching between, let’s say, Google (or your social media account) and the IDE. Now, you can also switch quickly and easily between open files in the same way with Ctrl + Tab.

4. View recent files – Ctrl + E

Want to open a recent file? Pressing Ctrl + E will let you navigate the list of recent files and pick the one you wish to open in a tab.

5. Go to line – Ctrl + G

When a coworker yells across the room “Check line 732!” you don’t need to go on a scrolling marathon. Simply press Ctrl + G and go directly to the line in question.

6. Navigate to test – Ctrl + Shift + T

Jumping between implementation and testing classes is a breeze with this handy key combination. Added bonus – if your implementation class doesn’t have a test class, Ctrl + Shift + T will automatically create one for you using your default testing framework. 

Searching

Finding what you need in thousands of lines of code across multiple documents is no easy task when done manually and is a bit like finding a needle in a haystack of code. Fortunately, there are several search functions (with keyboard shortcuts) in Intellij IDEA to help you locate the code segments, classes, methods or other resources you’re looking for as quickly as possible.

7. Comprehensive search – Double Shift

Look for anything anywhere with this handy double-press. Using TAB switches the resulting cluster, left arrow key will show history, right arrow key will move forward, and the most recent files are shown by default.

8. Find class – Ctrl + N

Looking for something classy? To find the class you seek simply press Ctrl + N and type the name. You don’t even need to write the full name, and you can use asterisks (*) as wildcards.

9. Find resource – Ctrl + Shift + N

When you’re not looking for classes but rather for text or configuration files, Ctrl + Shift + N will do just in a fashion similar to that for finding classes.

10. Show usages – Ctrl + Alt + F7

Ever looked at a component in the code and ask yourself “Wait, what does this do?” before going on a long quest to answer that question? Never again! Ctrl + Alt + F7 shows all usages of the current method, class or variable in a popup where you can easily navigate between locations where it was used.

Editing

As a coder, what you usually do is write and edit code. Those important keystrokes of genius that make the words in the IDE turn into working applications. Some keystrokes are unnecessary and repetitive. These shortcuts will help eliminate those so every one of your keystrokes counts.

11. Expand / shrink selection – Ctrl + W / Ctrl + Shift + W

Selecting code sections with a mouse is a drag. Aside from being a pun, it’s also a great way to miss important bits which we would rather not miss. Instead, you can use Ctrl + W to expand the selection intelligently and Ctrl + Shift + W to shrink it.

12. Basic code completion – Ctrl + Space

“Type less, do more,” is the main idea behind this keyboard shortcut (and the two that follow it). This important shortcut will autocomplete your code, but much like the default autocomplete on your mobile, is not perfect. It is, however, very widely used.

13. Smart code completion – Ctrl + Shift + Space

Smart code completion is much more effective as it will only display the autocomplete options relevant to context by filtering the list of suggestions to show only classes, variables, fields and methods of the type that can be expected.

14. Complete statement – Ctrl + Shift + Enter

The bane of any and every developer from day one of the job are those missing characters in statements like parentheses and semicolons. This keyboard shortcut helps eliminate those and can be a lifesaver on long nights of coding.

15. Show intention actions and quick-fixes – Alt + Enter

Another helpful keyboard shortcut to improve your code is Alt + Enter that will automatically fix highlighted errors or warnings, then improve or optimize the selected code construct.

16. Duplicate line – Ctrl + D

Anyone who’s ever written code will tell you no key combination is more useful than good old Ctrl + C and Ctrl +V. In Intellij IDEA you can duplicate lines by pressing Ctrl + D. Note that you can also do this with whole sections of code.

17. Comment line – Ctrl + /

Deleting code is rare. More often than not, you will comment out lines of code for testing purposes or various reasons. Commenting out lines is made quick and easy by then pressing Ctrl + / no matter where you are in the line.

Refactoring

One of the main strengths of Intellij IDEA is its refactoring functions and opportunities. The most used ones have shortcuts you’ll probably memorize pretty quickly if you refactor your code a lot.

18. Extract method – Ctrl + Alt + M

To extract code to a new method or lambda expression simply select it and press Ctrl + Alt + M.

19. Rename – Shift + F6

Renaming in Intellij requires some setting up before using. If you don’t adjust renaming options (double-pressing Shift + F6), you might find that it will also rename occurrences in text. Pressing Shift + F6 once will rename the selected element across your entire codebase.

Compiling / Debugging

The last two keyboard shortcuts need no explanation as they map to two of the most commonly used functions of an IDE – making projects, debugging and running them.

20. Make project – Ctrl + F9

21. Run / debug – Shift + F10 / F9

Those are just our favorite shortcuts, and only 21 of them. Which are yours? Tell us in the comments.