Evolution of the Quarkus Developer Experience
Showcasing the maturity and evolution of critical developer productivity capabilities within Quarkus.
Join the DZone community and get the full member experience.
Join For FreeIntroduction
Since its inception, Quarkus has focused on more than just delivering sets of features. Developer productivity and joy have been critical components of Quarkus. The developer experience and how to improve it are carefully considered with every new feature added. This article showcases the maturity and evolution of developer productivity capabilities within Quarkus from inception to the newly-released version 2.0.
Developer Productivity and Joy
Quarkus rests on a vast ecosystem of technologies, standards, libraries, and APIs, making Quarkus “familiar” but “new”. Developers don’t have to spend lots of time learning an entirely new set of APIs and technologies to take advantage of the benefits Quarkus brings to the JVM or native images. Instead, developers can utilize their existing knowledge and skills. Among the specifications and technologies underlying Quarkus are Eclipse MicroProfile, Eclipse Vert.x, Contexts & Dependency Injection (CDI), JAX-RS, the Java Persistence API (JPA), the Java Transaction API (JTA), Apache Camel, and Hibernate, just to name a few.
Every feature should be simple, have little-to-no configuration, and be as intuitive as possible to use. It should be trivial to do trivial things while relatively easy to do more complex things, allowing developers more time to focus on their domain expertise and business logic.
Dev Mode / Live Coding
One major productivity issue that most Java developers face today is the traditional Java development workflow. For most developers, this process looks like Figure 1.
The issue is that the Compile and Deploy / Run cycles can sometimes take up to a minute or more. This delay is wasted time where a developer could be doing something productive. Quarkus’s Dev Mode / Live Coding feature, introduced in the initial Quarkus release, solves this issue. Capabilities similar to those provided in the Node.js ecosystem were now brought to Java.
Simply run the command ./mvnw compile quarkus:dev
, and Quarkus will automatically detect changes made to Java files, including class or method refactorings, application configuration, static resources, or even classpath dependency changes. When such a change is detected, Quarkus transparently re-compiles and re-deploys the changes while also preserving the previous state of the application. Quarkus re-deployments typically happen in under a second. Using Quarkus, this process looks like Figure 2.
Easy Native Image Creation
Following the philosophy of simplicity and enhancing developer productivity, building an application into a native image is extremely simple. All the heavy-lifting and integration to consume GraalVM is done for you by the Quarkus build tools via Maven or Gradle. Developers or CI/CD systems simply need to run a build, just like any other Java build, to produce a native executable. Testing an application as a native image is also just as simple.
Remote Dev Mode
The Quarkus team received much praise for the live coding feature. The next logical step for improvement was to extend the live coding capability to Quarkus applications running in a remote container environment. This enhancement, known as remote dev mode, would allow developers to use the same local IDE, but the application would be running in a “real” environment with access to services that may not be available or easy to create on a local developer machine.
Instead of running ./mvnw compile quarkus:dev
, a developer can run ./mvnw quarkus:remote-dev
to enable the feature. Changes made on the local development machine are automatically pushed to the running remote Quarkus application in real-time. This feature significantly enhances the development loop when building Kubernetes-native applications by drastically reducing the time needed to develop and test changes before committing to source control.
See Daniel Oh’s article “Enhancing the development loop with Quarkus remote development” for a step-by-step tutorial on this feature.
Dev UI
Running Quarkus in dev mode enables the Quarkus Dev UI. The Dev UI, shown in Figure 3, is a landing page exposed at the /q/dev
URI for browsing endpoints offered by various extensions. The Quarkus Dev UI allows developers to quickly visualize all the extensions currently loaded, see their status, and go directly to their documentation. Additionally, each extension can add custom runtime information in the overview, full custom pages, and interactive pages with custom actions.
The Dev UI provides easy access to all the application’s configurations, shown in Figure 4. Any changes made in the UI are reflected in src/main/resources/application.properties
(or application.yml
if using the Quarkus YAML extension).
Additionally, the Dev UI provides streaming access to the application’s log file and quick access to the application’s test suite. A developer can toggle test execution on and off, trigger test execution, and view the current test execution status within the UI, shown in Figure 5.
Dev Services
Quarkus continues to enhance developer productivity with the introduction of Quarkus Dev Services. When running Quarkus Dev Mode or when running tests, Quarkus Dev Services will automatically bootstrap a database container image and set all of the required configuration properties for the dev profile. Quarkus will additionally terminate the database container upon shutdown of Dev Mode.
The Quarkus Dev Services uses Testcontainers internally to bootstrap the database when running Quarkus Dev Mode or executing tests. No additional setup or configuration for Testcontainers directly is needed. If a specific image is not provided, Quarkus will choose one based on the database driver found on the classpath. The database driver could be one of the JDBC drivers or a reactive driver.
Quarkus 2 extends Dev Services capabilities to bootstrapping Apache Kafka. A developer no longer needs to "stand up" a Kafka broker on their local machine when using Quarkus Dev Mode or when running tests. Without this feature, a developer would need to use a tool such as Docker Compose to create a Kafka cluster to connect their application to. Then they'd need to create custom Testcontainers classes to bootstrap Kafka when running tests. Quarkus Dev Services makes it easy.
This capability grants developers a tight feedback loop and removes the additional overhead of starting a database manually and providing configuration for it. Future Quarkus versions will extend this capability to include other middleware, such as message brokers.
Please take five minutes to watch the following video where I show a demo of Dev Services bootstrapping a database in action.
Continuous Testing
Developer experience and productivity have been one of the main focuses of Quarkus since its inception. The continuous testing feature takes it to the next level. This feature enables test-driven development within Dev Mode by understanding which tests are affected by classes and methods within the application. As changes are made to the application source code, Quarkus can automatically rerun affected tests in the background, giving developers instant feedback about code changes they are making.
The continuous testing feature is integrated directly into the core of Quarkus. This integration means there are no IDE or build plugins required to enable the feature. Any user who can run command-line applications can use it. The continuous testing feature is available automatically, but the user needs to press a key during Dev Mode to enable it. It can, however, be configured to always enable it.
Please take seven minutes to watch the following video where Stuart Douglas, the creator of the continuous testing feature, shows a demo of it in action.
CLI
No technology is really complete unless it has a command-line interface (CLI) correct? It is completely possible to build and interact with Quarkus applications via its CLI. The Quarkus CLI makes it really easy to create new projects and interact with existing ones by easily adding/removing extensions, building the project, and starting Dev Mode. Additionally, developers can use the CLI to list and search for available extensions.
See the Quarkus CLI guide for more information on how to install and use the Quarkus CLI.
Summary
Quarkus was originally introduced to the open source community in March of 2019. Since then, Quarkus has evolved at an extremely fast pace, going through many iterations in a short period of time. Each iteration builds on top of the core developer productivity tools unique to Quarkus, making developer’s lives easier and more productive. Quarkus 2.0 is certainly no exception! Try it out for yourself!
Opinions expressed by DZone contributors are their own.
Comments