Mad Computer Science: Testing COBOL with RSpec
-
Upload
guy-royse -
Category
Technology
-
view
493 -
download
1
description
Transcript of Mad Computer Science: Testing COBOL with RSpec
![Page 1: Mad Computer Science: Testing COBOL with RSpec](https://reader036.fdocuments.in/reader036/viewer/2022062419/55846e20d8b42abf538b481b/html5/thumbnails/1.jpg)
Mad Computer ScienceTesting COBOL With RSpec
@guyroyse
![Page 2: Mad Computer Science: Testing COBOL with RSpec](https://reader036.fdocuments.in/reader036/viewer/2022062419/55846e20d8b42abf538b481b/html5/thumbnails/2.jpg)
About Me
2
Guy RoyseDevelopment Competency LeadApplication Development Center
Likes TDD, Pairing, Polyglot Programming, Piña Coladas, Walks in the Rain
Dislikes Coding Alone, Complexity, Being Confused for Hagrid
![Page 3: Mad Computer Science: Testing COBOL with RSpec](https://reader036.fdocuments.in/reader036/viewer/2022062419/55846e20d8b42abf538b481b/html5/thumbnails/3.jpg)
3
COBOLJavaRubyTDD
RSpec
![Page 4: Mad Computer Science: Testing COBOL with RSpec](https://reader036.fdocuments.in/reader036/viewer/2022062419/55846e20d8b42abf538b481b/html5/thumbnails/4.jpg)
4
Test COBOL
![Page 5: Mad Computer Science: Testing COBOL with RSpec](https://reader036.fdocuments.in/reader036/viewer/2022062419/55846e20d8b42abf538b481b/html5/thumbnails/5.jpg)
5
About COBOL
![Page 6: Mad Computer Science: Testing COBOL with RSpec](https://reader036.fdocuments.in/reader036/viewer/2022062419/55846e20d8b42abf538b481b/html5/thumbnails/6.jpg)
6
CompletelyObsoleteBusinessOrientedLanguage
![Page 7: Mad Computer Science: Testing COBOL with RSpec](https://reader036.fdocuments.in/reader036/viewer/2022062419/55846e20d8b42abf538b481b/html5/thumbnails/7.jpg)
7
** No affiliation with GEICO is intended or implied. All rights reserved. Look both ways before crossing the street. Vote early and vote often.
**
![Page 8: Mad Computer Science: Testing COBOL with RSpec](https://reader036.fdocuments.in/reader036/viewer/2022062419/55846e20d8b42abf538b481b/html5/thumbnails/8.jpg)
8
"COBOL has almost no fervent enthusiasts. As a programming tool, it has
roughly the sex appeal of a wrench."
Charles Petzold
![Page 9: Mad Computer Science: Testing COBOL with RSpec](https://reader036.fdocuments.in/reader036/viewer/2022062419/55846e20d8b42abf538b481b/html5/thumbnails/9.jpg)
9
![Page 10: Mad Computer Science: Testing COBOL with RSpec](https://reader036.fdocuments.in/reader036/viewer/2022062419/55846e20d8b42abf538b481b/html5/thumbnails/10.jpg)
A Simple Application
The Data The Code
10
PhoneValidator
AddressValidator
ContactValidatorContact
AddressPhone
![Page 11: Mad Computer Science: Testing COBOL with RSpec](https://reader036.fdocuments.in/reader036/viewer/2022062419/55846e20d8b42abf538b481b/html5/thumbnails/11.jpg)
Java Data Implementation
11
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. */}
![Page 12: Mad Computer Science: Testing COBOL with RSpec](https://reader036.fdocuments.in/reader036/viewer/2022062419/55846e20d8b42abf538b481b/html5/thumbnails/12.jpg)
COBOL Data Implementation
12
01 CONTACT. 05 NAME PIC X(30). 05 HOME-PHONE. 10 HOME-AREA-CODE PIC 9(3). 10 HOME-EXCHANGE PIC 9(3). 10 HOME-PHONE-NUMBER PIC 9(4). 05 CELL-PHONE. 10 CELL-AREA-CODE PIC 9(3). 10 CELL-EXCHANGE PIC 9(3). 10 CELL-PHONE-NUMBER PIC 9(4). 05 ADDRESS. 10 STREET PIC X(30). 10 CITY PIC X(20). 10 STATE PIC X(2). 10 ZIP-CODE PIC X(5).
![Page 13: Mad Computer Science: Testing COBOL with RSpec](https://reader036.fdocuments.in/reader036/viewer/2022062419/55846e20d8b42abf538b481b/html5/thumbnails/13.jpg)
Java Code Implementation
13
public class ContactValidator { private PhoneValidator phoneValidator; private AddressValidator addressValidator;
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 */ }
}
![Page 14: Mad Computer Science: Testing COBOL with RSpec](https://reader036.fdocuments.in/reader036/viewer/2022062419/55846e20d8b42abf538b481b/html5/thumbnails/14.jpg)
COBOL Code Implementation
14
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
![Page 15: Mad Computer Science: Testing COBOL with RSpec](https://reader036.fdocuments.in/reader036/viewer/2022062419/55846e20d8b42abf538b481b/html5/thumbnails/15.jpg)
15
![Page 16: Mad Computer Science: Testing COBOL with RSpec](https://reader036.fdocuments.in/reader036/viewer/2022062419/55846e20d8b42abf538b481b/html5/thumbnails/16.jpg)
16
COBOL is Just as Testable as Java
![Page 17: Mad Computer Science: Testing COBOL with RSpec](https://reader036.fdocuments.in/reader036/viewer/2022062419/55846e20d8b42abf538b481b/html5/thumbnails/17.jpg)
COBOLRuby
Eternity
17
contactspec.rb
ETERNITY.CBL
CONTACT.CBL
command.txt
input.txt
output.txt
eternity.rb
![Page 18: Mad Computer Science: Testing COBOL with RSpec](https://reader036.fdocuments.in/reader036/viewer/2022062419/55846e20d8b42abf538b481b/html5/thumbnails/18.jpg)
18
Demo!
![Page 19: Mad Computer Science: Testing COBOL with RSpec](https://reader036.fdocuments.in/reader036/viewer/2022062419/55846e20d8b42abf538b481b/html5/thumbnails/19.jpg)
Image Credits
19
http://www.flickr.com/photos/justin_case/1525042316http://www.flickr.com/photos/cbmd/2475626473
http://www.flickr.com/photos/kc-bike/2398970429http://www.flickr.com/photos/7603557@N08/454618030
http://www.flickr.com/photos/pennuja/5386712834http://www.flickr.com/photos/blackeycove/3997170938