Posts Tagged JavaUserGroup

Thoughts on Class Reloading and JavaRebel

A couple of days ago, I’ve attended Philly JUG for a talk titled Non-stop Java Development, presented by Ivo Magi of Zero Turnaround. The focus was on their product JavaRebel and how it can speed up development by cutting down on deployment time and on server restarts.

So what problem is JavaRebel trying to solve?  When you make code changes in the application you go through the usual cycle of:

{make-a-change} -> {waitFor: build-deploy-serverRestart} -> {check-the-change}.

JavaRebel claims to eliminate the second step of waiting for build/deploy and the need for restarting application server for the code changes to take affect.

No need to mention that I’m a big fan of open source model, JavaRebel is not in that category, it is a commercial tool. The presenter discussed about the available non-commercial options and why this product is better than the existing tools. As far as the available options (or approaches) there are two major ones — hot deploy and hot swap.

Hot deployment: When a class is changed build-deploy takes place without a need for a container restart. My experience with this so far has resulted in varied degrees of success. It works fine for a few times but had to restart the container/server after a few changes. (I also don’t have enough confidence that it can work effectively in a clustered production environment, but that is not the concentration of this post, it is the development time and how to minimize the wait time). OSGi approach is perhaps very similar to hot deploy except that it works at granular level on individual bundles, as opposed to updating the entire application.

Hot swap: An ability to change the class while a JVM is running, without the application ever noticing that. This is useful for the quick reload of classes during the debug time. If you change some functionality in the existing methods that works fine, but if you add a new method to a class or if you add a new class the changes are not detected.

Another option is that you may try your luck with some class loader hacks — loading the changed class in a different class loader, etc. I never tried it. Again, if anybody used this approach successfully please provide your comments. There are a few frameworks that were mentioned in the presentation that use this approach, I can only remember Tapestry at the moment.

As far as JavaRebel goes it extends the hot swap functionality.  It is implemeted as a JVM plugin (-javaagent). In simple terms an agent in JVM works like an interceptor in front of your main method. The -javaagent command line option is used to register custom instrumentation plugins. What I understood from the talk is that JavaRebel works at the class loader level, it doesn’t create new ones but extend the functionality of the existing class loaders.

Saving the application state after class reloads saves quite a bit of time, especially if you are working on a work flow kind of application and you are testing some step 8 of 10.  You can continue your test from where you stopped and doesn’t have to go back to step 1.

JavaRebel also seems to have some plugins to support popular web frameworks. I remember Spring, Guice and Struts were mentioned.

Obviously, I haven’t tried the tool so I can not make any recommendations. Try it for yourself and see if it suits your needs.

Tags: ,

Career 2.0: Take control of Your Life

Lots of good advice here. Take control of your life — that is precisely the theme of the talk that Jared Richardson presented at Twin cities JUG.  He addressed the key point of whether your career is a random product of your manager’s whims or companies needs, and provided some proven strategies to take control of your career. My notes from the presentation:

  • You may be a model employee, and perhaps the best employee that your employer might ever get. You work day-in and day-out on the proprietary software and that is your whole universe. Let’s say you get laid off, unfortunately, how much ever smart you are you may struggle to find a new job. Reason: your skills are so specific to your employer’s home-grown framework and not up to the standards of what market expects from you.
  • Who picks your skill set? Your manager assigns you work and you try to learn something out of it OR do you take extra effort to pick your own skill set. There is nothing wrong with the first option, but you should never rely on your company alone to keep your skills current and marketable.
  • Invest in your career
    • Regular deposit of knowledge: Keep learning, learn something new every day.
    • Pay yourself first: Learning and keeping skills current should be your top-most priority.
    • Diversify: Don’t put all your eggs in one basket, like depending on only one language or framework will not cut.
  • Set goals. Better come up with short term and specific goals, rather than longer term and vague goals. LOTY (in the spirit of pragmatic programmers) — Learn a new technology this year or learn one new language this year.
  • There are various ways you can improve the skill set:
    • Take that extra effort and learn the new technology or new tool after work, Jared calls it sanity hacking.
    • Contribute to open source. Tons of projects out there pick that interests you.
    • Join user groups (like JUGs) or clubs to learn and share knowledge.
    • Start a blog and share your thoughts and in turn learn from it.
    • Speak and present your ideas about topics that you are passionate about.
  • Blogging
    • It is too easy not to do! You can create a blog with absolutely no monetary investment (you may start small with Blogger).
    • On a daily basis you learn something or look up a resource that helps you solve a problem. Write about it, there are so many people out there desperate for solutions who will find your blog.
    • You are unique (no kidding!), you have your own experiences and perspectives. Share them, so as to get useful feedback. Bottom line is learning.
    • Post frequently (frequency may depend on your niche), and provide value.
    • Link to other people’s blogs. Knowledge is all around, don’t worry about losing visitors by outgoing links.
    • If you read books, then write a review.
    • Write tutorials or how-to articles. Even one page article could provide a great value.
    • DON’T blog about any proprietary stuff that you use at work.
    • Track blog statistics (using Google Analytics) so that you can understand what resonates with your audience and perhaps write follow-ups on popular articles. That is an opportunity for you to delve bit more deeper into the topic.
  • Writing Tips
    • Mind maps are an excellent way to brainstorm your ideas.
    • Use a wiki to jot down your ideas. There are portable wikis that you can carry in a USB drive, if that is your preference. JSPWiki is Jared’s favorite.
    • Hipster PDA (yes, a small notebook), keep that with you all the time to write down your ideas right at the moment.
    • Write every day even if it is only few paragraphs of the article. Keep the habit going.
  • Speaking: Give presentations or speak about a topic in your company or outside.
    • It makes you go deeper into the topic.
    • Start lunch-n-learn groups at work.
    • To overcome fear of public speaking and improve speaking skills sign-up for Toastmasters.
    • Video tape yourself and review it.
    • Practice, practice, practice.
  • In speaker’s own words — learn to lead with in your company and then stretch out to far greater influence outside, building your reputation as you go. From coding to writing to speaking, from each step you will gain new skill sets, gain confidence and get visibility which goes well beyond your resume. Most importantly, you will be in a position of having options and take control of your career.

P.S: What an advancement in the technology! Jared streamed his talk via his iPhone. Provided the broadcast link on Twitter and I happily attended from the comfort of my home, some 1200 miles away from the venue. Here is a direct link to the video that he recorded.

Tags: ,

Migrating from Struts to JSF — Philly JUG Talk

It was an interesting topic yesterday at the Philly Java User Group. Kito Mann, the author of Manning’s ‘JavaServer Faces’, was the speaker. He started off with an overview of the JSF and Struts Shale. Interestingly, not many people at the meeting were aware of the Struts Shale. It was nice knowing about Struts Shale and how it is built over JSF.

The speaker went on to explain various strategies to migrate — component usage, incremental migration and full migration. All in all it was an informative session.

I have started using JSF recently and started liking it. Development-wise it appears to be heading in the right direction. At this moment it doesn’t have the capability of doing the client-side stuff but there are ways to achieve that. Surely makes the life of a developer lot easier to concentrate more on the business layer of the application than the low level details. A good framework with a focus on event-oriented development.

Tags: ,