ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Mad Computer Science
Testing COBOL With RSpec
Guy Royse
royseg@nationwide.com
@guyroyse
About Me
Guy Royse
Development Competency Lead
Application Development Center

LikesTDD, Pairing, Polyglot
Programming, Pi?a Coladas, Walks in
the Rain
Dislikes Coding
Alone, Complexity, Being Confused for
Hagrid
2
COBOL
Java
Ruby
TDD
RSpec
3
4
About COBOL

5
Completely
Obsolete
Business
Oriented
Language
6
**

** No affiliation with GEICO is intended or implied. All rights reserved.
Look both ways before crossing the street. Vote early and vote often.
7
8
9
A Simple Application
The Data

The Code

Contact
Validator

Contact

Phone

Address

Phone
Validator

Address
Validator

10
Java Data Implementation
public class Contact {
private String name;
private Phone home;
private Phone cell;
private Address address;
public String getName() {
return name
};
public void setName(String name) {
this.name = name;
}

/* etc. */
}
11
COBOL Data Implementation
01

CONTACT.
05 NAME
05 HOME-PHONE.
10 HOME-AREA-CODE
10 HOME-EXCHANGE
10 HOME-PHONE-NUMBER
05 CELL-PHONE.
10 CELL-AREA-CODE
10 CELL-EXCHANGE
10 CELL-PHONE-NUMBER
05 ADDRESS.
10 STREET
10 CITY
10 STATE
10 ZIP-CODE

PIC X(30).

PIC 9(3).
PIC 9(3).
PIC 9(4).
PIC 9(3).
PIC 9(3).
PIC 9(4).
PIC
PIC
PIC
PIC

X(30).
X(20).
X(2).
X(5).
12
Java Code Implementation
public class ContactValidator {
private PhoneValidatorphoneValidator;
private AddressValidatoraddressValidator;
public void validate(Contact contact) {
validateName(contact.getName);
phoneValidator.validate(contact.getHome());
phoneValidator.validate(contact.getCell());
addressValidator.validate(contact.getAddress());
}
private void validateName(String name) {
/* validates name */
}
}

13
COBOL Code Implementation
IDENTIFICATION DIVISION.
PROGRAM-ID. CONTACT-VALIDATOR.

PROCEDURE DIVISION USING CONTACT.
MAIN.
CALL PHONE-VALIDATOR USING HOME-PHONE.
CALL PHONE-VALIDATOR USING CELL-PHONE.
CALL ADDRESS-VALIDATOR USING ADDRESS.
PERFORM VALIDATE-NAME.
GOBACK
VALIDATE-NAME.
* VALIDATE NAME
14
15
16
Eternity
Ruby

COBOL
command.txt

input.txt

contact
spec.rb

ETERNITY
.CBL

eternity.rb

CONTACT
.CBL

output.txt

17
18
Image Credits
http://www.flickr.com/photos/justin_case/1525042316
http://www.flickr.com/photos/cbmd/2475626473
http://www.flickr.com/photos/kc-bike/2398970429
http://www.flickr.com/photos/7603557@N08/454618030
http://www.flickr.com/photos/pennuja/5386712834
http://www.flickr.com/photos/blackeycove/3997170938

19

More Related Content

Similar to Mad Computer Science: Testing COBOL with RSpec (13)

A Robust Open-source GEDCOM Parser
A Robust Open-source GEDCOM ParserA Robust Open-source GEDCOM Parser
A Robust Open-source GEDCOM Parser
Dallan Quass
?
Are You Ready For Clean Code?
Are You Ready For Clean Code?Are You Ready For Clean Code?
Are You Ready For Clean Code?
Whisnu Sucitanuary
?
Clean Code Principles / How to write a clean code.
Clean Code Principles / How to write a clean code.Clean Code Principles / How to write a clean code.
Clean Code Principles / How to write a clean code.
Mai Abu Thra'a
?
SETCON'18 - Yauheni Pakala - .NET Embedding
SETCON'18 - Yauheni Pakala - .NET Embedding SETCON'18 - Yauheni Pakala - .NET Embedding
SETCON'18 - Yauheni Pakala - .NET Embedding
Nadzeya Pus
?
RR2 CV
RR2 CVRR2 CV
RR2 CV
rohit raikwar
?
GOTO Paris | @see Gopher
GOTO Paris | @see GopherGOTO Paris | @see Gopher
GOTO Paris | @see Gopher
Jan Klat
?
Groovy Domain Specific Languages - SpringOne2GX 2012
Groovy Domain Specific Languages - SpringOne2GX 2012Groovy Domain Specific Languages - SpringOne2GX 2012
Groovy Domain Specific Languages - SpringOne2GX 2012
Guillaume Laforge
?
TDD CrashCourse Part2: TDD
TDD CrashCourse Part2: TDDTDD CrashCourse Part2: TDD
TDD CrashCourse Part2: TDD
David Rodenas
?
GC_RESUME_2015
GC_RESUME_2015GC_RESUME_2015
GC_RESUME_2015
Gokul Choudhary(Dhangar)
?
Intel_Wayne
Intel_WayneIntel_Wayne
Intel_Wayne
Ze'ev Markman
?
Secure pl-sql-coding
Secure pl-sql-codingSecure pl-sql-coding
Secure pl-sql-coding
Tr?n B¨¬nh H?u
?
Test Driven Development Part 2
Test Driven Development Part 2Test Driven Development Part 2
Test Driven Development Part 2
Gamal Shaban
?
Write Once, Run Everywhere
Write Once, Run EverywhereWrite Once, Run Everywhere
Write Once, Run Everywhere
Mike North
?
A Robust Open-source GEDCOM Parser
A Robust Open-source GEDCOM ParserA Robust Open-source GEDCOM Parser
A Robust Open-source GEDCOM Parser
Dallan Quass
?
Clean Code Principles / How to write a clean code.
Clean Code Principles / How to write a clean code.Clean Code Principles / How to write a clean code.
Clean Code Principles / How to write a clean code.
Mai Abu Thra'a
?
SETCON'18 - Yauheni Pakala - .NET Embedding
SETCON'18 - Yauheni Pakala - .NET Embedding SETCON'18 - Yauheni Pakala - .NET Embedding
SETCON'18 - Yauheni Pakala - .NET Embedding
Nadzeya Pus
?
GOTO Paris | @see Gopher
GOTO Paris | @see GopherGOTO Paris | @see Gopher
GOTO Paris | @see Gopher
Jan Klat
?
Groovy Domain Specific Languages - SpringOne2GX 2012
Groovy Domain Specific Languages - SpringOne2GX 2012Groovy Domain Specific Languages - SpringOne2GX 2012
Groovy Domain Specific Languages - SpringOne2GX 2012
Guillaume Laforge
?
TDD CrashCourse Part2: TDD
TDD CrashCourse Part2: TDDTDD CrashCourse Part2: TDD
TDD CrashCourse Part2: TDD
David Rodenas
?
Test Driven Development Part 2
Test Driven Development Part 2Test Driven Development Part 2
Test Driven Development Part 2
Gamal Shaban
?
Write Once, Run Everywhere
Write Once, Run EverywhereWrite Once, Run Everywhere
Write Once, Run Everywhere
Mike North
?

Recently uploaded (20)

Java on AWS Without the Headaches - Fast Builds, Cheap Deploys, No Kubernetes
Java on AWS Without the Headaches - Fast Builds, Cheap Deploys, No KubernetesJava on AWS Without the Headaches - Fast Builds, Cheap Deploys, No Kubernetes
Java on AWS Without the Headaches - Fast Builds, Cheap Deploys, No Kubernetes
VictorSzoltysek
?
Getting the Best of TrueDEM ¨C April News & Updates
Getting the Best of TrueDEM ¨C April News & UpdatesGetting the Best of TrueDEM ¨C April News & Updates
Getting the Best of TrueDEM ¨C April News & Updates
panagenda
?
Dev Dives: Unleash the power of macOS Automation with UiPath
Dev Dives: Unleash the power of macOS Automation with UiPathDev Dives: Unleash the power of macOS Automation with UiPath
Dev Dives: Unleash the power of macOS Automation with UiPath
UiPathCommunity
?
How to manage technology risk and corporate growth
How to manage technology risk and corporate growthHow to manage technology risk and corporate growth
How to manage technology risk and corporate growth
Arlen Meyers, MD, MBA
?
APAC Solutions Challenge Info Session.pdf
APAC Solutions Challenge Info Session.pdfAPAC Solutions Challenge Info Session.pdf
APAC Solutions Challenge Info Session.pdf
GDG on Campus Monash
?
How Telemedicine App Development is Revolutionizing Virtual Care.pptx
How Telemedicine App Development is Revolutionizing Virtual Care.pptxHow Telemedicine App Development is Revolutionizing Virtual Care.pptx
How Telemedicine App Development is Revolutionizing Virtual Care.pptx
Dash Technologies Inc
?
Innovative Web Design | Malachite Technologies
Innovative Web Design | Malachite TechnologiesInnovative Web Design | Malachite Technologies
Innovative Web Design | Malachite Technologies
malachitetechnologie1
?
Solana Developer Hiring for Enterprises Key Considerations.pdf
Solana Developer Hiring for Enterprises Key Considerations.pdfSolana Developer Hiring for Enterprises Key Considerations.pdf
Solana Developer Hiring for Enterprises Key Considerations.pdf
Lisa ward
?
Columbia Weather Systems - Product Overview
Columbia Weather Systems - Product OverviewColumbia Weather Systems - Product Overview
Columbia Weather Systems - Product Overview
Columbia Weather Systems
?
RBM - PIXIAGE - AskPixi Page - Inpixon-MWC 2025.pptx
RBM - PIXIAGE - AskPixi Page - Inpixon-MWC 2025.pptxRBM - PIXIAGE - AskPixi Page - Inpixon-MWC 2025.pptx
RBM - PIXIAGE - AskPixi Page - Inpixon-MWC 2025.pptx
quinlan4
?
Scalable Multi-Agent AI with AutoGen by Udai
Scalable Multi-Agent AI with AutoGen by UdaiScalable Multi-Agent AI with AutoGen by Udai
Scalable Multi-Agent AI with AutoGen by Udai
Udaiappa Ramachandran
?
Build with AI on Google Cloud Session #5
Build with AI on Google Cloud Session #5Build with AI on Google Cloud Session #5
Build with AI on Google Cloud Session #5
Margaret Maynard-Reid
?
CIOs Speak Out - A Research Series by Jasper Colin
CIOs Speak Out - A Research Series by Jasper ColinCIOs Speak Out - A Research Series by Jasper Colin
CIOs Speak Out - A Research Series by Jasper Colin
Jasper Colin
?
Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025
Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025
Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025
Sugarlab AI
?
Dragino¥×¥í¥À¥¯¥È¥«¥¿¥í¥° LoRaWAN NB-IoT LTE cat.M1ÉÌÆ·¥ê¥¹¥È
Dragino¥×¥í¥À¥¯¥È¥«¥¿¥í¥° LoRaWAN  NB-IoT  LTE cat.M1ÉÌÆ·¥ê¥¹¥ÈDragino¥×¥í¥À¥¯¥È¥«¥¿¥í¥° LoRaWAN  NB-IoT  LTE cat.M1ÉÌÆ·¥ê¥¹¥È
Dragino¥×¥í¥À¥¯¥È¥«¥¿¥í¥° LoRaWAN NB-IoT LTE cat.M1ÉÌÆ·¥ê¥¹¥È
CRI Japan, Inc.
?
202408_JAWSPANKRATION_Introduction_of_Minaden.pdf
202408_JAWSPANKRATION_Introduction_of_Minaden.pdf202408_JAWSPANKRATION_Introduction_of_Minaden.pdf
202408_JAWSPANKRATION_Introduction_of_Minaden.pdf
NTTDOCOMO-ServiceInnovation
?
ScotSecure Cyber Security Summit 2025 Edinburgh
ScotSecure Cyber Security Summit 2025 EdinburghScotSecure Cyber Security Summit 2025 Edinburgh
ScotSecure Cyber Security Summit 2025 Edinburgh
Ray Bugg
?
SAP Business Data Cloud: Was die neue SAP-L?sung f¨¹r Unternehmen und ihre Dat...
SAP Business Data Cloud: Was die neue SAP-L?sung f¨¹r Unternehmen und ihre Dat...SAP Business Data Cloud: Was die neue SAP-L?sung f¨¹r Unternehmen und ihre Dat...
SAP Business Data Cloud: Was die neue SAP-L?sung f¨¹r Unternehmen und ihre Dat...
IBsolution GmbH
?
GDG Cloud Southlake #41: Shay Levi: Beyond the Hype:How Enterprises Are Using AI
GDG Cloud Southlake #41: Shay Levi: Beyond the Hype:How Enterprises Are Using AIGDG Cloud Southlake #41: Shay Levi: Beyond the Hype:How Enterprises Are Using AI
GDG Cloud Southlake #41: Shay Levi: Beyond the Hype:How Enterprises Are Using AI
James Anderson
?
HHUG-04-2025-Close-more-deals-from-your-existing-pipeline-FOR SLIDESHARE.pptx
HHUG-04-2025-Close-more-deals-from-your-existing-pipeline-FOR SLIDESHARE.pptxHHUG-04-2025-Close-more-deals-from-your-existing-pipeline-FOR SLIDESHARE.pptx
HHUG-04-2025-Close-more-deals-from-your-existing-pipeline-FOR SLIDESHARE.pptx
HampshireHUG
?
Java on AWS Without the Headaches - Fast Builds, Cheap Deploys, No Kubernetes
Java on AWS Without the Headaches - Fast Builds, Cheap Deploys, No KubernetesJava on AWS Without the Headaches - Fast Builds, Cheap Deploys, No Kubernetes
Java on AWS Without the Headaches - Fast Builds, Cheap Deploys, No Kubernetes
VictorSzoltysek
?
Getting the Best of TrueDEM ¨C April News & Updates
Getting the Best of TrueDEM ¨C April News & UpdatesGetting the Best of TrueDEM ¨C April News & Updates
Getting the Best of TrueDEM ¨C April News & Updates
panagenda
?
Dev Dives: Unleash the power of macOS Automation with UiPath
Dev Dives: Unleash the power of macOS Automation with UiPathDev Dives: Unleash the power of macOS Automation with UiPath
Dev Dives: Unleash the power of macOS Automation with UiPath
UiPathCommunity
?
How to manage technology risk and corporate growth
How to manage technology risk and corporate growthHow to manage technology risk and corporate growth
How to manage technology risk and corporate growth
Arlen Meyers, MD, MBA
?
APAC Solutions Challenge Info Session.pdf
APAC Solutions Challenge Info Session.pdfAPAC Solutions Challenge Info Session.pdf
APAC Solutions Challenge Info Session.pdf
GDG on Campus Monash
?
How Telemedicine App Development is Revolutionizing Virtual Care.pptx
How Telemedicine App Development is Revolutionizing Virtual Care.pptxHow Telemedicine App Development is Revolutionizing Virtual Care.pptx
How Telemedicine App Development is Revolutionizing Virtual Care.pptx
Dash Technologies Inc
?
Innovative Web Design | Malachite Technologies
Innovative Web Design | Malachite TechnologiesInnovative Web Design | Malachite Technologies
Innovative Web Design | Malachite Technologies
malachitetechnologie1
?
Solana Developer Hiring for Enterprises Key Considerations.pdf
Solana Developer Hiring for Enterprises Key Considerations.pdfSolana Developer Hiring for Enterprises Key Considerations.pdf
Solana Developer Hiring for Enterprises Key Considerations.pdf
Lisa ward
?
RBM - PIXIAGE - AskPixi Page - Inpixon-MWC 2025.pptx
RBM - PIXIAGE - AskPixi Page - Inpixon-MWC 2025.pptxRBM - PIXIAGE - AskPixi Page - Inpixon-MWC 2025.pptx
RBM - PIXIAGE - AskPixi Page - Inpixon-MWC 2025.pptx
quinlan4
?
Scalable Multi-Agent AI with AutoGen by Udai
Scalable Multi-Agent AI with AutoGen by UdaiScalable Multi-Agent AI with AutoGen by Udai
Scalable Multi-Agent AI with AutoGen by Udai
Udaiappa Ramachandran
?
Build with AI on Google Cloud Session #5
Build with AI on Google Cloud Session #5Build with AI on Google Cloud Session #5
Build with AI on Google Cloud Session #5
Margaret Maynard-Reid
?
CIOs Speak Out - A Research Series by Jasper Colin
CIOs Speak Out - A Research Series by Jasper ColinCIOs Speak Out - A Research Series by Jasper Colin
CIOs Speak Out - A Research Series by Jasper Colin
Jasper Colin
?
Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025
Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025
Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025
Sugarlab AI
?
Dragino¥×¥í¥À¥¯¥È¥«¥¿¥í¥° LoRaWAN NB-IoT LTE cat.M1ÉÌÆ·¥ê¥¹¥È
Dragino¥×¥í¥À¥¯¥È¥«¥¿¥í¥° LoRaWAN  NB-IoT  LTE cat.M1ÉÌÆ·¥ê¥¹¥ÈDragino¥×¥í¥À¥¯¥È¥«¥¿¥í¥° LoRaWAN  NB-IoT  LTE cat.M1ÉÌÆ·¥ê¥¹¥È
Dragino¥×¥í¥À¥¯¥È¥«¥¿¥í¥° LoRaWAN NB-IoT LTE cat.M1ÉÌÆ·¥ê¥¹¥È
CRI Japan, Inc.
?
ScotSecure Cyber Security Summit 2025 Edinburgh
ScotSecure Cyber Security Summit 2025 EdinburghScotSecure Cyber Security Summit 2025 Edinburgh
ScotSecure Cyber Security Summit 2025 Edinburgh
Ray Bugg
?
SAP Business Data Cloud: Was die neue SAP-L?sung f¨¹r Unternehmen und ihre Dat...
SAP Business Data Cloud: Was die neue SAP-L?sung f¨¹r Unternehmen und ihre Dat...SAP Business Data Cloud: Was die neue SAP-L?sung f¨¹r Unternehmen und ihre Dat...
SAP Business Data Cloud: Was die neue SAP-L?sung f¨¹r Unternehmen und ihre Dat...
IBsolution GmbH
?
GDG Cloud Southlake #41: Shay Levi: Beyond the Hype:How Enterprises Are Using AI
GDG Cloud Southlake #41: Shay Levi: Beyond the Hype:How Enterprises Are Using AIGDG Cloud Southlake #41: Shay Levi: Beyond the Hype:How Enterprises Are Using AI
GDG Cloud Southlake #41: Shay Levi: Beyond the Hype:How Enterprises Are Using AI
James Anderson
?
HHUG-04-2025-Close-more-deals-from-your-existing-pipeline-FOR SLIDESHARE.pptx
HHUG-04-2025-Close-more-deals-from-your-existing-pipeline-FOR SLIDESHARE.pptxHHUG-04-2025-Close-more-deals-from-your-existing-pipeline-FOR SLIDESHARE.pptx
HHUG-04-2025-Close-more-deals-from-your-existing-pipeline-FOR SLIDESHARE.pptx
HampshireHUG
?

Mad Computer Science: Testing COBOL with RSpec

Editor's Notes

  • #4: Show of hands!
  • #6: When I was tasked with testing COBOL I did some Googling to find out a little bit about it. First I wanted to know how it got its name¡­
  • #7: ¡­and who uses it¡­
  • #8: ¡­and what it is like¡­
  • #9: These are all kinda unfair¡­it's a tool, a heavy toolIt's old and rusty-there is a lot of itBut¡­
  • #10: ¡­it's actually more modern than we think.
  • #16: If they are the same architecture, then I can test them using the same techniques i.eTDD
  • #17: If they are the same architecture, then I can test them using the same techniques i.eTDD
  • #18: Why Ruby - lot of file IO, easy in Ruby - ruby has good testing frameworks - get some people out of their comfort zone - irony