Packages and static imports in Java

See the original posting on JavaWorld

In my previous Java 101 tutorial, you learned how to better organize your code by declaring reference types (also known as classes and interfaces) as members of other reference types and blocks. I also showed you how to use nesting to avoid name conflicts between nested reference types and top-level reference types that share the same name.

Along with nesting, Java uses packages to resolve same-name issues in top-level reference types. Using static imports also simplifies access to the static members in packaged top-level reference types. Static imports will save you keystrokes when accessing these members in your code, but there are a few things to watch out for when you use them. In this tutorial, I will introduce you to using packages and static imports in your Java programs.

To read this article in full, please click here

JUnit 5 tutorial, part 2: Unit testing Spring MVC with JUnit 5

See the original posting on JavaWorld

Spring MVC is one of the most popular Java frameworks for building enterprise Java applications, and it lends itself very well to testing. By design, Spring MVC promotes the separation of concerns and encourages coding against interfaces. These qualities, along with Spring’s implementation of dependency injection, make Spring applications very testable.

This tutorial is the second half of my introduction to unit testing with JUnit 5. I’ll show you how to integrate JUnit 5 with Spring, then introduce you to three tools that you can use to test Spring MVC controllers, services, and repositories.

To read this article in full, please click here

Open source projects take all kinds — well, some do

See the original posting on JavaWorld

Not every open source project lead agrees with Rich Felker, founder of the Musl project. As I covered recently, Felker puts a premium on users of Musl, even more than those that contribute code: “The users, the testers, the adopters, the bug reporters [are] so much more valuable than writing any code.”

But don’t misunderstand him. Felker adds that even users who contribute back no code or bug fixes, or anything at all, are still valuable. That’s because they create demand that pushes other software to interoperate, and may fix interoperability with other software even if we never see it.

To read this article in full, please click here

The most important part of an open source project

See the original posting on JavaWorld

With all the talk about open source sustainability, it’s easy to focus on “hard currency” contributions to a project. You know, code or cash or documentation or something that the project maintainers can see or touch. But in a conversation with Rich Felker, the founder of the musl libc project, he said something that initially seemed provocative, even shocking, but then felt exactly right:

Users, not code contributors, are the most important part of an open source project.

To read this article in full, please click here

GitHub usage analysis measures COVID-19 impact

See the original posting on JavaWorld

C programming language rises with COVID-19

See the original posting on JavaWorld

For the first time since March 2015, the C programming language this month supplanted Java as the most-popular language in the Tiobe Index of programming language popularity. Tiobe guessed that the COVID-19 pandemic might be behind C’s rise.

While acknowledging that the pandemic may be just one of many reasons, Tiobe said some languages could see an uptick because of the virus. C and C++ are gaining popularity because they are used in medical devices, while Python and R, which are used in data science, are benefitting from their use in searching for an antidote to the virus.

To read this article in full, please click here

JUnit 5 tutorial, part 1: Unit testing with JUnit 5, Mockito, and Hamcrest

See the original posting on JavaWorld

JUnit 5 is the new de facto standard for developing unit tests in Java. This newest version has left behind the constraints of Java 5 and integrated many features from Java 8, most notably support for lambda expressions.

In this first half of a two-part introduction to JUnit 5, you’ll get started with testing with JUnit 5. I’ll show you how to configure a Maven project to use JUnit 5, how to write tests using the @Test and @ParameterizedTest annotations, and how to work with the new lifecycle annotations in JUnit 5. You’ll also see a brief example of using filter tags, and I’ll show you how to integrate JUnit 5 with a third-party assertions library—in this case, Hamcrest. Finally, you’ll get a quick, tutorial introduction to integrating JUnit 5 with Mockito, so that you can write more robust unit tests for complex, real-world systems.

To read this article in full, please click here

Remember when open source was fun?

See the original posting on JavaWorld

Much of the conversation about the sustainability of open source has revolved around how to ensure VC-backed companies can turn millions in investment into hundreds of millions in return. But talking with early pioneers of open source projects like Curl, Fio, and Wireshark, it’s clear that a critical component is missing from such conversations: fun.

In canvassing the industry for the stories behind important but perhaps not well-known open source projects, it has surprised me just how many of these projects are developed for personal satisfaction, regardless of the impact on these developers’ bank accounts.

To read this article in full, please click here

Project Leyden addresses Java pain points

See the original posting on JavaWorld

Long-term Java pain points including slow startup time, slow time to peak performance, and large footprint would be addressed by a proposal being floated in the OpenJDK community by Mark Reinhold, chief architect of Oracle’s Java platform group.

Called Project Leyden, the proposal would deal with these pain points by introducing the concept of static images to the Java platform and the JDK. A static image is a standalone program, derived from an application that runs that application, and no other. A static image is also a “closed world” that cannot load classes from outside the image or spin new bytecodes at runtime.

To read this article in full, please click here

How developer teams went remote overnight

See the original posting on JavaWorld

As the coronavirus pandemic continues to shut down cities and offices around the globe, developers and software engineers are quickly adapting to operating in remote, distributed teams.

The good news is programmers can quite easily work wherever they have a laptop and a secure internet connection — but the cultural impacts on teams can be significant. Of course tools help, and there are more and more live collaboration features in the leading coding software (check out Serdar Yegulalp’s recent InfoWorld article for a roundup of the best ones). But other issues around remote work can’t be solved with tooling.

To read this article in full, please click here

Go language use still anchored in technology companies

See the original posting on JavaWorld

While the Google-developed Go (golang) language has branched out into industries such as finance and media, much of its usage remains concentrated in the technology industry itself, according to the Go Developer 2019 Survey.

A report featuring results of the survey was published on April 20. Forty-three percent of respondents reported working in the technology sector while 12 percent were in financial services, 9 percent in media/gaming, and 7 percent in retail/consumer packaged goods.

To read this article in full, please click here

ECMAScript 2020 spec for JavaScript moves forward

See the original posting on JavaWorld

ECMAScript 2020, the next version of the official specification underlying JavaScript, is expected to be formally adopted in June, subject to approval by ECMA International and the ECMA technical committee overseeing the specification. 

ECMAScript 2020 introduces multiple features ranging from a new import() facility for loading modules to a new BigInt type for working with arbitrary precision integers. 

Specific features planned for ECMAScript 2020 include:

To read this article in full, please click here

14 ways AWS beats Microsoft Azure and Google Cloud

See the original posting on JavaWorld

There are many good cloud companies that do a perfectly good job. You click and they deliver a root login to a running instance. All of them are good. Some even have areas where they’re the best. None of them, though, manage to measure up to the breadth and depth of Amazon.

The reason is simple: AWS has built out so many products and services that it’s impossible to begin to discuss them in a single article or even a book. Many of them were amazing innovations when they first appeared and the hits keep coming. Every year Amazon adds new tools that make it harder and harder to justify keeping those old boxes pumping out heat and overstressing the air conditioner in the server room down the hall.

To read this article in full, please click here

How secure is Java compared to other languages?

See the original posting on JavaWorld

As with other aspects of cybersecurity, the level of programming language security depends on what we mean by “secure.” It’s true that Java has fewer identified vulnerabilities than some other commonly used languages. It’s also true that some newer languages appear more secure than Java, at least at first glance.

Many of the security holes that have been found in Java are the result of its popularity. Widespread usage means that thousands of bug hunters are dedicated to finding Java language vulnerabilities, which gives Java an unfair “advantage” in this field. Likewise, the implied security of some newer languages, like Ruby, could reflect their niche usage more than their integrity.  

To read this article in full, please click here

7 best practices for remote agile teams

See the original posting on JavaWorld

Agile methodologies work best when everyone on the team is together in one location. When teams share a workspace, it’s easy for teammates to ask questions, pair on programming tasks, and solve problems without scheduling meetings. Using technologies like web conferencing, group chats, and email just isn’t as effective as direct, person-to-person interactions.

To read this article in full, please click here