Tag Archive: java

HikariCP

Fast, Faster, HikariCP

When it comes to application performances, bottlenecks like waiting too long for a specific page to load or triggering an API call which never returns – are easy to spot. In those cases it is obvious where problems are and where most of the execution time was spent. Of course, it is totally different thing, will you be able to resolve the noticed performance issues or not.

On the other side, there are many places in the application where time can be spent. Some used tools and libraries we take for granted and do not expect our logic is spending significant time running within them. This is a story about one specific case, in which application logic takes a lot of time to execute and how a simple change using HikariCP helped to cut the execution time in half.

Read more…

proper method naming matters

Proper Method Naming does Matter

We all have taught to choose good names for methods in the code we write. There are various coding style guides which set some ruling around method naming conventions and best practices. Although we tend to follow those in most cases, many times we forget to think will somebody else would be able to completely understand what method really does, by reading method name. Or, will our future self be able to clearly know the purpose of the method by reading this method name in 3 months after we wrote it. This is a short story about learning the hard way that proper method naming does matter.

Read more how we speeded up out our code by 95%

Devoxx

Devoxx Poland 2015 – Java Conference Summary

There are a lot of interesting tech conferences in 2016. If you want to stay up-to-date with the technology you are developing with (and you have available time and budget), there is some conference out there for you. Just do a simple google search to explore the possibilities. If you are quick enough in making up your mind and registering for a particular conference, you will most probably be able to get an early bird discounts. Last year I’ve visited Devoxx Poland in KrakowDevoxx is an annual European Java, agile, mobile and web conference. It was originally created by Belgian Java User Group. Last year the conference took place in Belgium, UK, France, Poland and Morocco. Many top industry speakers were talking about interesting topics. More than 10.000 developers visit those conferences annually.

Although it’s usually possible to watch all the presentations online (even for free), visiting a conference gives you some additional perspectives. One example: every day we got used to work in a team with some 5-10 other good Java developers. Just imagine how you would feel when you are at the same place with e.g. 2000+ other Java guys. And many smart people who present out there at the stage. It’s something you need to experience.

Devoxx Poland is my top choice for 2016 as well. For many reasons. Very well organized conference, great topics, great speakers, affordable price, to mention a few. Visiting Krakow in June is a nice experience, too.

In this post I will write a short review of the conference last year (2015).

Read about my summary of Devoxx Poland 2015

Functional programming

The Need for… Functional Programming

A Hardware Issue Became a Software Problem

During the last decades we are all witnesses of computer systems constantly improving in speed, efficiency, increasing space for storing data and decreasing the size of the components. The popular Moore’s law was a correct prediction that the number of transistors of the largest microprocessors will double about every two years, since 1970s. But increasing the number of transistors on a chip and increasing processor’s frequency, among other things, also requires exponentially more power.

Processors were originally developed with only one core. Around 2005, in order to continue delivering regular performance improvements for general-purpose processors, manufacturers such as Intel and AMD have turned to multi-core designs, sacrificing lower manufacturing-costs for higher performance in some applications and systems. (source Wikipedia)

Traditionally, computer software has been written for serial computation. To solve a problem, an algorithm is constructed and implemented as a serial stream of instructions, executed one at a time. In order to use the resources of a multi-core processor, some kind of parallel or concurrent execution approach became a need. Suddenly, due to the change applied by hardware manufacturers, software developers must rethink the design of their programs.

Read more…

Watch online recordings of Java Conferences from 2015

Visiting a conference is a very interesting experience. Plus you can meet some interesting people, hear what’s in hype, learn some new stuff and ask questions. On the other side, due to a budget and/or (what’s missing the most) available time, sometimes it’s not easy to participate to a conference. Nevertheless, this does not have to mean that you should not be able to watch online recordings of some of the interesting talks and presentations. If you search the internet and particularly Youtube, you will be surprised how much interesting stuff is available there. And all for free. Of course, what’s not free – is your free time. 🙂 You’ll have to find some and invest it in widening your horizons.

Since recently it somehow became a practice that many conferences (even big ones) publish recordings of the talks. In the Java world as well. So, if you have some time, you can enjoy recordings of major Java conferences and top industry speakers presentations. In this post I’ll share some links to Youtube playlists with recordings of Java conferences from 2015.

Get recordings of Java conference talks from 2015

vjug

Virtual Java User Group (vJUG)

For some time now I have an idea to start up a Java User Group (JUG) in my hometown. It is still on a level of idea but I’ve started to talk about it with some of the colleagues from local development community. Let’s see. Maybe it will happen some time soon. During my research on the internet, to see how other guys are doing it, I’ve encountered to a virtual Java user group (vJUG or virtualJUG, http://virtualjug.com), which has a global, worldwide level. I was keen to join and become a part of such a community. On top of that, I was very positively surprised when I saw what presentations are held and the speakers who presented them. James Gosling (creator of Java), Simon Ritter (since recently the head Java Evangelist at Oracle), Dr. Venkat Subramaniam (award-winning author, founder of Agile Developer, Inc., an instructional professor at the University of Houston), Matt Raible (technology evangelist, founder of AppFuse)… to name a few.  A lot of quality stuff there. It’s like an online Java conference all year long. And for free.

Read more about virtualJUG and how to join

Java 8

Moving from Java 6 to Java 8

Many of us are working on Java projects which have started some years ago. It is likely that those projects are implemented in Java 5 or 6 and are planned or already migrated to the latest version of Java. The most obvious reasons for moving from Java 6 to Java 8 are new language features and security improvements. Aside to this, Java 8 is a bigger milestone in the Java programming language history and brings Java development to a completely new level.

You can jump in and start coding in Java 8 using your previous Java programming experience. Code will compile, for sure. Java 8 is backward compatible with previous versions. But you will not be able to get advantage of the new features and new concepts without taking some time to explore and learn about them. There are many web sites describing new Java 8 features in detail, I would like here just to briefly list them. But, before that, I would recall important Java 7 features, which you may not had a chance to use, but could be quite handy.

Read more about Java 8 (and Java 7) features

Internal iterations

Internal Iterations in Java 8

Most of us learned in school to program in an imperative/structural/procedural way. Object oriented programming is also a type of procedural paradigm. In that context, when we are working with collections, we are iterating through them with some kind of for or for-each loops. We are telling the program how to perform the iteration and (within the loop) what do to with each processed element from the collection. Those is called external iteration. On the other side, in languages which support functional programming, you should focus only on ‘what’ and the underlying collection will take care of ‘how’ to perform iteration. Those are called internal iterations.

Read more about internal iterations in Java 8

Diffie-Hellman public key

Diffie-Hellman public key issue

If you are developing web applications that use HTTPS, it could happen to you this year (2015) that, all at a sudden, your browser refused to open the pages from your very own web application. And all this because some Diffie-Hellman public key, which appears to be weak. E.g. if you are using Google Chrome browser, most probably you started to see this problem after upgrading Chrome to version 45. The error message:

Server has a weak, ephemeral Diffie-Hellman public key

It actually means – your server’s DHE (Diffie-Hellman ephemeral key agreement) cipher, that allows Internet protocols to agree on a shared key, has less than 1024 bits. It is described in detail at weakdh.org. This problem could compromise connection security by the men-in-the-middle attack Logjam.

As of Java applications, and I assume your project uses Java 6 or Java 7, the main problem is that your application server (e.g. Apache Tomcat) is using by default Java Security Socket Extension (JSSE), which has it’s own DHE parameters which are 768-bit. This is considered weak and most recent versions of the browsers will refuse to establish a secure connection with your application server.

Read more about the options to fix this problem