background preloader


Facebook Twitter


9 tips to Increase your Java performance ☕️ □ □‍♂️ Any fool can write code that a computer can understand.

9 tips to Increase your Java performance ☕️ □ □‍♂️

Good programmers write code that humans can understand. - Martin Fowler. TemporaryFolder (JUnit API) Java.lang.Object org.junit.rules.ExternalResource org.junit.rules.TemporaryFolder All Implemented Interfaces: TestRule public class TemporaryFolderextends ExternalResource The TemporaryFolder Rule allows creation of files and folders that should be deleted when the test method finishes (whether it passes or fails).

TemporaryFolder (JUnit API)

Example of usage: public static class HasTempFolder { @Rule public TemporaryFolder folder= new TemporaryFolder(); @Test public void testUsingTempFolder() throws IOException { File createdFile= folder.newFile("myfile.txt"); File createdFolder= folder.newFolder("subfolder"); // ... } } The volatile keyword in Java. It's probably fair to say that on the whole, the volatile keyword in Java is poorly documented, poorly understood, and rarely used.

The volatile keyword in Java

To make matters worse, its formal definition actually changed as of Java 5. On this and the following pages, we will cut through this mess and look at what the Java volatile keyword does and when it is used. Enum: Using the Name() and toString() Methods Correctly. Adding macro support to your Java application. One of the most powerful uses of scripting languages is in "application automation", that is, the idea of automating a long sequence of steps such as: "select paragraph at cursor, indent 3" right, change font, ...

Adding macro support to your Java application

". Most of us will recognize this as application macros. A macro program is typically a scripting language such as VBA that calls into an application, like StarOffice or Microsoft Office to programmatically direct the application to perform a series of operations that is normally performed by a user, such as formatting a paragraph. Macros are important as they allow users to customize an application.

And because macros are essentially programs, the operations that they perform can be shared among users in an organization or over the Internet. Fixing 7 Common Java Exception Handling Mistakes. Handling an exception is one of the most common but not necessarily one of the easiest tasks.

Fixing 7 Common Java Exception Handling Mistakes

It is still one of the frequently discussed topics in experienced teams, and there are several best practices and common mistakes you should be aware of. 5 Tips for Building Your Java API. Developers use APIs to for everything!

5 Tips for Building Your Java API

You build APIs for your own apps to consume or as a part of a microservices architecture. Bottom line, you’re building and using APIs to make your life easier. The ongoing effort to simplify development and work more efficiently, sometimes this also means looking for new libraries or processes (or more often fewer processes). For many teams, managing authentication and access control for their apps and APIs is more work than it’s worth, or simply not an efficient use of time, so we want to share a few tips that will save you time and code, along with making your applications more secure and easier to maintain.

For a bit of context: Okta at its core, is a Java-based REST+JSON API, built on the Spring Framework. Java Performance Tools - 8 Types of Tools You Need to Know! Keeping track of your application’s performance is an ongoing task, so it is important to have the right tools.

Java Performance Tools - 8 Types of Tools You Need to Know!

What works in development might not be quite as helpful in a production environment. Here, I will go over some great tools and the best time to use them. The goal is to help you make reliable and high-performing apps as fast as possible. 1. Java Profilers JVM Profiles offer a ton of raw data by tracking all method calls, allowing you to find CPU and memory consumption hotspots. Screenshot of VisualVM CPU and Heap Size Pros: Great for tracking down memory leaks, the ability to manually run garbage collection and then review memory consumption can easily shine a spotlight on classes and processes that are holding on to memory in error. The Do's and Don’ts of Java Strings. Today we’re going to be talking about Strings in Java.

The Do's and Don’ts of Java Strings

If you write Java often, you know that a String is considered a first class object, even though it is not one of the eight primitive types. What you may not know is how to best handle Strings in production applications. To do this, you’ll need to understand how to internationalize/localize a String, manipulate very large Strings, or deeply understand String comparison rules. So let’s begin to… untangle this, shall we? When and How to Internationalize/Localize a Java String Internationalization (i18n) is the process of process of providing human-readable Strings in different languages, whereas localization (l10n) takes further geographical and cultural concerns into account. Beyond standard messaging, i18n/l10n is also extremely important when representing dates/times and currency.

That said, it obviously isn’t necessary to translate every String in your application – only the ones that humans will see. Java 9 : l'interpr teur boucle : lecture - valuation - impression (REPL) int gr la plateforme, premier aper u de JShell. De nombreux index sur le classement des langages s’accordent sur le fait que Java est l’un des langages de programmation les plus utilisés à travers le monde.

Java 9 : l'interpr teur boucle : lecture - valuation - impression (REPL) int gr la plateforme, premier aper u de JShell

Cependant, de nombreuses universités se détournent du langage Java pour l’initiation à la programmation. Le langage est maintenu dans les programmes essentiellement à cause de sa popularité en entreprise. Mais, pour des universités américaines de référence comme le MIT, l’initiation à Java commence à partir du niveau 1 ou 2. Plusieurs universités américaines ont opté pour l’utilisation du langage Python pour l’initiation à la programmation de niveau 0 et niveau 1, selon un sondage qui avait été réalisé par l’ACM il y a un an.