Java Lobby Announcements

Subscribe to Java Lobby Announcements feed
Recent posts in Java on DZone.com
Updated: 5 hours 37 min ago

Book Review: Java Puzzlers

Tue, 2016-02-09 14:31

Java Puzzlers is a nice book on the corner cases of the Java language, taken as an excuse to explain its inner workings. I have read it over the holidays and I found it a nice refresher over the perils of some of Java's features and types.

What You'll Learn

A first example of the feature under scrutiny is the casting of primitive types to each other (byte, char int), with the related overflows and unintended loss of precision. Getting to one of these conditions can result in an infinite loop, so it's definitely something you want to be able to debug in case it happens.

Categories: Java

Migrating From Java EE 5 to Java EE 7 at Segurnet Portugal

Tue, 2016-02-09 13:01

One of the most important things to do at this stage of the life-cycle of Java EE is highlight successful adoption stories at a regular cadence. We have been doing just that for a long time through our adoption stories blog, this humble blog as well as JavaOne. Indeed JavaOne 2015 was particularly good in this regard. We had a number of solid adoption stories submitted that we could select from. We will highlight all of those stories here in the coming months. A particularly nice adoption story presented at JavaOne 2016 was from Segurnet Portugal on migrating from Java EE 5 to Java EE 7. 

Segurnet is a data sharing platform for key insurers in Portugal. It used by 65 companies, about 30,000 users with close to 1.5 million page views and over 3 million server requests. Roberto Cortez detailed how the platform was recently migrated from legacy Java EE 5 to Java EE 7 - showing specific code examples. As the end result of the migration Roberto noted latest technology adoption, improved standardization, simplicity, a net reduction in code, an increase in productivity, faster deployment times and better performance. Roberto's experience is typical for anyone considering such a migration. You can view the session below (click here if you are having trouble seeing the embedded video):

Categories: Java

HTTP/2 and Servlet 4 in Java EE 8 (The Aquarium)

Tue, 2016-02-09 12:31

HTTP is very easily the most important standard in server-side Java. The much awaited HTTP/2 standard is now complete, was fifteen years in the making and promises to radically speed up the entire web through a series of fundamental protocol optimizations. Slated to be a part of Java EE 8, Servlet 4 is the primary vehicle for making HTTP/2 available to the server-side Java ecosystem. In a key JavaOne 2016 session, Servlet 4 specification leads Ed Burns and Shing wai Chan discussed Servlet 4 in detail. You can view the video below on the JavaOne 2016 YouTube playlist (click here if you can't see the embedded video). The slide deck for the talk is available here.

In the session, they took a detailed look at the changes in HTTP/2 and discussed how these changes will be adopted by the Servlet 4 specification as well as technologies like JSF.

Categories: Java

Using Factory Methods to Simulate Map Literals in Java

Tue, 2016-02-09 08:01

Unlike many modern programming languages, Java does not support the notion of a "map literal"—that is, a map whose contents are declared using a dedicated language construct rather than being instantiated and populated via explicit API calls. For example, in Swift it is possible to create a dictionary (the Swift equivalent of a Java map) using the following syntax:

var dictionary = ["a": 1, "b": 2, "c": 3]

The result of executing this code is identical to the following, more verbose, version, which first allocates the dictionary and then populates it:

Categories: Java

Java EE 8 MVC: Working With Path Parameters (JSR-371)

Mon, 2016-02-08 14:31

In the previous post, we saw how to work with query parameters in Java EE MVC. This post continues with a very similar topic: path parameters.

Path parameters are a dynamic part of the request path and can be specified with the @Path annotation.

Categories: Java

The Worst Mistake of Computer Science

Mon, 2016-02-08 13:01

Uglier than a Windows backslash, odder than ===, more common than PHP, more unfortunate than CORS, more disappointing than Java generics, more inconsistent than XMLHttpRequest, more confusing than a C preprocessor, flakier than MongoDB, and more regrettable than UTF-16, the worst mistake in computer science was introduced in 1965:

I call it my billion-dollar mistake… At that time, I was designing the first comprehensive type system for references in an object-oriented language. My goal was to ensure that all use of references should be absolutely safe, with checking performed automatically by the compiler. But I couldn’t resist the temptation to put in a null reference, simply because it was so easy to implement. This has led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years.
– Tony Hoare, inventor of ALGOL W.

Categories: Java

Java Dynamic Proxy: What is a Proxy and How can We Use It

Mon, 2016-02-08 12:31
What is a Proxy?

Proxy is a design pattern. We create and use proxy objects when we want to add or modify some functionality of an already existing class. The proxy object is used instead of the original one. Usually, the proxy objects have the same methods as the original one and in Java proxy classes usually extend the original class. The proxy has a handle to the original object and can call the method on that.

This way proxy classes can implement many things in a convenient way:

Categories: Java

The Dependency Inversion Principle (DIP or D in SOILD Principles)

Mon, 2016-02-08 09:01
What is the Dependency Inversion Principle?

Robert Martin defines it as “Depend on abstractions, not on concretions or, A. High-level modules should not depend upon low-level modules. Both should depend upon abstractions. Abstractions should not depend upon details B. Abstraction should not depend upon details. Details should depend upon abstractions.”

If you use both OCP and LSP strictly, you will notice how a new pattern or structure emerges from it that can be generalized into what is known as the Dependency Inversion Principle.

Categories: Java

Overview of Java's Escape Analysis

Sun, 2016-02-07 14:31
Take Advantage of the JVM's Escape Analysis

In my previous posts:

Categories: Java

Dynamic, Static, Optional, Structural Typing, and Engineering Challenges

Sun, 2016-02-07 12:31

Dynamic versus static typing is one of those confrontations that seams to attracts zealots. It really saddens me to see how people tend to defend vehemently their side simply because they are not able to understand the other position. In my opinion, if you do not get why both static and dynamic typing are great in certain situations you are an incomplete software developer. You have chosen to look at just a portion of the picture.

An engineer should be open-minded: it is ok to have your opinions but when you keep bashing ideas that made millions of developers very productive, chances are that you are missing something. Try being humble, you could end up learning something.

Categories: Java

Java Design Pattern Simplified - Part 1 of DJANGO Untamed Series

Sun, 2016-02-07 12:31

I am going to write a series of articles this year on my favorite topics of Distributed Computing, Java, Agile, NoSQL, and  Garbage Collection (a series known as "DJANGO Untamed").

This is the first topic of the series where I will talk about Java Design Patterns.

Categories: Java

The Magic Word in Java: CAFEBABE

Sat, 2016-02-06 14:31

A Java compiler compiles a Java Source code into bytecode and stores it in a .class file which is then get executed by JMV.

Well, we all know this, but do you know that all Java classes start with a magic word called – CAFE BABE?

Categories: Java

Creating Proxy Objects Using djcproxy

Sat, 2016-02-06 12:34

During the last few weeks I have shown how to create a proxy object using Java reflection API and cglib. In this article I will show you how this can be done using djcproxy.

Oh, not again, another proxy implementation!

Categories: Java

How We Accidentally Doubled Our JDBC Traffic With Hibernate

Sat, 2016-02-06 12:31

This post describes my recent experience with Hibernate ORM. Over the years the framework has not stopped to amaze me in regards of performance problems you can end up with while using it. I thought I had seen it all, but this time I was again caught off guard.

The foundation for the problem was built while troubleshooting a completely unrelated library causing problems in one of our production servers. To gather more insight about the original issue at hand, we increased the verbosity in the logback configuration.

Categories: Java

Building Reactive Systems with JavaFX

Fri, 2016-02-05 14:31

JavaFX is the new standard library for building graphical applications in Java, but many programmers out there is still stuck with Swing or even (tremble) AWT. Here are a few tips on how you can use many of the new awesome features in the JavaFX toolkit to build reactive and fast applications!

1. Property Values

If you have snooped around in the JavaFX components you must have come across the term Property. Almost every value in the FX library can be observed, the width of a divider, the size of an image, the text in a label, the children of a list as well as the status of a checkbox. Properties come in two categories; Writables and Readables. A writable value can be changed either using a setter or by directly modifying the property. JavaFX will handle the event processing and make sure every component that depends on the property will be notified. A readable value has methods that allow you to receive notifications when the value changes.

Categories: Java

Make Your Java Factories Beautiful

Fri, 2016-02-05 12:31
Make Your Java Factories Beautiful

Every Java programmer worth the name knows about the Factory Pattern. It is a convenient and standardized way to reduce coupling by teaching a component how to fish rather than giving it to them. When working with large systems, the pattern does, however, add a lot of boilerplate code to the system. For every entity, you need a number of different factories for producing different implementations of that entity, which is both tiresome and unnecessary to write.

Here is a typical example where you want a car trader to be able to create instances of the Car interface without knowing the exact implementation.

Categories: Java

OpenJDK - Is Now the Time?

Fri, 2016-02-05 09:01

At the end of December 2015, Google announced that they were replacing their implementation of the Oracle JavaAPI with the open source OpenJDK version. This change in direction appears to be related to the ongoing legal battle between Sun/Oracle and Google regarding copyright and patent infringement with Google's use of Java in developing the Android operating system.

This article isn't about the Sun/Oracle v Google legal battle. Instead, realizing that Google has now joined IBM, RedHat, and Apple (among others) in focusing on OpenJDK - I wonder if now is the time to consider OpenJDK as an option for JDK users.

Categories: Java

A Java Nightmare [comic]

Fri, 2016-02-05 07:02
Categories: Java

14 Ways for Devs and IT Professionals to Optimize Their LinkedIn Profile

Fri, 2016-02-05 03:26

LinkedIn has been an invaluable resource for me over the past 10+ years. I've used it to:

  • Connect with thousands of business professionals.
  • Source two million tons of spent mussel shells in two months when a nine-person procurement department wasn't able to do so in three years.
  • Identify potential suppliers for multifunction copier/scanner/fax machines in a city where I did not live.
  • Help connect business professionals with similar interests.
  • Update the CRM of an employer whose "new database" was already 10% "deprecated."

Recently several people have asked me to help them optimize their profiles as they've become aware of what they can accomplish on LinkedIn.

Categories: Java

Pivotal Academy Launches Updated Spring Classes

Thu, 2016-02-04 14:31

It has been 7 years now since I taught my first Spring class. At that time almost everything was XML and configuring JPA or Spring Security, for example, could be a lot of hard work. Spring has matured a great deal in the meantime with component-scanning, Java Configuration and Spring Boot making it much more fun to use.

At every stage, we have updated our Spring courses to reflect these changes and I am pleased to announce that our most popular Spring training courses - Core Spring, Spring Web, and Enterprise Spring - have been revised to align with the latest Spring 4.2 release. These courses include much more Spring Boot material and expanded coverage of features like Spring Data, Spring HATEOAS, Spring MVC Websockets, Spring XD, Spring Cloud and microservices.

Categories: Java

Pages