My previous post on streams demonstrates how useful this feature is to Java 8. However, it created a problem for the API designers. The problem was how to we extend the existing Collection’s API without breaking existing Collections implementations (Guava, Apache, etc.).
The solution was to allow methods in interfaces, meaning that any implementations already carry an implementation of the extension.
Creating a CD Pipeline With Jenkins and Java
Wed, 26 Apr 2017 10:01:00 GMT
Lately, I’ve been working a lot with Jenkins for continuous deployment of one of my applications. In case you haven’t seen it, the keynote demonstration given at Couchbase Connect 2016 used Jenkins to build and redeploy the Java backend and Angular frontend every time a change was detected on GitHub. This is the application I helped build.
So how did I leverage Jenkins to make this possible? We’re going to see how to create a continuous deployment pipeline for a Java application which includes building and deploying to a server.
Java-Based Microservices Architecture and Abixen
Wed, 26 Apr 2017 07:01:00 GMT
Microservices are getting constantly more and more popular. Every month, there are more libraries and solutions supporting a development process, testing, and further support. Many Java developers have heard about the microservices approach, but a significant number of companies have not taken the challenge of implementing a microservices-based architecture. Does this sound familiar?
"I know, microservices are awesome, microservices bring easier maintenance and further development, but we have no resources to build a good microservices-based architecture."
Web MVC With Spring and Business Objects
Wed, 26 Apr 2017 04:01:00 GMT
In my previous posts, we explored the MVC Pattern Language by Trygve Reenskaug and made an attempt to implement MVC in the console, while focusing on MVC’s overarching idea – supporting users’ mental models. In this post, we’ll take a quick look on how to move the (poor) console example to the web.
A Short Reminder
For those of you who haven’t read the previous post or don’t (want to) remember, we were creating a simple “Pet Clinic” application. We visited an old vet lady who does not own a computer to gather requirements and get a basic idea of what her work is about. For the most part, she’s using two interesting items at work: a visit calendar and pet files. These are perfect candidates to become business objects in our system. Since the lady is so used to them in the physical world, we assume she’ll have no problems using their computerized versions. So far, we created a console representation of the visit calendar. Now, we want to move it to the web so that it’s usable for non-nerd human beings.
Guide to Separate JRE Versions From NetBeans Platform Installer
Tue, 25 Apr 2017 20:01:00 GMT
In an enterprise set up where updating Java on a client machine is not allowed due to software restriction policy, it becomes challenging to develop and ship applications which require the latest version of Java to be installed on client machines. One way to circumvent this policy-based restriction is to bundle the JREs for 32-bit and 64-bit Windows OS in a separate NetBeans platform installer. This ensures that the JRE remains isolated from the system and conflict with any older version of Java is avoided. This method is detailed in an excellent article written by Ernest Lotter.
However, the bundling of JRE with the application forces you to maintain separate copies of the installer for 32-bit and 64-bit versions of Java. It also ties the application with the version of Java which was available at that point in time. In a scenario where development and improvement is a continuous process, one would love to have the flexibility of using the latest Java features in the application being developed and at the same time be able to deliver the latest version of Java to client machines.
Java 9 (Part 3): Super Interfaces, First Look!
Tue, 25 Apr 2017 14:09:55 GMT
In Scala, traits can have an implementation, so why not have implementations in Java? Well, that was introduced in Java 8, so the next natural step in Java 9 is to have private logic in interfaces. In Part 2 of this series, we introduced the Java 9 REPL. In this part, we are going to examine the new functionality introduced to interfaces.
Java 9 is introducing a lot of new concepts, such as REPL, factory methods for common data structures, and more. Let’s see what Java 9 has to say about private methods in interfaces.
Arbitrary Precision Numbers
Tue, 25 Apr 2017 14:08:42 GMT
I am working on a system that involves money handling, written in Java. And as you can imagine, one of the challenges is to make sure that money is not appearing or disappearing because of the floating point arithmetic. I asked a few developers how to handle money and one common answer was to use BigDecimal for that. Therefore, I performed a few experiments on the side and discovered few things that you probably won't see after the first look into this class. In this article, I am going to show these discoveries together with the final solution I decided to go with.
Before going into the detailed explanation, let's create an example that shows what happens with floating point numbers. Imagine you want to split $200 between four people. First, two of them will get 1/3 and the other two will get 1/6. Then let's see what happens when you put these parts back together. The following code demonstrates the situation (using Lenovo Yoga, Win 8.1, Java 1.8).