Welcome!

Java IoT Authors: APM Blog, Liz McMillan, Elizabeth White, Simon Hill, Stackify Blog

Related Topics: Java IoT

Java IoT: Article

KISS + Swing = RAD

How to rapidly develop enterprise class Swing applications by keeping things simple

While Struts and Tiles add a layer of complexity, overall they're an improvement over custom code since they replace custom MVC and Tiling frameworks with proven, tested, and well documented frameworks that are based on industry standards such as Java/JSP/XML. (We'll explore why frameworks are good in the next section.) However, there are still some serious consequences to using all these technologies:

  1. You must have people trained in one or more (preferably more) of these technologies
  2. Someone has to understand how each layer interacts with its neighboring layers
  3. Each technology/framework will develop at its own pace - possibly introducing versioning and dependency issues with the other technologies
Savings # 2: Reduce the Number of Technologies Used in Development
So, it seems reasonable that by reducing the number of technologies used in an application, you'll simplify and probably speed up development (see Figure 2). One way to do this is to use Swing for the presentation layer. Swing provides the following benefits:
  1. Extremely rich user interface
  2. Excellent development and code management tools
  3. Easily customizable and extendable
  4. Many third-party components and libraries available
  5. Reduces the number of technologies you must know to ONE
  6. Easy management and distribution with Java Web Start
By using Swing instead of HTML, JSP, JSF, XML, and JavaScript, you've dramatically simplified your development effort. Code management becomes a breeze. The user interface is much richer and you can do complex validation and processing on the client if you want. Swing provides more efficient communications as well, since, like AJAX, only data is transferred between the client and the server (no UI code). There's only one little problem (well, ok, two) - how will we communicate to the server? And how will we bind the data to the user interface?

The Web stack provides mature and well-understood transport and binding layers via HTTP, JSP, JSF, AJAX, and frameworks Struts. If we are to use Swing to provide a richer user interface to the user, we must also provide a simpler data binding and transport solution that is at least as good as that provided using the typical Web stack. Fortunately the Java space has been maturing in this area and there are a number of options available.

What To Do When There's More Application "Plumbing" Code Than Custom Business Logic
What is plumbing? Communications and binding are part of what I call application plumbing - i.e., required for the application to function, but which aren't seen by the customer and don't provide value to the customer (as the business logic should).

The problem with complex distributed applications (enterprise apps) is that they require quite a bit of plumbing. Frequently you spend more time on the plumbing than on the code that provides value to the customer. This is drudge code. It has to be written, but solves well-understood problems and doesn't require creativity or (typically) differentiate your product from any other product.

Savings #3: Reduce Code by Using Frameworks Based on Open Standards
As previously referenced, just the plumbing needed to save and retrieve information from the database can comprise 30%-40% of your application code. When you add data transport, data binding, and perhaps a Model-View-Controller to the application, your application may consist of 80%-90% plumbing. The goal is to spend as little time on plumbing as possible so you can focus on the business logic that provides value to the customer. What's the solution?

Development Simplification Rule
Use frameworks based on open standards to provide the "plumbing" for your application so you can focus on the custom business logic. In general, the frameworks should:

  1. Be based on open standards => Therefore they will be supportable and extendable
  2. Replace roll-your-own "plumbing" => Reducing the code you write and maintain
  3. Provide advanced features/functionality => Features you may not have the time or expertise to develop in-house.
    Additional things to look for:
  4. Wizards => Speed up development by generating code for you
  5. Happy customers => Talk to people that are using the framework to see what their experiences have been. Browse the framework forums to get a sense for the types of problems developers experience while using the framework and how they have been solved.
A good example of a plumbing framework that provides enhanced functionality while reducing the code you need to write and maintain is Struts. Frameworks are great - but you still need to decide which ones to use (if any) and when to use them. One way to evaluate frameworks (after they've met the above mentioned criteria) is to take a look at how much work they'll save you - i.e., how much of the application scope they cover (see Figure 3). As previously shown, an object database covers quite a bit of the server-side development for you automatically.

In our case, we have to identify frameworks we can use with a Swing client to provide data binding and transport functionality to our application. What are we talking about when we say "data transport" and "data binding"?

Data Transport
Data Transport is how the information is sent between the client and the server. Since Swing is written in Java, you can use just about any kind of transport technology and protocol you want to - Sockets, RMI, XML-RPC, HTTP, etc. It really comes down to which one meets your application's needs. These day's it's common to communicate over port 80 so you don't have to open other firewall ports to use your application. If you're running only in a corporate network, perhaps you'll leverage Swing's strong support for managing Sockets. Alternately, you may want to use HTTP as demonstrated in the article "Struts Meets Swing" (see references) that explains how to connect a Swing client to a Struts application.

Frameworks available that provide data transport include: Canoo's ULC, Insitech's XTT and JDNC. Canoo manages communications between "half-objects" synchronizing the objects on the client with those on the server. Insitech's XTT uses XML over HTTP to pass data and objects between the client and the server.

Data Binding
Data binding is simply a term for synchronizing the presentation layer with the model layer or to put it more simply, tying a form input field to an object property. A robust data binding solution will automatically update the presentation layer if the model layer changes and vice versa. If your presentation layer and persistence layer are on the same machine, this is very straightforward. However, if you're operating across a network, you have to deal with the data transport as well.

The number of data binding solutions has increased significantly in the last year or so - so you'll have to do your homework and review them to decide which one best meets your needs. Here's a sampling: JGoodies, Lazlo, JDNC, Canoo ULC, Insitech XTT, Oracle AD, and Spring Rich. Besides synchronizing the data between the presentation and models, some of these frameworks take care of data transport and persistence as well. By using these binding and transport frameworks, more of the plumbing of an application is taken care of automatically, further reducing the development time and the amount of code that has to be maintained. I'm now going to demonstrate how much work can be saved (and how quickly you can develop) by using some of the available frameworks.

Visualizing the Savings
Let's see how two different binding and transport frameworks assist us in reducing the amount of code we have to develop for the left side of the software application diagram (see Figure 4 and Figure 5).

Canoo's ULC framework simplifies your life by synchronizing data on the server with the presentation layer. It provides a library of components, half-objects, that are placed on your forms and bound to their other half on the server. You don't have to write the binding code or worry about the client/server communications - it's taken care of for you.

Insitech's XTT provides binding and data synchronization between standard Swing components and relational or object data sources. As you can see from the diagram above, not only does XTT bind data with the presentation layer, it also transports it to the server and interacts directly with the persistence layer (either an object or relational database). This further reduces the amount of code you have to write and maintain. XTT ships with a collection of standard Swing components that have been extended to make them XTT-aware, but any Java component can be extended to make it usable by the framework. XTT also provides a simple mechanism for making remote method calls to server-side objects and returning serializable objects to the client.

Using either the Canoo or Insitech framework will dramatically speed up your development.

Wizards
Wizards can speed up development even more by generating code for you. However, make sure the code generated is readable and maintainable. Figure 6 shows a fully functional Swing form generated with the XTT Form Wizard that shows a department and all its employees.

More Stories By Richard Conway

Richard Conway is a software developer and technology consultant with more than 15 years of technology, project management, and information services experience. He has extensive experience developing Java/Struts-based web applications. He started focusing more on Swing based developments at the beginning of 2005 and has just finished a Swing-based client/server asset management project. He lives in Miami with his wife Patricia, is currently working on an EMR application, and plays sand volleyball in his spare time.

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
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 ...
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.
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...
"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 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.
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...
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...
"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.
"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...
"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...
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 ...
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...
When talking IoT we often focus on the devices, the sensors, the hardware itself. The new smart appliances, the new smart or self-driving cars (which are amalgamations of many ‘things’). When we are looking at the world of IoT, we should take a step back, look at the big picture. What value are these devices providing? IoT is not about the devices, it’s about the data consumed and generated. The devices are tools, mechanisms, conduits. In his session at Internet of Things at Cloud Expo | DXWor...
Everything run by electricity will eventually be connected to the Internet. Get ahead of the Internet of Things revolution. In his session at @ThingsExpo, Akvelon expert and IoT industry leader Sergey Grebnov provided an educational dive into the world of managing your home, workplace and all the devices they contain with the power of machine-based AI and intelligent Bot services for a completely streamlined experience.
SYS-CON Events announced today that Synametrics Technologies will exhibit at SYS-CON's 22nd International Cloud Expo®, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. Synametrics Technologies is a privately held company based in Plainsboro, New Jersey that has been providing solutions for the developer community since 1997. Based on the success of its initial product offerings such as WinSQL, Xeams, SynaMan and Syncrify, Synametrics continues to create and hone inn...