DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Zero-Downtime Deployments for Java Apps on Kubernetes
  • Rethinking Java CRUDs With Event Sourcing and CQRS Patterns
  • Detecting Bugs and Vulnerabilities in Java With SonarQube
  • Introduction to Tactical DDD With Java: Steps to Build Semantic Code

Trending

  • Why Google Data Migration Gets Stuck at 99%: Causes and Proven Fixes
  • What Is Plagiarism? How to Avoid It and Cite Sources
  • Implementing Observability in Distributed Systems Using OpenTelemetry
  • Architecting Sub-Microsecond HFT Systems With C++ and Zero-Copy IPC
  1. DZone
  2. Coding
  3. Languages
  4. COBOL to JOBOL? A Poor Choice for Modernization

COBOL to JOBOL? A Poor Choice for Modernization

This article digs into the common challenges of COBOL to Java conversion and some strategies to be employed to avoid the JOBOL pitfall.

By 
sampath amatam user avatar
sampath amatam
·
Mar. 11, 24 · Tutorial
Likes (1)
Comment
Save
Tweet
Share
13.5K Views

Join the DZone community and get the full member experience.

Join For Free

The enduring prevalence of COBOL (Common Business-Oriented Language) in mission-critical applications poses a challenge for modernization efforts, particularly in the transition to Java. This paper explores the intricacies of converting COBOL to Java, emphasizing the avoidance of JOBOL—a term coined for Java code that retains procedural characteristics without embracing object-oriented principles. The discussion includes strategies for data-oriented conversion, dead code elimination, and the adoption of event-driven approaches to ensure a successful transition that leverages the full potential of Java.

Introduction

COBOL, an acronym for Common Business-Oriented Language, has been a stalwart in the programming world, particularly for business applications, since its inception in the late 1950s. Despite its age, COBOL remains a critical component in many organizations, with millions of lines of code still in use for core mission-critical applications. However, as technology advances, there is an increasing push towards modernization, with Java being a popular target language due to its object-oriented nature, robust ecosystem, and wide adoption in contemporary software development.

Challenges of COBOL to Java Conversion

Organizations have various motivations for transitioning from COBOL to Java, including cost savings, a dwindling pool of COBOL talent, and the desire to adopt contemporary development methodologies. The market offers numerous automation tools and AI solutions capable of automatically converting COBOL code to Java. 

However, the transition from COBOL to Java is not without its challenges. One significant hurdle is the potential creation of JOBOL, which refers to Java code that is written in a procedural style akin to COBOL, without leveraging Java's object-oriented capabilities. This can lead to code that is difficult to maintain, extend, or integrate with modern software practices and tools.

What Is JOBOL?

COBOL is a procedural language, while Java is a modern object-oriented language. During the conversion process from COBOL to Java, if the translation is done on a line-by-line basis without incorporating object-oriented principles, the resulting code can be classified as JOBOL. 

COBOL à JOBOL (Procedural Non-Object-Oriented Java Code)

Strategies for Effective Conversion

To mitigate the risk of falling into the pit of JOBOL, several strategies like below can be employed to evaluate the converted code by either Automation tools or AI.

Data-Oriented Conversion

Emphasize the creation of Plain Old Java Objects (POJOs) with appropriate getter and setter methods for data elements. This approach facilitates a more object-oriented design, enhancing maintainability and readability.

Elimination of Dead Code

COBOL applications, often decades old, may contain significant amounts of dead code. The conversion process presents an opportunity to identify and remove such code, streamlining the resulting Java application and improving performance.

Adoption of Event-Driven Architecture

Many COBOL applications are designed as batch processes. The conversion to Java offers a chance to reevaluate these designs and, where appropriate, transition to real-time, event-driven architectures. This can lead to more responsive and scalable systems.

Here is an illustration of how to circumvent the conversion from COBOL to JOBOL.

Step 1

I requested ChatGPT4 to generate a sample COBOL program based on the following specifications as below.

step 1

It generated a COBOL program that adheres to all specified requirements, including the addition of business logic to determine the account type based on age, categorizing it as either "Minor" or "Adult." Furthermore, the program includes five lines of unreachable code, fulfilling the request for dead code.

Link for entire ChatGPT Conversation.

Step 2

Then I prompted “Now convert this COBOL code to Java.” 

This Prompt has created the Java program with not much information on the file structures. Just a procedural code with not many Object-Oriented aspects taken into consideration. Also, the dead code is converted as well. A classic example of “JOBOL”.

Link for entire ChatGPT Conversation.

Step 3

Then I prompted as below:

The prompt generated the code, including corresponding POJO classes for the input and output file structures. These classes are referenced in the main class, which manages the business logic. This transformation results in a shift from procedural code to an object-oriented program. Additionally, any dead code has been eliminated during the code conversion process.

Link for entire ChatGPT Conversation.

Conclusion

The transition from COBOL to Java is a complex process that requires careful planning and execution. By adopting a data-oriented approach, eliminating dead code, and considering architectural shifts towards event-driven models, organizations can avoid the pitfalls of JOBOL and leverage the full potential of Java for their modernized applications.

COBOL Java (programming language)

Opinions expressed by DZone contributors are their own.

Related

  • Zero-Downtime Deployments for Java Apps on Kubernetes
  • Rethinking Java CRUDs With Event Sourcing and CQRS Patterns
  • Detecting Bugs and Vulnerabilities in Java With SonarQube
  • Introduction to Tactical DDD With Java: Steps to Build Semantic Code

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook