Feed aggregator

The Developer's Midlife Crisis: What's Next?

Javalobby Syndicated Feed - Thu, 30-Jun-16 23:01

This week I resigned from my comfortable, well-paid job.

I guess I reached that moment where one looks back on what he/she has achieved so far, and wonders what's the plan for the next thirty years.

Categories: Java

Java vs. .NET vs. Python vs. Ruby vs. Node.js: Who Reigns the Job Market?

Javalobby Syndicated Feed - Thu, 30-Jun-16 22:01

Every now and then a new article/blog post/opinion piece/twitter rant is published wondering about the future of Java. However, the cold facts state that it’s still the most popular language in the programming world, but what does it actually mean?

In the following post we’ll dig into the buzz around Java through analysing the current job market, focusing on server side languages. Who knows, it might even help you find your next position.

Categories: Java

This Week in Spring: Cloud Data Flow, RxJava, and Executable JARs

Javalobby Syndicated Feed - Thu, 30-Jun-16 00:01

Welcome to another installment of This Week in Spring! This week I’m in Munich and Wolfsburg, Germany, visiting with customers, then it’s off to Seoul, South Korea, for customers and some user group talks.

This week we’ve got a lot of exciting Spring Cloud Data Flow news, coincident with the new Spring Cloud Data Flow RC1.

Categories: Java

Lesson Learned From Gilded Rose Kata

Javalobby Syndicated Feed - Wed, 29-Jun-16 23:01

I’d like to share some of my thoughts about my approach to solve the Gilded Rose Refactoring Kata by Emily Bache. If you don’t know this kata, read the description for a better understanding. I have published my whole solution on GitHub . I tried to make a commit after every step, so you can keep track of my steps in the log of Git. The chosen programming language is Java.

Solving Gilded Rose Step-By-Step

Let’s have a look at what I have done step-by-step.

Categories: Java

Gradle 3.0 Preview by Hans Dockter

Javalobby Syndicated Feed - Wed, 29-Jun-16 22:01

During our last Bay Area Gradle Users Meetup on May 26th, 2016 @ App Dynamics, Hans Dockter gave a demo of all the new features you will find in Gradle 3.0:

– Daemon enabled by default
– Composite Builds
– Performance Improvements

Categories: Java

Java Quiz: Passing Objects to Methods

Javalobby Syndicated Feed - Wed, 29-Jun-16 21:31

Before we get on with this week's quiz, we'd like to let you know that Sar's Java quizzes will be every other week starting with this one. Let's get started!

Passing Objects to Methods

public class MyClass{

    int x;

    MyClass(int y){
        this.x = y ++ ;
    int method(MyClass mc){
        if(mc.x == 5){
            mc.x += 6;
        if(mc.x == 6){
            mc.x += 9;
        return ++ mc.x;
    public static void main(String[] args){
        MyClass mc = new MyClass(5);

Categories: Java

Microservices for Java Developers: Book Release [Announcement]

Javalobby Syndicated Feed - Wed, 29-Jun-16 12:52

I’ve just written a book that is now publicly available! The name of the book is “Microservices for Java Developers” (O’Reilly) and is a hands-on, step-by-step guide for building microservices with some popular Java frameworks like Spring Boot, Dropwizard, and WildFly Swarm! We also explore some of the non-functional requirements like safe deployments, exposing metrics, service interaction, service discovery, load balancing et. al. and how technology like Netflix OSS, Docker, and especially Kubernetes can help simplify the deployment and management of your microservices. Many many thanks to all of the reviewers who took the time to give feedback and for Red Hat for sponsoring my time especially Burr Sutter and the talented folks at O’Reilly who helped coordinate the effort and make it come to fruition.

I’ll have printed copies at DevNation/Summit (including a signing session Tuesday, June 28th at 3:30 at the Moscone Ctr.) and you can get a digital copy at the Red Hat Developers website. Stay tuned (@christianposta) as I may be working on part II :)

Categories: Java

Convert a List to a Comma-Separated String in Java 8

Javalobby Syndicated Feed - Wed, 29-Jun-16 11:12

Converting a List<String> to a String with all the values of the List comma separated in Java 8 is really straightforward. Let’s have a look how to do that.

In Java 8

We can simply write String.join(..), pass a delimiter and an Iterable and the new StringJoiner will do the rest:

Categories: Java

Introduction to Atlassian Connect

codecentric Blog - Wed, 29-Jun-16 11:08

In software development, Atlassian products like JIRA and Confluence are widely used today. But these days such tools are also applied in other areas. Meanwhile, Atlassian offers the applications also as cloud products (SaaS), hosted by Atlassian. For the user this is a simple approach, as he can just use the application without having to worry about installation and operations.

Unfortunately, the many already existing add-ons for the server version are not available in these cloud variants *1. With Connect, Atlassian delivers its own framework to extend their cloud applications with add-ons. Currently JIRA Cloud, Confluence Cloud, HipChat and Bitbucket Cloud are supported.

Add-ons with Connect

Technically the existing server add-ons are OSGi Bundles which are implemented in Java and are also directly installed into the application. This type of installation is not possible for cloud applications. Instead, Connect add-ons are autonomous web-applications, which communicate with the application (e.g. JIRA) via REST interfaces. They may also render content like HTML, which will be included in iframes.


The picture (by Atlassian) shows this communication scheme.

The different functionalities of the add-on are declared through a descriptor, which assigns  them to certain places in the application. Connect offers the opportunity to add elements to the user interface. Therefore, the descriptor contains  URLs pointing to the add-on, together with the information where to place the contents. JIRA will call this URL and integrate the returned HTML in the surrounding page. Furthermore, functionality without a graphical user interface can be registered. This way, the add-on can handle various events (like updating an issue) or add Post Functions to Workflows. Also in this case there is an URL (webhook) pointing to the functionality added to the descriptor.

As the add-on is an autonomous webapp, being called using a REST interface, it does not depend on the technologies used by the main application (e.g. JIRA). The programming language, frameworks and so on can be chosen freely instead. Atlassian and the community additionally offer libraries and tools for different languages and technologies, making development easier and taking responsibility of the ground work. Additionally the current trend for microservices brought up libraries and tools supporting this integration approach.

The add-on vendor also operates and administers his webapp in this model, meaning he has much more tasks following development. He is responsible for hosting and availability. In exchange he gains the advantage of having more control over his application. Updating the add-on becomes much simpler and apply automatically to all customers. No customer administrator needs to manually install the new version, as it is with server add-ons.

But in return this also means, that the customer has less control and needs to trust the vendor even more. If the vendor does not ensure continuous operation or performs incompatible updates, the customer cannot use the add-on anymore.

Compared to server add-ons, there are also limitations on Connect add-ons regarding possible range of functions. Because they are not that deeply integrated as the directly installed variant, they cannot interfere at so many points. An example is the support of Workflow Post Functions, but not of Workflow Validators. Internationalization (i18n) is also not supported at the moment. Whereas some features are planned and might be supported in the future, this is not likely for others. So it is not imaginable to implement an add-on with a custom HTTP filter with Connect.


As with server add-ons, installation takes place through Marketplace. Add-ons can be offered free or paid, private listings for internal use in organisations are also possible. For chargeable add-ons, payment via Atlassian is supported as well as direct payment via vendor.


In general, Connect offers a good way to extend the applications of Atlassian.

For add-on developers (in the sense of programmers) there is a notable higher flexibility regarding technology stack, which also enlarges the circle of possible developers. On the other hand the framework is not that powerful and offers a decreased level of integration. For add-on vendors in general there is increased effort, due to new challenges like operation of the application.

Atlassian stated that Connect will not be available for JIRA Server and Confluence Server. This results in duplicate implementation and maintenance work for add-ons which should be available for server and cloud. This could also lead to a fragmentation of the community, with impacts on documentation, tutorials, help forums etc.

For users, the difference to server applications is way much smaller. The add-ons do not reach the complete functionality and not all add-ons are available for cloud but there is much work happening in this direction. The biggest risk is that the vendor could stop his add-on which makes it suddenly no more available. Atlassian gives some hints on selecting trustable add-ons.

In the next article we will investigate, how security needs are fulfilled by Connect add-ons.

How about you? Would you use the cloud variant in your enterprise? Share your positive and negative experiences with Connect add-ons in the comments.

*1 There are selected server add-ons preinstalled in cloud instances. This is a special case and should not be considered as option for own plugins. It is more a temporary solution, until these features can be implemented with connect.

The post Introduction to Atlassian Connect appeared first on codecentric Blog.

Categories: Agile, Java, TDD & BDD

Announcing Java EE Microprofile

Javalobby Syndicated Feed - Wed, 29-Jun-16 07:35

The Java community has likely been the greatest factor in Java’s success and influence over the past 20+ years. This community has rallied and collaborated to improve the language and its capabilities through JSRs, libraries, APIs, frameworks, and more. Now Java EE has become “the dominant standard for companies building business-critical multi-tier enterprise applications.”

With that in mind, and with microservices architectures becoming ever more popular as monolithic applications hinder the advances of continuous delivery and integration, minimize performance, and lead to downtimes that are unacceptable for today’s technologies, there’s a new hurdle for the Java community to jump. Yesterday, the MicroProfile initiative was announced to inspire the community to overcome that hurdle together.

Categories: Java

Singletons Must Die

Javalobby Syndicated Feed - Wed, 29-Jun-16 01:01

I think it's too obvious to say that a singleton is an anti-pattern as there are tons of articles about that (singleton being an anti-pattern). However, more often than not, the question is how to define global things without a singleton; and the answer to that is not obvious for many of us. There are several examples: a database connection pool, a repository, a configuration map, etc. They all naturally seem to be "global"; but what do we do with them?

Perdita Durango (1997) by Álex de la IglesiaPerdita Durango (1997) by Álex de la Iglesia

I assume you already know what a singleton is and why it's an anti-pattern. If not, I recommend you read this StackOverflow thread: What is so bad about singletons?

Categories: Java

Design Patterns in the Real World: Strategy

Javalobby Syndicated Feed - Wed, 29-Jun-16 00:01

Quite some software engineers think that design patterns are some overly complicated, mythical, abstract things that bring no practical value to software development. This is unfortunate. In order to prove they are indeed something real, in this (and some upcoming) post(s) we are going to take a look at a few examples on how real software products implement some of the GoF design patterns. Today, we are going to visit Strategy, from HotSpot’s point of view. (See the previous post about Flyweight here).

Strategy Defined

Wikipedia defines Strategy as follows:

Categories: Java

Groovy Goodness: Represent Map as String

Javalobby Syndicated Feed - Tue, 28-Jun-16 23:01

Suggested zone: Java

Groovy adds to Map objects the toMapString method. With this method we can have a String representation of our Map. We can specify an argument for the maximum width of the generated String. Groovy will make sure as many key/value pairs as possible are added as a pair, before adding three dots (...) if the maximum size is exceeded.

def course = [
    name: 'Groovy 101',
    teacher: 'mrhaki',
    location: 'The Netherlands']

assert course.toMapString(15) == '[name:Groovy 101, ...]'
assert course.toMapString(25) == '[name:Groovy 101, teacher:mrhaki, ...]'

As mentioned in a previous post we can use the toListString method to represent a List as a String:

Categories: Java

Comparing Lombok and Kotlin

Javalobby Syndicated Feed - Tue, 28-Jun-16 22:01

I've known about Lombok for a long time, and I even wrote on how to create a new (at the time) @Delegate annotation. Despite this and even though I think it’s a great library, I’ve never used it in my projects. The reason for this is mostly because I consider setting up the Lombok agent across various IDEs and build tools too complex for my own taste in standard development teams.

In comes Kotlin, which has support for IDEs and build tools right out-of-the-box, plus seamless Java interoperability. So, I was wondering whether Lombok would still be relevant. In this article, I’ll check if Kotlin offers the same feature as Lombok and how. My goal is not to downplay Lombok’s features in any way, but to perform some fact-checking to let you decide what’s the right tool for you.

Categories: Java

Functional Programming in Pure Java: Functor and Monad Examples

Javalobby Syndicated Feed - Tue, 28-Jun-16 00:01

This article was initially an appendix in our Reactive Programming with RxJava book. However, an introduction to monads, albeit very much related to reactive programming, didn't suit that very well. So I decided to take it out and publish this separately as a blog post. I am aware that "my very own, half correct and half complete explanation of monads" is the new "Hello, world" on programming blogs. Yet the article looks at functors and monads from a specific angle of Java data structures and libraries. Thus I thought it's worthwhile to share.

RxJava was designed and built on top of very fundamental concepts like functors, monoids, and monads. Even though Rx was modeled initially for imperative C# language and we are learning about RxJava, working on top of a similarly imperative language, the library has its roots in functional programming. You should not be surprised after you realize how compact the RxJava API is. There are pretty much just a handful of core classes, typically immutable, and everything is composed using mostly pure functions.

Categories: Java

@MockBean—Spring Boot's Missing Ingredient

Javalobby Syndicated Feed - Mon, 27-Jun-16 23:01
The problem

I really liked Spring Boot’s concept, since I first saw it. The only thing, I felt, it was missing was better support for testing in general.

The Problem

It all started when I wanted to have a way to test 'current date' logic in my application. It was supposed to be a reusable, easy-to-use feature (via an annotation) in a custom Spring Boot Starter. The starter is based on Java 8, hence JSR-310 Date / Time API is a natural pick. Current date is only one of several things I want to make "mockable" in integration tests. There are other areas of functionality that are good candidates for mocking out. Keeping that in mind, I will use the ZonedDateTime class as a mocking example across the article.

Categories: Java

Overview of Spring Aspect Oriented Programming (AOP)

Javalobby Syndicated Feed - Mon, 27-Jun-16 22:01

In this blog post, Java web development professionals give a descriptive view about Spring Aspect Oriented Programming (AOP) for general readers. You will read about advantages, disadvantages, uses, and important terminologies with examples.

Advantages of Spring AOP

  1. AOP is non-invasive:
  • Service or Domain classes get advice by the aspects (cross-cutting concerns) without adding Spring AOP related classes or interfaces into the service or domain classes.
  • Allows the developers to concentrate on the business logic, instead of the cross-cutting concerns.

2. AOP is implemented in pure Java:

Categories: Java

Accurest Becomes Part of the Spring Cloud Contract

Javalobby Syndicated Feed - Mon, 27-Jun-16 21:01

I’m extremely happy to announce that we have successfully rebranded the Accurest project. It’s officially become part of the Spring Cloud Contract initiative. Ladies and Gentlemen please welcome the new projects:

A Little Bit of History

Accurest was created because of the lack of an easy-to-use tool for doing Consumer Driven Contracts. From our production experience, the biggest problem was the lack of verification that the defined contract actually does what it says it does. We wanted to ensure that tests are automatically generated from the contract so that we can have a proof that the stubs are reliable. Since there was no such tool, the first commit of Accurest took place on 12/2014. This idea and its implementation was initially set by Jakub Kubrynski and me. The last available version of Accurest was 1.1.0 released on 06/2016 (the docs for the old version are available here). During these 19 months, a lot of feedback has been gathered. The tool has received very good reception, and that made us want to work even harder. Many times we have missed out on good sleep, so as to fix a bug or develop a new feature in Accurest... it's been hard but rewarding work!

Categories: Java

Installing a Java Application as a Windows Service

Javalobby Syndicated Feed - Mon, 27-Jun-16 01:01

It sounds like something you’d never need, but sometimes, when you distribute end-user software, you may need to install a java program as a Windows service. I had to do it because I developed a tool for civil servants to automatically convert and push their Excel files to the opendata portal of my country. The tool has to run periodically, so it’s a prime candidate for a service (which would make the upload possible even if the civil servant forgets about this task altogether, and besides, repetitive manual upload is a waste of time).

Even though there are numerous posts and StackOverflow answers on the topic, it still took me a lot of time because of minor caveats and one important prerequisite that few people seemed to have – having a bundled JRE, so that nobody has to download and install a JRE (would complicate the installation process unnecessarily, and the target audience is not necessarily tech-savvy).

Categories: Java

Unit Testing JPA... Stop Integration Testing!

Javalobby Syndicated Feed - Mon, 27-Jun-16 00:01

I want to start by asking a simple question.

"How do you unit test your JPA classes?"

Categories: Java

Thread Slivers eBook at Amazon

Syndicate content