Articles

There is a simple principle for naming methods in OOP. I’m trying to demonstrate this in the following code — it’s a verb if it manipulates; it’s a noun if it builds. That’s it. Nothing in between. Methods like saveFile() or getTitle() don’t fit and must be renamed and refactored. Moreover, methods that "manipulate" must always return void, for example, print() or save(). Let’s take a closer look!

The Night Of (2016) by Richard Price et al.

Source de l’article sur DZONE

I have been using the Trello board over the last few months for project management. During this period, I needed to generate reports via Word or DOCX, and among the constraints, I found that there are cards written in different languages.

In this article, I will provide a detailed Java program that can generate a DOCX report of a Trello board and translate content into a single output language, basing it on Google Translation and Cloud API Translation.

Source de l’article sur DZONE



At Grakn, we recently released Grakn 1.3, with a slew of new features, bug fixes, and performance enhancements. Included in this release are new gRPC-based drivers for Java, NodeJS, and Python. This article will walk you through the Python driver and provide guidelines on how you can write your own for your language of choice.

Overview

The main reason for rewriting our drivers was a move from REST to gRPC in Grakn. This change has cleaned up our API and should provide performance benefits. Further, all of our available drivers (Java, Node, and Python) now expose the same objects and methods to users, subject to language naming conventions and available types. To maintain this uniformity across the stack, new language drivers should provide the same interface. Note that you will require both gRPC and protobuf support to create a functioning driver, so double check a) that compilers for your language exist, and b) your target language version is compatible with the compiler.


Source de l’article sur DZONE (AI)


I wish all of my interfaces were segregated as good as this fish at Catania fish market

In this fourth post on SOLID principles, we will take a look at the interface segregation principle and how to interpret it. If you want to check out the previous post on the Liskov Substitution Principle, you can find it here.

Definition

According to Robert Martin,

Source de l’article sur DZONE

The series so far: 

It’s recommended to use Lambda instead of the anonymous class, but there are some pitfalls, such as the potential  NoClassDefFoundError.

In this post, I will explore this error and how to avoid it. I have two classes, RequiredObject and OptionalObject. The latter one is optional at runtime, and optional dependency is common especially for this framework.

Source de l’article sur DZONE

As the Azul alternate representative on the JCP Executive Committee (EC), I get to attend all the EC meetings and take part in the various discussions. One topic that the EC has been devoting a lot of energy to recently is the adoption of the Java platform, post-JDK 8.

Ordinarily, this would be a discussion about the best ways to encourage people to migrate their applications to using JDK 9. However, this is not so in the new Java world order.

Source de l’article sur DZONE

It’s a fairly common task for a Java developer to convert a list to an array or from an array to a list. Like many things in Java, there is often more than one way to accomplish a task. In this post, I’ll discuss the various approaches to converting data between list objects and arrays.

Converting List to Array

The list interface comes with the toArray() method that returns an array containing all of the elements in this list in proper sequence (from the first to last element). The type of returned array is that of the array that you pass as the parameter.

Source de l’article sur DZONE

As mentioned in the previous article, Vert.x is an event-driven, non-blocking toolkit. It was designed for asynchronous communications. In most cases, you need to work with multiple verticles in your applications. You also need communication between these verticles in these cases. In this article, I will attempt to explain how you can do this — let’s get started!

Use of Multiple Verticles

An important note to remember is that a verticle is a unit of deployment. It allows you to encapsulate your code for different needs. In addition, they can be run independently of each other. Verticles are communicated with each other by sending messages on the event bus. For this example, we have developed two verticles. One is the sender and the other is the receiver. You can access code for this example from this repository. The start method in the SenderVerticle class is as follows:

Source de l’article sur DZONE

It’s about time that you reconsider Java as your go-to language for your Android-based projects. And, it’s about time to switch over to Kotlin, the (not so) new support language for Android development. But, what’s behind its surging popularity amongst developers? In other words, what are the biggest advantages of Kotlin over Java?

Why should you even consider trying it as an alternative to the sometimes problematic, yet familiar and reliable Java? Now, here are some of the best answers to your questions:

Source de l’article sur DZONE