bannière

Suivre le cours Java Specialiste

Java offers companies substantial advantages over other systems. It is open, fast, secure. It has the ability to take advantage of modern computers with lots of CPUs. There are lots of advanced topics in Java, but very few publications that deal exclusively with these. In The Java Specialists' Newsletter, we look at topics that would be of interest to: Java Architects, Systems Programmers, Intermediate to Advanced Java Developers. The newsletter is read in 120 countries by 50,000 top Java programmers. There are over 180 newsletter available, most of which were written by Dr Heinz Kabutz. Dr Kabutz was elected as one of the first Java Champions, an elite group of Java experts recognised by Sun Microsystems as having shaped the Java landscape. Dr Kabutz authored the Java Specialist Master Course based on his research in writing the newsletters.

In our Java Specialist Master Course, we show you how you can improve your systems in the following ways:

Incorrectly implemented concurrent or parallel code, resulting in mistakes in their calculations.

In some cases this is just inconvenient, in others it is catastrophic. My course will show programmers how they need to reason about code that is accessed in parallel, to prevent deadlocks and data races, amongst other issues. One of our customers discovered that code that was working perfectly in Java 1.5 was now falling apart in Java 6. They had assumed that when we ask a Thread to wait for a set period of time, for example for one second, that it would indeed do so. However, the specification for wait has always been that the Thread might wake up earlier than specified. It is just that most programmers are unaware of this. In my course I show them how to code with the knowledge of what might go wrong, so that they can be assured that the behaviour is predictable.

Objects binary format optimization

Java allows us to interact with lots of different types of devices, for example, over the internet with other computers, with a database or with data on a disk. Since Java is Object Oriented, this interaction is often done using objects that are converted to bits and bytes. In my course I show the students how they can optimize the binary format of objects, to significantly decrease the bandwidth needed for communicating with various devices, whilst at the same time managing data migration should the object structure changes. A naive implementation of serialization, as this is called, can waste resources.

Supporting the maximum of concurrent users

In the past, we used to write computer programs in Java that had a direct correlation between the number of client connections and the number of threads (like small processes) used by the Java Virtual Machine. The number of client connections was thus limited to how many threads were supported. This code was easy to write, but it had an artificial limitation on how many users they could support at once. In my course, we look at how we can remove this artificial barrier by using non-blocking communication with our users. The code is more difficult than with blocking communication, but allows us to scale. One of my customers changed their system from blocking to non-blocking and went from 1000 concurrent users to now supporting 20 million. The initial change to non-blocking communication was the catalyst to scale the system.

Memory usage and optimisation

One of the questions I ask my students - how much memory do you think the character string "Jim" takes? In the old language C, this would occupy 4 bytes. In Java, every character uses two bytes. However, in Java, every object also knows what type it is, information that is not available in C++. Turns out that in Java 64-bit, the character string "Jim" occupies a shopping 72 bytes! I show my students how and why the memory usage is so high. We look at some of the behaviours of the memory management system, called the garbage collector, and how to configure it. We end off this section by looking at how we can avoid using up too much memory with some special types of references that can act like a pressure release valve to let off some steam when memory is low. These are used over 100 times in the JDK alone.

Reflection

Java has some dark magic called reflection. This allows us to produce code that can dynamically adapt itself. The techniques shown here can be extremely useful for writing flexible code that can understand third-party objects. In this course, we show you how you can manipulate Java underneath the hood. We show you the benefits of being able to do this, but also consider the dangers. With one of my customers, we were able to replace 600,000 code statements with a single 100 statement dynamic proxy, significantly reducing the maintenance load.

Optimized Data Structures

There are some problems in computer programming that are very difficult to solve. Even if we solve them for a small amount of data, once the data size increases, the problem might become intractable (impossible to solve within a billion years). One of our customers had a database query that joined together very large tables, which resulted in one single lookup taking twelve hours. We discovered this and proposed a solution that reduced the complexity of the lookup, so that it eventually completed in under a second. In our course, we will have a look at what data structures are available in Java and will show how they will behave as our data becomes large. We also look at how best to access them in parallel, without breaking them in the process.

How to deal with Exceptional situations

One of the signs of a brittle system that I look for when I do an external code review, is how well the code is prepared for exceptional circumstances. What happens if the database suddenly shuts down? What happens if the file is deleted from the disk? Programmers are usually optimistic about their systems, thinking that nothing will ever go wrong. We have a look at best practices when dealing with exceptional situations.

Optimize the code and finding bottlenecks

Companies invest millions of dollars in producing software that is correct. However, the code then often fails when it does not work fast enough. The mantra: make it run, make it right, make it fast, is supposed to focus us on first producing correct code and then optimizing it. However, most companies change the mantra to: make it run, make it right, sell it! Computers used to get twice as fast every two years. Since projects usually took two years to complete, we could write sloppy code and then get bailed out by the increase in hardware performance. Nowadays, computer speed does not increase that much, but instead they become more parallelised. We thus have to be very careful with how we write our code, that we optimize those parts which are significant. At the same time, writing fast code can make your system harder to maintain. Companies can go out of business when they produce systems that are not easy to modify. In this course we show you how to discover the bottlenecks and tricks on how to make that code faster.

Logging

In complex systems, a myriad of things can go wrong and we want to be able to trace back through the logs to find out how we got to the bad state. We have a brief look at some best practices with logging and how to set them up optimally.

The ideal candidate for this course will have 2 years Java programming experience and will be happy to get his fingers dirty writing some code. The course is practical with a lot of time spent with demonstrations and labs. We have a course preparation that students should look at in order to be ready for the course: http://www.javaspecialists.eu/courses/master/JavaSpecialistMasterCoursePrep.pdf