Taking the scary out of Java in XPages: Prologue
Category java xpages
The discussion following my last post made stark the need for greater availability of information that makes the nature of Java more accessible to Domino developers. Credit for the title of this post goes to Declan, who is considering writing a series of blog posts on this topic. I will be doing the same; hopefully there will be a fair amount of duplication. As David Leedy is fond of stating, it's a good thing when several people share the same information, because that makes it easier for the people who need it to find it. And that's what's missing: an easy path to using Java in XPages.
My hope is to answer three questions:
When?
How?
What?
There's plenty of Why on my blog already. And I'm not the only one who's been advocating an increased use of Java in favor of other languages. But when does it make sense to define your business logic in Java instead of an alternative? In my opinion, that's the first question that needs to be more clearly answered. As several folks stated in the aforementioned discussion, if I simply tell you to use it for everything, that can be an intimidating answer. And, frankly, it's not realistic. At least, not right away. For most of you, the first time you directly make use of Java, it will be for a single use case within the context of an entire application that meets the users' needs via other means. Over time, you may find that you've reached a point where the majority of your code is written in Java. But that shift is likely to be gradual. And that's perfectly fine.
Suppose you've identified a specific use case for Java... now you need to know how to gain the benefits of Java just for that use case without impacting the rest of what your application does. Do you call Java classes that are already bundled with Domino? Or do you download a library that is entirely unrelated to Domino and call classes that are defined in that library? Or do you write your own classes entirely from scratch? Once you've decided, how do you actually do that?
Finally, it is crucial to know what the code needs to be. In time, you'll find that this is often the first question you'll be asking, not the last. And this entire process is recursive: as your exposure to Java increases, you'll become aware of the types of tasks it excels at, as well as the common programming problems that others have used it to solve; this will give you fresh opportunities to ask when it is appropriate to create a custom solution and when to just stand on someone else's shoulder, and to ask how to best integrate the resulting solution into your application and your broader Domino ecosystem.
I do understand that, for many, the prospect of learning Java seems difficult. I've been there too. My goal is to provide answers to these questions that demonstrate that XPages really do make it easy to put the power of Java to work for you. The truth is, it does this every day: XPages are Java... when we write code in any other language, we're just introducing another layer of abstraction that has to be translated back into Java anyway. And, if your experience is similar to mine, you'll find that the more that you discard those extra layers and just speak to the platform in its native tongue, the easier it becomes to do the very things that already feel difficult.
If the last 4.5 years have taught me anything about Domino, it's that when something I'm trying to do in XPages seems hard, it's because I'm fighting the platform somehow. Once I identify where I'm resisting it, where I'm not allowing it to be what it already is, whatever I was trying to accomplish instantly becomes easy. So if at times it seems like I'm disproportionately nonchalant, that's the reason. I'm not just hoping to convince you that Java is nothing to be afraid of, I'm hoping to show you just how easy it makes everything you want to do.
The discussion following my last post made stark the need for greater availability of information that makes the nature of Java more accessible to Domino developers. Credit for the title of this post goes to Declan, who is considering writing a series of blog posts on this topic. I will be doing the same; hopefully there will be a fair amount of duplication. As David Leedy is fond of stating, it's a good thing when several people share the same information, because that makes it easier for the people who need it to find it. And that's what's missing: an easy path to using Java in XPages.
My hope is to answer three questions:
When?
How?
What?
There's plenty of Why on my blog already. And I'm not the only one who's been advocating an increased use of Java in favor of other languages. But when does it make sense to define your business logic in Java instead of an alternative? In my opinion, that's the first question that needs to be more clearly answered. As several folks stated in the aforementioned discussion, if I simply tell you to use it for everything, that can be an intimidating answer. And, frankly, it's not realistic. At least, not right away. For most of you, the first time you directly make use of Java, it will be for a single use case within the context of an entire application that meets the users' needs via other means. Over time, you may find that you've reached a point where the majority of your code is written in Java. But that shift is likely to be gradual. And that's perfectly fine.
Suppose you've identified a specific use case for Java... now you need to know how to gain the benefits of Java just for that use case without impacting the rest of what your application does. Do you call Java classes that are already bundled with Domino? Or do you download a library that is entirely unrelated to Domino and call classes that are defined in that library? Or do you write your own classes entirely from scratch? Once you've decided, how do you actually do that?
Finally, it is crucial to know what the code needs to be. In time, you'll find that this is often the first question you'll be asking, not the last. And this entire process is recursive: as your exposure to Java increases, you'll become aware of the types of tasks it excels at, as well as the common programming problems that others have used it to solve; this will give you fresh opportunities to ask when it is appropriate to create a custom solution and when to just stand on someone else's shoulder, and to ask how to best integrate the resulting solution into your application and your broader Domino ecosystem.
I do understand that, for many, the prospect of learning Java seems difficult. I've been there too. My goal is to provide answers to these questions that demonstrate that XPages really do make it easy to put the power of Java to work for you. The truth is, it does this every day: XPages are Java... when we write code in any other language, we're just introducing another layer of abstraction that has to be translated back into Java anyway. And, if your experience is similar to mine, you'll find that the more that you discard those extra layers and just speak to the platform in its native tongue, the easier it becomes to do the very things that already feel difficult.
If the last 4.5 years have taught me anything about Domino, it's that when something I'm trying to do in XPages seems hard, it's because I'm fighting the platform somehow. Once I identify where I'm resisting it, where I'm not allowing it to be what it already is, whatever I was trying to accomplish instantly becomes easy. So if at times it seems like I'm disproportionately nonchalant, that's the reason. I'm not just hoping to convince you that Java is nothing to be afraid of, I'm hoping to show you just how easy it makes everything you want to do.

Comments
Posted by Thomas Duff At 12:20:39 AM On 02/27/2013 | - Website - |
I am in
Posted by mark roden At 07:11:02 AM On 02/27/2013 | - Website - |
Posted by Jeff Byrd At 07:37:50 AM On 02/27/2013 | - Website - |
/John
Posted by John Dalsgaard At 07:42:43 AM On 02/27/2013 | - Website - |
Posted by Brad Balassaitis At 08:11:33 AM On 02/27/2013 | - Website - |
I'm look forward to your posts. I've been using java on a daily basis for about a year now. The language itself isn't something I've struggled with and there are loads of examples out there on the web to help solve the majority of problems....
Were I come unstuck is planning true oop architecture. Its easy enough to create a bean that does several different operations but creating several classes that inherit off each other and use concepts such as polymorphism is a shade more difficult. We've all seen those examples of 'Vehicle' is a superclass and class 'Car' and class 'Motorbike' both inherit from it. Putting real life problems into those concepts is much more difficult and having the confidence to know you've done it in the best way possible as well...
So any light you can cast on that subject would be much appreciated.
Posted by Neil At 10:13:13 AM On 02/27/2013 | - Website - |
Posted by Rob McDonagh At 10:30:37 AM On 02/27/2013 | - Website - |
THIS.
Posted by Kathy Brown At 12:26:59 PM On 02/27/2013 | - Website - |
I second Kathy. This bit of wisdom is one of the main keys to being a great programmer on any platform.
Posted by Jesse Gallagher At 02:55:36 PM On 02/27/2013 | - Website - |
Posted by Julian Woodward At 04:05:03 AM On 02/28/2013 | - Website - |
Looking forward the read this series
Posted by Thomas Adrian At 03:26:25 PM On 02/28/2013 | - Website - |
<a href="{ Link } training in Chennai</a>
Posted by lisa At 01:00:00 AM On 05/14/2013 | - Website - |