Tuesday, November 23, 2010

To the cloud???

Many of you have likely seen the latest commercials from Microsoft using the tagline "To the cloud...". If you're like me (and probably most other people that are in IT), you've probably tried to figure out what a couple of people at the airport looking at family photos or watching TV has to do with this new buzzword "Cloud Computing"(or I guess that its more accurate to call it a buzz-phrase).

Well, I wish I could answer that question, but in an attempt to help wrap my head around this latest paradigm, I'll try to organize my thoughts around some of the concepts of cloud computing.

When talking about cloud computing, there are a couple of types of clouds that come up, mainly
  • private clouds
  • public clouds
Public and Private Clouds are just what you would expect them to be. Public clouds are generally computing infrastructures that were set up by some service provider to "sell" as a service to its customers. Private clouds are similar computing infrastructures, but generally created and maintained by an organization for its own use. Easy enough so far.

Regardless of whether or not it is public or private, the bigger question is "What the heck is a cloud?". Well, like a lot of new technology buzzwords or concepts, the answer is often "It depends". In this case, there seem to be many different "levels" for computing within a cloud. One good way of classifying the cloud computing options is to look at the level of the stack that they are servicing. With this approach, there appear to be a few different options for providing solutions from the cloud:
  • IAAS (Infrastructure As A Service)
  • PAAS (Platform As A Service)
  • SAAS (Software As A Service)
  • DAAS (Desktop As A Service)
IAAS
This seems to be the cloud offering that is at the lowest level of the stack. It is generally a computing infrastructure that is provided to the client (essentially at the operating system level). This is somewhat analogous to "virtualization", where a single physical machines can be partitioned and then treated as multiple logical machines (just on a different scale, with many physical machines serving as many more logical machines). However, it can sometimes be the inverse, with many physical machines looking like a single logical machine (more of a clustering approach). All of this is somewhat transparent to the individual logical machines.

PAAS
The Platform As A Service approach takes it up another level, generally providing some sort of software or application stack as part of the service (like a Java Application Server with a Database implementation, or a LAMP stack, or some other similar offering). This offering is generally considered as a deployment infrastructure for an application that can shrink and grow with user demand for that application.

SAAS
This approach takes it up yet another level, generally offering some sort of application as a service from the cloud. The classic example for this type of cloud offering is Salesforce.com (SFDC). Where it comes a bit more challenging in my mind is how to separate this from normal web applications. What is different in an SAAS offering that makes is "cloud"? Or is it just a fancy way of saying web application? For example, would you consider most online email offerings as "cloud" applications (or SAAS)? If that's the case, you can probably roll in Google Apps, as well as other web-based application services (including the software used to run this blog).

DAAS
The Desktop As A Service is a relatively newer term (at least to me), but the concept has been around for some time. It is roughly analagous to the desktop virtualization and conceptually similar to the platform virtualization discussed above. It seems to be a fancy method of referring to some of the remote access and remote control technologies used in the past, and not really indicative of the cloud computing movement that most enterprise vendors are pushing (near as I can tell).

In fact, referring to DAAS as a "cloud" technology doesn't quite make sense to me, but this seems to be at least part of Microsoft's vision for the cloud (based on the commercial that I mentioned in the beginning of this post, where there are a couple of people stuck at an airport, and appear to connect to their home PC over the web and look at photos or watch some recorded TV shows).

As you can see, there are many differing visions for this "cloud" future (depending on which vendor you ask), and I'm still not quite sure which one I buy into. In reality, I suspect there is a place for several, if not all, of these versions of the cloud. Like all other technology solutions, the correct choice will likely depend on the business problem that you are trying to solve...

Wednesday, September 15, 2010

Troubleshooting Web Services (tcpmon)

I stumbled across a useful little tool this week while struggling with the IBM Content Manager Web Services server. If you need to get a look at the SOAP requests and responses getting passed over the wire, here is a cheap (as in free) utility - its called tcpmon.

I think it was originally started under the Apache Axis project, but it is now hosted on java.net (click here to go to the tcpmon homepage).

While there are also commercial tools to do this, its always nice to find a simple and free tool that gets the job done. Its a pretty intuitive utility, that basically acts as a go-between for the client and server, echoing any tcp traffic that passes through it.

I won't go into too many details (there are plenty of other tutorials available on the internet, just a google away), but one thing worth pointing out is how to configure the target host and your client for the web service (since most of the examples don't contain any path info on the URLs, which is pretty common for any web service requests).

First, if the URL of your web service is http://my.service.com/services/myservice, configure tcpmon like this:



And then, when you create your client stub for the web service (if you are using Axis2 and pass in a String for the target endpoint), create it this way:


MyWebServiceStub stub = new MyWebServiceStub("http://localhost/services/myservice");


Instead of the normal way, without the tcpmon as the "man-in-the-middle".

MyWebServiceStub stub = new MyWebServiceStub("http://my.service.com/services/myservice");

A couple of other points worth mentioning:
  • It can run as a standalone app (from a downloaded jar file) or over the web via JNLP. The 'official' version is also available as a NetBeans plug-in.
  • Some enterprising developers also ported a plug-in version for eclipse available here (thanks guys). The main benefit here is that it is just runnable within eclipse, with the GUI visible as a console view. Installation is simple - just drop the jar file into the plugin folder for eclipse (.../ECLIPSE_HOME/plugin/).
  • One thing I noticed within the GUI for the eclipse plug-in is that it also seems to have support for a proxy server (as a firewall pass through to external URLs). I don't see similar configuration options on the standalone version (not sure if this is a difference or not, but thought it was worth mentioning).
  • If you run into trouble getting everything connected (getting a java.net.UnknownHostException), consider trying both the listener and target port to 80 (in case there are firewalls, or other security settings affecting communication over nonstandard ports that are often suggested in the tutorials).
  • It can also be beneficial to just try configuring connectivity to a simple html page, to understand the setup before trying to snoop on a web service (paths, etc.)
Thanks to Charitha Kankanamge's Blog for pointing me in the right direction...

Monday, March 8, 2010

Code Syntax Highlighting - The Sequel

Time for an update. I've followed the advice of some fellow bloggers and configured the Syntax Highlighter JavaScript library.

Here's the world famous highlighter at work:


// Hello.java
import javax.swing.JApplet;
import java.awt.Graphics;

public class Hello extends JApplet
{
public void paintComponent(Graphics g)
{
g.drawString("Hello, world!", 65, 95);
}
}

So, was that worth the wait?

For the record, it wasn't really that hard, but I still think its something that should be built into the blog editor.

Thanks to Alex Gorbatchev, Carter Cole, Hendy Irawan, and all the other posters that helped get me here...

Thursday, March 4, 2010

Technical Blogs (Code Syntax Highlighting)

I realize that I am relatively new to blogging, but I have to say that I am a bit surprised at the immaturity of some of the editing capabilities built into most blogging platforms (mainly in the formatting options that are available).

I've used plenty of wiki platforms that have very nice code formatting tags (along with many, many others) built right in, but apparently the easiest way to show some Java code examples on blogger is to use the SyntaxHighlighter JavaScript libraries from Alex Gorbatchev.

I'm not looking for anything fancy, just something simple, like this:

// Hello.java 
import javax.swing.JApplet;
import java.awt.Graphics;   

public class Hello extends JApplet 
{     
   public void paintComponent(Graphics g) 
   {         
      g.drawString("Hello, world!", 65, 95);     
   }     
}

One answer is to just copy and paste from another HTML/wiki editor (like I did above), but that seems like too much of a kludge to the developer in me. The blogger editor didn't really like it, it wasn't very clean, and I lost some of the formatting (courier font, etc.). There's got to be a better way.

After searching longer than I should have, for something that I figured would be a very easy thing (display code in a blog), I've found a couple posts that lay it pretty clearly. And honestly, I'm sure its not that hard, but to me this seems like a pretty big oversight (aren't blogs typically targeting a relatively technical audience, and I think code would be a pretty frequent topic for display in a blog).

I apologize if this comes across as being harsh, but I still remember the first time that I used an editor that had color syntax highlighting (yes, I know that I am dating myself, and yes, I said editor and not IDE, because thats all it was - TextPad, for those of you that are familiar). After my first experience with syntax highlighting, I was hooked - coolness factor aside, I think its a huge productivity boost and development aid. It was probably one of the first steps towards many of the productivity gains offered by today's IDEs (maybe that's a topic for another day?)

Maybe I'm wrong about blogger's capabilities, so please tell me if there is an easier way to do this. Otherwise, I guess that I'll get to work on pulling those JavaScript libraries into my blog template, so that I can actually start on the next post that I was planning...

Thursday, February 18, 2010

Annotations - Good, Bad, or Ugly?

In my workplace, we are currently in the process of moving towards JDK 1.5 (I know, we're not on the cutting edge of technology, with many apps still on JDK 1.4 and even 1.3).

As such, I am finally taking the time to dig into some of the newer Java features. Annotations are one item that was introduced with JDK 1.5 (or I guess its called Java 5 now) that I haven't made up my mind about yet.

Annotations, simply put, are a facility within Java for providing meta-data about code. From what I can tell so far, there are a couple different flavors (or uses) for this meta-data:
  • documentation (acting essentially as a form of structured comments within the source code)
  • compiler information (to provide a little clearer instructions to the compiler about how to handle the code - things like @Deprecated, @Override, @SuppressWarnings are all pretty clear in what they are telling the compiler)
  • specialized processing (I suspect that this will more likely be used by frameworks, etc.)
In fact, my main exposure to annotations so far are from the Spring documentation (can you tell that I'm a fan of Spring?) It seems to be a way to remove some of the restrictions based on naming conventions, as well as a means of simplifying the XML configuration files (which I admit can get cumbersome).

I can see some advantages for using annotations, but I can also see it getting easy to mix in environment specific or configuration information that really shouldn't be embedded in the code.

More to come on this topic, but to answer the question posed in the title of this blog, I suspect its going to be like many other technologies - has some benefits when used properly, but can be easily abused (or used for the wrong reason).

Friday, February 5, 2010

Oracle + Sun = ???

I know that this whole thing started long ago, and there's been a lot said (and written) about this topic, but I still haven't made up my mind about the overall impact. Particularly on Java - which is near and dear to my heart. Their main emphasis so far seems to be on the fact that they can now offer the full stack; from low-level hardware to software, including multiple enterprise applications spanning several verticals. But what is this going to mean to the peons that are still in the trenches, slinging code every day?

On the one hand - we now have a company with deep pockets and the ability to invest in Java as a platform. Oracle is saying that they plan to hire close to 2,000 people, many of which are expected to be technical (engineers, etc.). You might expect this to create significant growth in Java, along with better (and simpler) integration with all of the software/tools/frameworks already under the Oracle umbrella.

They are also pledging "certified" systems and unique support opportunities, where there is only "one place to call' to resolve issues. While this all sound great in the board room, how is this going to translate in the real world?

Well, I don't have the answer to that, other than to say that the only certainty is that things will change. Particularly in areas where there is clear overlap between the Sun and Oracle offerings, things like:
  • Development tools - I don't see JDeveloper and NetBeans co-existing (and Oracle has made no secrets about sticking with its "own" tools as the strategic direction for most products).
  • Application servers - While GlassFish is touted as the reference implementation with and "enterprise-ready" feel, it pretty clearly overlaps the current Weblogic offering.
  • Database servers - Clearly, no one expects MySQL to just go away, but its hard to know how that will play with product that drive Oracle's rise, their own flagship database.
There are other cultural differences that may play into things too - regarding open source directions, Java Community Process, and general approach to innovation Sun had more of a history of supporting projects that looked innovative, regardless of whether or not they would lead to real revenue. While this may have been a factor in their demise, I still am concerned about the prospects of losing choices in these areas.

I guess we'll just have to wait and see what the future brings, but if history is any indicator, I don't think the change will happen overnight. These things always take time...

Friday, January 29, 2010

Learning Java? Look at Spring

For those that are learning Java, or those that want to improve their skills, I highly recommend learning about the Spring framework.

Initially, just using it will help enforce good design principles within your applications, but if you want to truly grow as a developer (and designer), you should dig into the details and understand the implementation of Spring. It applies good design principles consistently (like separating interface from implementation), and can be a good reference for understanding how to use design patterns. For example, JdbcTemplate is a classic use of the Template pattern (or Template Method, depending on who you ask).

In fact, the JDBCTemplate is probably the best place for those that are new to Spring to get started. It is a valuable addition to most applications that use JDBC, even if no other Spring services are utilized. It can be a straightforward introduction of Spring into an application (or even an organization). It really simplifies the use of JDBC by handling much of the common plumbing work that is required, and lets the developer focus on the business logic.

By understanding how these patterns are applied within Spring (and the the problems that they are solving), you will begin to recognize similar problems in the applications that you build - and apply the appropriate patterns to solve them.

Its as simple as starting with the javadoc to look at the class structure and hierarchy, but I would encourage you to go further and actually step through the running code in a debugger to be sure that you understand the call path - I have always found the debugger to be an invaluable resource when trying to understand code behavior.