Welcome!

Java IoT Authors: APM Blog, Jnan Dash, Elizabeth White, Stackify Blog, Liz McMillan

Related Topics: Java IoT

Java IoT: Article

The Many Sides of J2EE Development

The Many Sides of J2EE Development

There are many facets to J2EE Web application development. It's a powerful platform that offers a variety of possibilities and capabilities, with many different approaches and models of development available. This is both a strength and, for newcomers to the platform, an Achilles' heel.

In this installment of Journeyman J2EE, we look at the many sides of J2EE development with a focus on the diversity, dichotomy, and divided opinions that can challenge even experienced developers, but especially newcomers. Consider these some warning signs on the road to J2EE.

So Much to Learn, Who to Believe?
In the previous Journeyman J2EE (JDJ, Vol. 6, issue 9) I discussed the importance of continuous learning as a J2EE Web application developer, especially for those making the transition from other platforms such as ASP, PHP, and ColdFusion. This extends beyond the obvious matters of learning the Java language, JSP programming, and/or the servlet API.

Of course, there are all the other APIs available in the platform, including JDBC, JMS, JNDI, JTA, and RMI, that you may or may not need to learn about at the outset. If you need to use any of them, it will be rather obvious but they're worth persuing as time permits.

You may also need to learn about EJBs, but this can be yet another source of confusion as there are many opinions about their role. More about that later.

Even the simple choice of whether to use servlets or JSPs is beset by many arguments for and against. Just when you think you may have a handle on the debates and best practices, you may encounter discussions of design patterns, which can be a great resource for applying reusable design techniques but is yet another set of practices to learn and apply. (See the J2EE Blueprints at http://java.sun.com/j2ee/blueprints/index.html for more information.)

It's enough to make your head spin if you're coming from one of the aforementioned Web development platforms. In those communities we knew the enemy and the enemy was "them" - all the developers using other platforms. Okay, that's stretching it, but as much as there may have been debate within each community about best practices for implementing apps, nothing comes close to the incredible variety of approaches (and opinions) about how best to do J2EE Web application development.

There's no use crying about it. The Java platform is incredibly rich, and this variety speaks to the many different ways in which the tools can solve problems for a wide range of applications. One of the key problems I find in discussions about alternative approaches (or rather a problem I have with naming "best practices") is that what works for one situation may not be the best solution for another.

A frequent source of confusion is the matter of whether you're programming "in the small" or "in the large." In other words, are you developing a rather simple application, displaying just a few pages to be used by a relatively small audience, or are you developing a full-blown e-commerce application with authentication and authorization, database transaction processing, session handling, personalization, internationalization, and more that will be implemented on a cluster of servers with distributed processing?

What makes sense in the former case may fall woefully on its face in the other. By the same token, the approaches taken in the latter case may be overkill for the first. It's a delicate balancing act and the decision often falls on folks who don't have the time or experience to entirely grasp the ramifications of the many approaches. It's daunting, and some are forced to make quick (and perhaps ill-informed) decisions.

Let's look a little more closely at some of the debates. We don't have time to resolve or even carefully cover all of them, nor all facets of each, but they'll give you a taste of what you're in for if you're just getting into this brave new world.

Servlets or JSPs? You Decide
As I mentioned before, the decision of how best to use servlets and JSPs is no simple task. Should you use one or the other? Or both? Many applaud JSPs for making Java server Web development easier for many people. They're similar to other Web application scripting tools and hide some of the challenges of learning Java when getting started. Indeed, others will laud that they make it possible to split development roles among Java developers and pure page designers (who should just ignore the occasional directive or action element and might even be able to create JSPs with WYSIWYG design tools).

The reality for many developers, however, is that they are the designer, Web developer, and Java programmer (or newcomer) and that separation of roles isn't as important. It's for this audience though that others will argue that JSPs will cause a developer to shoot him- or herself in the foot, littering pages with embedded Java scriptlets, JDBC calls, and otherwise corrupting the vaunted Model/View/Controller (MVC) paradigm, which calls for the separation of data display, request processing, and business logic.

Some go further and plain decry JSPs in general as a poorly designed development approach, as argued in the article "JSP: You Make the Decision," by Jon Stevens (JDJ, Vol. 6, issue 7), which supports the Velocity Template Language as an alternative.

Others will argue that servlets are the only way to go; yet even among servlet fans there are debates about how to implement them. Should you have a central controller servlet through which all requests pass or not? The same argument can be debated in JSP development as well.

It seems that for most, a mix of servlets and JSPs is the way to go, and the O'Reilly title, JavaServer Pages by Hans Bergsten, does a great job of discussing the many different approaches (including integrating servlets with JSPs), with an especially lucid perspective that suits relative newcomers. I'd like to publicly applaud his book for doing a great service for those facing these frequently fractious debates. Notice that I'm not taking sides: my point it that you need to carefully weigh the alternatives but be sure to consider several arguments.

What About MVC?
A few more words about the MVC paradigm may be in order. If you haven't heard of it before, don't worry. You won't get far in your exploration of J2EE development before learning that for many it's a linchpin of interactive application development.

The only problem is that many MVC discussions will assert that a key facet is that the client "view" must be kept in sync with the back-end data source "model" driving its data display. Of course this can't work in the Web application model: there's no easy way to update a page sitting on your client's browser because data on the server has changed.

Does that mean the MVC paradigm is severely crippled for Web application development? No. It's just one part of the paradigm (and some may argue not even the most important). The MVC model and its separation of data display, request processing, and business logic makes sense as a desirable approach in all other respects.

Java Within JSPs
The subject of MVC and its separation of content and code leads to yet another area of debate, with respect to whether and how much Java you should be coding in a JSP. Again, this is an area that will be influenced by your perspective on whether nondevelopers will be editing a given JSP template (in which case a minimum of Java is important so as not to confuse them or put the code at risk by their modification).

Even then, if the JSP developer(s) is more savvy, does it still make sense to litter a JSP with embedded Java? Scriptlets are easy to use if you know Java, but there are several alternatives that will hide the code and it may be beneficial to consider them.

Custom tags (or custom action elements) are a well-defined feature in the JSP specification widely supported by JSP containers. They not only allow segregation and encapsulation of code, but also form the basis for resusable components and even greatly simplified processing within a JSP page.

For some the only use for custom tags is to leverage entire tag libraries from third parties (or Web container providers) that provide a whole range of useful services and features in your JSP, including easier database access, record processing, and mail handling.

Know that they are available as an option to ease your own development by providing another means to separate your code from your JSP. Still another way to segregate code is to use JavaBeans, Enterprise and otherwise.

What About Beans, EJB and Otherwise?
Ah yes, JavaBeans or EJBs. For the newcomer few things may be as confusing. It's pretty easy to learn how to use JSPs and even the servlet API, but if you're new to Java you'll need to do some work to wrap your head around these two topics.

JavaBeans and EJBs are not related to each other. Similar to the way JavaScript's name has confused people who assume it's a lightweight version of Java, so too do some think Enterprise JavaBeans are a heavyweight version of JavaBeans.

Some will argue that EJBs are heavyweight, though that's a matter for debate. In any case, they're not the same and they're also not mutually exclusive (you can use one or the other, or both, or neither).

In my last article I mentioned how disheartening it can be for a newcomer to J2EE who may read that JavaBeans are critical to JSP/servlet development, only to find books that describe them solely from the perspective of their value in client application development and/or IDE integration.

It's easy to miss the value of JavaBeans, which is, like so much in Java, about encapsulating data and methods into an object that can be used to describe something in your Web application. With their standardized mechanism for accessing data in the bean (getters and setters), they also support another fundamental goal - reusability - and, perhaps more important, hiding implementation behind a widely accepted interface.

Again I'll refer to the book, JavaServer Pages, for its excellent explanation of the value and application of JavaBeans, though some reviewers at Amazon have faulted it for relying too much on JavaBeans and not discussing EJBs that much. He does indeed recommend them as an approach that's suited to more enterprise class applications, and this exposes yet another area of debate.

What about EJBs? Should they by necessity be a core component of your Web application? Some will argue that absolutely no respectable Web application would be built without them. Others, though, will debate that and assert that their overhead is overkill. As you read about them you'll learn that there are different perspectives to bring to the table. Again, I can only recommend that you keep your mind open.

Another aspect of the discussion of EJBs may lead to real confusion for the newcomer: some resources will be describing EJBs from the perspective of client app- lication/applet developers. If these client apps need to connect to a remote distributed server, then encapsulating the business logic (and database interactions) on the server rather than the client will make eminent sense. But it's not an argument that resonates with Web application developers who have always been doing their business logic "on the server." Do EJBs then still add value?

As with the debate over MVC, purists, newcomers, and more practical adherents are often talking on different planes, making presumptions that don't apply in all cases.

EJBs make sense when both your Web and EJB containers are distributed on different systems. What about when they're on the same server? It's not that they don't make sense in that last instance, just that their benefit has to be more carefully weighed against their cost. Some containers provide integration that eliminates some of the overhead when the Web and EJB containers are on the same server.

There's clearly a lot more to EJBs than the simple matter of segregating the business logic from the client. There are aspects of security, resource management, transaction control, and even database integration that can be encapsulated and managed by EJBs.

It takes a lot of reading, trial and error, and looking to more experienced counterparts for guidance on deciding when to leverage EJBs. There are several books on the generic subject of EJBs as well as the more specific matter of when and how to use them in Web applications. Just keep an open mind that's both skeptical and flexible. However, the diversity of opinion doesn't end with the debate over EJBs.

Which Server/Container?
Even the matter of choosing a J2EE server or a Web, or EJB container is fraught with contentious and rancorous debate. There are open-source adherents for whom no commercial solution will do. Prominent offerings include Apache's Tomcat and JBossServer. It's certainly not obvious that an open-source solution will be any less capable than a commercial solution (though be careful, not all open-source products are licensed to be used for production purposes).

Even among commercial products there's a world of difference among the many contenders. Of course, the largest share of the J2EE server pie goes to BEA and IBM. There are many other worthy contenders, including offerings from Borland, HP, Iona, iPlanet, and Macromedia. Sun's J2EE-compliance program will help to sort out which companies provide fully compliant servers, but the number is large and growing.

Then, too, it's not always necessary to acquire a complete J2EE server. Perhaps your needs will be satisfied with just a servlet container. There are many offerings in that arena as well, including New Atlanta's Servlet Exec and Gefion's LiteWebServer.

Many vendors offer trial versions, and some offer unlimited development versions (or versions allowing only a small number of users). It's easy enough to try out a variety of servers to determine which suit your needs. Also, look to resources like Sun's Solutions Marketplace (http://industry.java.sun.com/solutions) and JDJ's Buyer's Guide (www.sys-con.com/java/wbg/index.cfm) for more insights.

What's It All Mean?
Is all this variety and contention over different approaches a bad thing? Not really, it's just different if you've only recently come into the J2EE arena. Is it hopeless? No, there are many resources available to help you learn about the many approaches, including articles, books, Web site information portals, classes, and mailing lists. The challenge is to digest it all, keep an open mind, be open to debate, and don't give any one argument too much weight. Favor those that do a good job of offering a balance of approaches, and compare and contrast them.

If anything, these numerous possibilities are another facet of the Java platform in general. It's a rich and flexible language, a platform with much to offer, and it satisfies an incredibly wide audience. And that audience is expanding all the time.

If there's one more hopeful message to sound, it's that this very widening of the Java community will surely lead to a more cohesive and well-digested sense of how best to apply the many sides of J2EE to a range of problems.

The fact that Java is set up to be molded and influenced by the Java Community Process is a sign that hopefully more and more public discussion by an ever-widening (and constantly learning) circle of participants will yield still better implementation solutions.

Fasten your seatbelts, fill your coffee cups, and settle in for the ride, which will be anything but boring. There will be an ever-growing abundance of resources and experienced cohorts to learn from, and even the newcomers among the audience may bring great new insights and possibilities to the table.

One last thing: speaking of the variety of developers out there, we welcome your feedback, not just to this article but to all of them. You'll notice that if you visit the JDJ Web site (www.JavaDevelopersJournal.com) you're now able to share your comments on all the articles, and subscribers can even rate them on a scale of 1 to 3. Please take a moment to share your feedback on any articles that strike you one way or another. It's all a part of the opportunity for continuous learning.

More Stories By Charlie Arehart

A veteran ColdFusion developer since 1997, Charlie Arehart is a long-time contributor to the community and a recognized Adobe Community Expert. He's a certified Advanced CF Developer and Instructor for CF 4/5/6/7 and served as tech editor of CFDJ until 2003. Now an independent contractor (carehart.org) living in Alpharetta, GA, Charlie provides high-level troubleshooting/tuning assistance and training/mentoring for CF teams. He helps run the Online ColdFusion Meetup (coldfusionmeetup.com, an online CF user group), is a contributor to the CF8 WACK books by Ben Forta, and is frequently invited to speak at developer conferences and user groups worldwide.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


@ThingsExpo Stories
Widespread fragmentation is stalling the growth of the IIoT and making it difficult for partners to work together. The number of software platforms, apps, hardware and connectivity standards is creating paralysis among businesses that are afraid of being locked into a solution. EdgeX Foundry is unifying the community around a common IoT edge framework and an ecosystem of interoperable components.
"IBM is really all in on blockchain. We take a look at sort of the history of blockchain ledger technologies. It started out with bitcoin, Ethereum, and IBM evaluated these particular blockchain technologies and found they were anonymous and permissionless and that many companies were looking for permissioned blockchain," stated René Bostic, Technical VP of the IBM Cloud Unit in North America, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Conventi...
"Akvelon is a software development company and we also provide consultancy services to folks who are looking to scale or accelerate their engineering roadmaps," explained Jeremiah Mothersell, Marketing Manager at Akvelon, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
Coca-Cola’s Google powered digital signage system lays the groundwork for a more valuable connection between Coke and its customers. Digital signs pair software with high-resolution displays so that a message can be changed instantly based on what the operator wants to communicate or sell. In their Day 3 Keynote at 21st Cloud Expo, Greg Chambers, Global Group Director, Digital Innovation, Coca-Cola, and Vidya Nagarajan, a Senior Product Manager at Google, discussed how from store operations and ...
Large industrial manufacturing organizations are adopting the agile principles of cloud software companies. The industrial manufacturing development process has not scaled over time. Now that design CAD teams are geographically distributed, centralizing their work is key. With large multi-gigabyte projects, outdated tools have stifled industrial team agility, time-to-market milestones, and impacted P&L stakeholders.
Gemini is Yahoo’s native and search advertising platform. To ensure the quality of a complex distributed system that spans multiple products and components and across various desktop websites and mobile app and web experiences – both Yahoo owned and operated and third-party syndication (supply), with complex interaction with more than a billion users and numerous advertisers globally (demand) – it becomes imperative to automate a set of end-to-end tests 24x7 to detect bugs and regression. In th...
"Cloud Academy is an enterprise training platform for the cloud, specifically public clouds. We offer guided learning experiences on AWS, Azure, Google Cloud and all the surrounding methodologies and technologies that you need to know and your teams need to know in order to leverage the full benefits of the cloud," explained Alex Brower, VP of Marketing at Cloud Academy, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clar...
In his session at 21st Cloud Expo, Carl J. Levine, Senior Technical Evangelist for NS1, will objectively discuss how DNS is used to solve Digital Transformation challenges in large SaaS applications, CDNs, AdTech platforms, and other demanding use cases. Carl J. Levine is the Senior Technical Evangelist for NS1. A veteran of the Internet Infrastructure space, he has over a decade of experience with startups, networking protocols and Internet infrastructure, combined with the unique ability to it...
"There's plenty of bandwidth out there but it's never in the right place. So what Cedexis does is uses data to work out the best pathways to get data from the origin to the person who wants to get it," explained Simon Jones, Evangelist and Head of Marketing at Cedexis, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
"MobiDev is a software development company and we do complex, custom software development for everybody from entrepreneurs to large enterprises," explained Alan Winters, U.S. Head of Business Development at MobiDev, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
SYS-CON Events announced today that CrowdReviews.com has been named “Media Sponsor” of SYS-CON's 22nd International Cloud Expo, which will take place on June 5–7, 2018, at the Javits Center in New York City, NY. CrowdReviews.com is a transparent online platform for determining which products and services are the best based on the opinion of the crowd. The crowd consists of Internet users that have experienced products and services first-hand and have an interest in letting other potential buye...
SYS-CON Events announced today that Telecom Reseller has been named “Media Sponsor” of SYS-CON's 22nd International Cloud Expo, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. Telecom Reseller reports on Unified Communications, UCaaS, BPaaS for enterprise and SMBs. They report extensively on both customer premises based solutions such as IP-PBX as well as cloud based and hosted platforms.
"Space Monkey by Vivent Smart Home is a product that is a distributed cloud-based edge storage network. Vivent Smart Home, our parent company, is a smart home provider that places a lot of hard drives across homes in North America," explained JT Olds, Director of Engineering, and Brandon Crowfeather, Product Manager, at Vivint Smart Home, in this SYS-CON.tv interview at @ThingsExpo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
It is of utmost importance for the future success of WebRTC to ensure that interoperability is operational between web browsers and any WebRTC-compliant client. To be guaranteed as operational and effective, interoperability must be tested extensively by establishing WebRTC data and media connections between different web browsers running on different devices and operating systems. In his session at WebRTC Summit at @ThingsExpo, Dr. Alex Gouaillard, CEO and Founder of CoSMo Software, presented ...
WebRTC is great technology to build your own communication tools. It will be even more exciting experience it with advanced devices, such as a 360 Camera, 360 microphone, and a depth sensor camera. In his session at @ThingsExpo, Masashi Ganeko, a manager at INFOCOM Corporation, introduced two experimental projects from his team and what they learned from them. "Shotoku Tamago" uses the robot audition software HARK to track speakers in 360 video of a remote party. "Virtual Teleport" uses a multip...
A strange thing is happening along the way to the Internet of Things, namely far too many devices to work with and manage. It has become clear that we'll need much higher efficiency user experiences that can allow us to more easily and scalably work with the thousands of devices that will soon be in each of our lives. Enter the conversational interface revolution, combining bots we can literally talk with, gesture to, and even direct with our thoughts, with embedded artificial intelligence, whic...
SYS-CON Events announced today that Evatronix will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Evatronix SA offers comprehensive solutions in the design and implementation of electronic systems, in CAD / CAM deployment, and also is a designer and manufacturer of advanced 3D scanners for professional applications.
Leading companies, from the Global Fortune 500 to the smallest companies, are adopting hybrid cloud as the path to business advantage. Hybrid cloud depends on cloud services and on-premises infrastructure working in unison. Successful implementations require new levels of data mobility, enabled by an automated and seamless flow across on-premises and cloud resources. In his general session at 21st Cloud Expo, Greg Tevis, an IBM Storage Software Technical Strategist and Customer Solution Architec...
To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. In his session at @BigDataExpo, Jack Norris, Senior Vice President, Data and Applications at MapR Technologies, reviewed best practices to ...
An increasing number of companies are creating products that combine data with analytical capabilities. Running interactive queries on Big Data requires complex architectures to store and query data effectively, typically involving data streams, an choosing efficient file format/database and multiple independent systems that are tied together through custom-engineered pipelines. In his session at @BigDataExpo at @ThingsExpo, Tomer Levi, a senior software engineer at Intel’s Advanced Analytics gr...