Tutorial:

Writing Java code in the cloud

By Cameron McKenzie and James Denman

TheServerSide.com

Even as cloud vendors and virtual computing providers boast about how moving to the cloud is a seamless process, those with experience know that the drastic move away from an in-house data center to deployment in the cloud is a complicated path. Everything -- from the deployment process to the manner in which applications are monitored, debugged and tuned for performance -- is different. When differences arise, so do problems.

But the road bumps one experiences when they drive towards cloud computing can be avoided, especially when one has the opportunity to learn from the experiences of those who have gone before. Consider this guide your GPS for navigating through the new landscape of cloud computing.

What is the cloud, and is it the right time for adoption?

Every few years the IT industry is inundated with new terms and technologies, some of which become immensely popular, while others seem to fizzle out and disappear. So, what about cloud computing? What is it, and is there substance behind the hype?

Not so long ago, SOA was the buzzword. Looking back, Rod Johnson, the founder of Spring, opined that a service-oriented architecture "was something that is very sound at an architectural practice level, but in terms of selling product, [SOA] was really an artificial, marketing-created concept." He went on to contrast cloud with SOA by saying, "In the case of cloud computing, however, there is more substance behind it. However, that substance is obscured by the fact that cloud could mean just about anything to anyone." I Johnson justifies why cloud is here for the long run in the case of Cloud vs. SOA.

Still, others reiterate that cloud is not an IT panacea. TheServerSide contributor Andrew Townsend points out that, "Cloud computing provides a ready-made infrastructure, that is maintained by the cloud service provider, for an organization without spending any money upfront. However, the cloud may not be suitable for everyone. His list of situations where moving to the cloud does not make sense includes some obvious cases, like those organizations who have to operate in areas where Internet connections are slow or unreliable and may be cut off from a public cloud. He also includes some less obvious mismatches, like organizations that operate in geopolitical areas that mandate data tracking or organizations whose mission critical apps are better serviced by full-time, in house IT, than an external cloud service provider could match.

Extreme scaling in the cloud

Interestingly, the Java programming language itself, due to the way it manages references and collections, will often generate problems when infinitely scaling, which is why so many other programming languages that run on the Java platform are becoming popular. Maybe the most popular language for scalable computing in the cloud is Scala. But writing in Scala is by no means the only way to write solid scalable code for a cloud computing infrastructure.

Some developers are finding success with Enterprise JavaBeans (EJB) on the Spring framework. The Spring/EJB approach to coding in the cloud is based on a fairly traditional layered architecture with separate layers for business and presentation layers that can be deployed separately, which can ease the integration of cloud technologies for improved scalability.

There are also experts out there who understand how to design systems for scalability without specific tools for increasing scalability. For instance, Martin Abbott and Michael Fisher wrote a book of 50 scalability rules that lead to more scalable design and therefore more scalable cloud applications. Their rules for building scalable systems covers both software and hardware concerns. They admonish against using "Select *" and explain that it is better to specify the columns you're looking for. They also bring up some easy to overlook hardware advice such as using the same vendor for all your nuts and bolts networking needs like switches and routers, because mixed networking gear can cause signal routing overhead that can build up quickly as you scale up.

Cloud computing as a Java development platform

The cloud has something for most roles in enterprise computing, from project managers and enterprise architects to application developers and deployment gurus. And it has some amazing benefits and features that Java developers can take advantage of too. Here’s some insight on how cloud computing can make you a better developer.

There are many advantages a Platform as a Service (PaaS) cloud architecture may bring to an enterprise development team. The PaaS model allows development teams that are working with applications in the cloud to go beyond maintaining the existing business applications and legacy infrastructure and start to replace those with newer, more easily integrated cloud applications. The month-by-month pay scale of PaaS allows the business end to fund a short-term project with little to no risk of being locked into a long, expensive modernization struggle. But be careful with this first project because first impressions are the longest lasting, and a PaaS trial program will probably make you some great friends or powerful foes on the business side.

Another of the advantages to using a cloud platform for developing enterprise applications is the relative ease of trouble shooting the applications. With an enterprise application in the cloud, the development team can take snapshots of the environment during troubled times and enlist the expert eye of an experienced cloud guru. There are several advantages to snapshots in the cloud over traditional testing with build images. Cloud snapshots record particular environmental factors that are effecting the underperforming application in the actual runtime environment. These problem factors may not be present if one were to redeploy the application on a test server.

The new cloud technologies, however, can create turmoil within the development team. Java developers often have a broad range of in-depth skills, but dealing with a cloud infrastructure may be a new challenge for many of them. For example, most Java developers are familiar with a plethora of tricks that save CPU cycles, but with the cloud model CPU power is plentiful and it's more important to focus on saving bandwidth. Like most new technologies though, cloud computing will make life easier for the developer once they have a chance to build some strong PaaS skills.

 


VIDEOS- Click the image to view the video

 

Rod Johnson, Creator of the Spring framework

What we can learn from the rails community

As we move toward a future IT model dominated by cloud computing, the Java community might do well to learn from the Rails community, according to Rod Johnson, the creator of the Spring framework. Johnson explained in his presentation at the 2011 Java Symposium that the Rails community does a better job of moving to newer and simpler ways of getting things done. He emphasized the need to stop reinventing the wheel. In his own words: "I think a lot of CIOs are getting to the point now where they think, 'We’ve got to be more consistent, we’ve got to be a lot simpler, we can’t keep going and reinventing the wheel constantly.' So on the one hand, I think there are undoubted sensitivities about getting some of that stuff in the public cloud, but on the other hand, this kind of desire to simplify is strong; let’s just not reinvent the wheel every time."

The virtues of hash tables and Ram

I've never got it when it comes to SQL databases. It's like, why? Just give me a hash table and a [ton] of RAM and I'm happy.
-James Gosling, BasementCoders Interview

For many cloud applications, a traditional relational database is not the best solution. The NoSQL approach (which coincides with Goslings hash tables and tons of RAM approach) is frequently the preferred method for highly scalable applications, like Facebook and Twitter. Still, for reporting-heavy applications an RDB is still the tried and true method of choice. Choosing the right data design is an important decision.

 

Systems convergence with the cloud

The explosion of data and cloud-based application deployments in businesses today are driving a convergence between event-driven architecture, business rules and business process management (BPM), said JBOSS middleware expert Ashesh Badani in an interview at JavaOne 2010.

 

 

Cloud computing pain points

The Java developer's cloud computing pain points include challenges in capacity planning, building and maintaining effective policies, and increasing needs for flexibility in programming, according to Ashesh Badani, Senior Director of JBOSS Enterprise Middleware for Red Hat. In this video, Badani describes the challenges that developers face in creating apps for and maintaining apps in the cloud.

11 Nov 2011

Related Content

Related glossary terms

Terms from Whatis.com − the technology online dictionary
Java development for cloud

Related Resources