UPD: You can also read about various solutions to the redeployment problem in my Stackoverflow answer.
HotSwap and Hot deploy is not the same thing!
HotSwap and Hot deploy is not the same thing!
I'm not a big fan to ask to write code at the interviews. But I still find it useful to do some coding exercises at the whiteboard. One of my favourites is the Singleton pattern. Because Singleton is so simple, you can use it as a starter for so many interesting discussions.
it often comes down to the discussions about the Singleton being lazy or eager. And while it leads to the discussion about Java Memory Model, it's not the most interesting one. No one understands Java Memory Model anyway :)
BTW, did you know that a single-element enum type is the best way to implement a Singleton?
Yes! And you can't imagine how many people do fail with this. If you deploy 2 web applications with the same Singleton class, will there be two instances of the same Singleton or one? Of course, there isn't one true answer for this question - you have to ask the details. The the answer depends much on how the class is loaded. If the class is packaged within the WARs, then you get 2 instances of the Singleton.
This is why Singleton is such a great interview question - it opens a lot of topics for further discussion!
I have been interviewing candidates for Java developer jobs for a full decade at this point. I have tried various approaches for the interviews: various tests about language and the APIs, whiteboard programming, bug hunting, homework assessments, etc. There is no best approach for the interviews - it merely depends on the expectations, candidate background, position, day of the week, weather, whatever else.
Despite all the details, I’ve found one interview question that works like a charm. It is almost the best question to start with. And it is quite efficient in filtering the candidates early enough if have to screen a lot of candidates.
Here’ it is:
What is the different between final, finally & finalize?
How is this even a question, you would ask? Asking about the difference of the things that cannot be compared!? Well, apparently, a lot of developers can't make a clear difference. Those who don’t - you just don’t have to interview them further :)
OK, you asked this and candidate answered this brilliantly, now what? Well, I did tell you that it is a very good question to start with, didn’t I? Next, you can take it to any direction of your choice:
I hope you get my point now, why this strange question is a very good one for the Java interviews. Have fun!
I'll be speaking at JavaOne this year again! This time I have 2 talks accepted:
CON3597 - Having Fun with Javassist. This is merely a live coding session where I demonstrate various uses of the Javassist library for Java bytecode manipulation. I've delivered this talk multiple times and every time it is different as it turns out quite interactive and attendees usually ask questions right in the middle of the talk so I have to adjust the content as I go. Usually it's quite fun, so I enjoy presenting this talk.
CON6699 - What's the Best IDE for Java EE? I'm not sure how this one turns out - it's so much to talk about and so little time. I'll be presenting this talk along with Max Rydahl Andersen and Adam Bien. This time we're focusing solely on Java EE. Basically - it's and overview of what's available for Java EE users in Eclipse, NetBeans IDE, and IntelliJ IDEA.
Both the talks can be found in the content catalogue for JavaOne.
A Future that may be explicitly completed (setting its value and status), and may be used as a CompletionStage, supporting dependent functions and actions that trigger upon its completion.
Some time ago Tomasz published a really nice series of articles at his blog - worth reading!Java 8: Definitive guide to CompletableFuture
And there's more!
All the videos from GeekOut 2015 are available: http://2015.geekout.ee/videos/
Here are the two talks that seemed the most interesting to me:
From the very start, our users requested profiler capabilities in XRebel. As of 2.0, it is possible to get the performance overview for every request and identify the slowest methods.
The profiler view shows the time distribution in the call tree by assigning the percentages to the individual nodes that represent method invocations. The slowest methods are also accompanied with an extra percentage figure that indicates the method own contribution time.
JSP tag mapping is one neat little feature, new in XRebel 2.0. Instead of a cryptic runtime name XRebel displays the real JSP tag.
In 2.0, there are some more notable improvements to the existing features. The session component is now able to handle very large HTTP session snapshots. And of course, there's a ton of little UI improvements -- all to make the profiler more pleasant to use.
Links for XRebel:
Grails 3 was released just recently and with all the new stuff it looks really-really-really awesome release! (Really hope that Grails will find the new home now). The two key changes for me are 1) moving to Gradle instead of Gant, and 2) building on top of Spring Boot. NOw it looks like it's basically the Gradle project with custom conventions that are derived from Grails 2.x.
For the first time, it feels like Grails is not a toy framework any more :)
What's not that cool (my own very subjective opinion), is the introduction of application.yml. It's almost impossible to modify it without reading the documentation. Even XML version of it (yes!) would have been more practical.
There are many other nice things added - go look for yourself.
My personal interest with any new framework or server is usually related to the projects I'm working with. Thus, the first thing I wanted to check is how could I set up a -javaagent for Grails 3 application. Turns out, it's not as simple as you would expect.
Thanks to @bsideup, here's the snippet that you'd have to add to build.gradle file to setup a -javaagent argument, given that the agent JAR is located somewhere in file system:
In the example above, xrebel.jar is the agent package that is located somewhere in my file system. One can use the absolute path just fine in there.
Here's the another snippet, with DSL-style:
With this, I can confirm, that XRebel works with Grails 3 :)
IntelliJ IDEA 14.1 was released just recently with a good set of new features and improvements. Among other things, one really interesting feature that appeals to me is the new "distraction free mode".
Essentially, entering the distraction free mode means that you'd hide away everything but the editor.
The seasoned IntelliJ IDEA user would now ask, how is it different from "presentation mode" that is already available, or the full screen mode?
it would be helpful if @intellijidea explained the exact differences between 'presenation', 'distraction-free' and 'full screen' modes— Prashant Deva (@pdeva) March 24, 2015
This is a very good question! Let's try to answer that! :)
Presentation mode is designed essentially for delivering presentations. Some of my friends have adopted the presentation mode for actual coding. But to be honest, it only works fine if you have a reasonably large screen and you're not switching between windows while coding. This is how the whole screen looks like when IntelliJ IDEA is in presentation mode:
The default font size in presentation mode is much larger and can be configured in Settings -> Appearance & Behavior -> Appearance. Locate the setting at the bottom of the view:
Entering the full screen means exactly that. IDE window will span the full screen area. On Mac OS X it also means that it will take the application window to another desktop, which I actually dislike very much, but it's rather a personal preference. In this mode, nothing is changed in the IDE window - all the toolbars, views, etc are preserved.
Notice all the control elements and widgets at the screenshot above?
"Distraction free mode" is actually just a fancy name that the marketers came up with :) In fact, it just means that by entering this mode you only keep the editor. This might sound like you're actually entering the presentation mode, it's an incorrect conclusion. In distraction free mode the IDE window doesn't expand to full screen and the fonts are preserved in the original configuration. Basically, we could call this mode as "Hide all toolbars" and it would probably confuse some users less.
At the screenshot above, you can see - it's only the editor that occupies the IDE window. No toolbars, no status bar, no additional views, nothing! So this is exactly what I wanted and I'm really pleased with the new feature! In addition, the text is center-aligned!
What's also cool is that in this mode I can still navigate the same way as I'm used to it in the normal mode. Navigate to the project tree:
... or call out the navigation bar:
Just have to learn the shortcuts ;)
P.S. The new distraction free mode is really cool. However, it is not quite new. In fact, all this was possible long before version 14.1. Even in earlier versions of IntelliJ IDEA you can achieve the same, just not with one mouse click or shortcut press. In the earlier Intellij IDEA versions, in the View menu, you could just hide the toobar, tool buttons, status bar and navigation bar and here you go - you have a "distraction free mode"! :) So the new feature isn't really new. It is rather just a convenience that was added on top of the existing features.
java -jar mucommander.jar
$JAVA_HOME/bin/javapackager -deploy -native -outdir . -outfile mu.app \
-srcfiles mucommander.jar -appclass com.mucommander.Launcher -name "muCommander" \
muCommander-0_9_0 anton$ ls -l bundles/ total 269904 -rw-r--r--@ 1 anton staff 75110066 Mar 10 23:53 muCommander-1.0.dmg -rw-r--r-- 1 anton staff 63076596 Mar 10 23:53 muCommander-1.0.pkg drwxr-xr-x 3 anton staff 102 Mar 10 23:53 muCommander.appThe only missing bit there is a proper icon, which I was too lazy to bother about :)