SlideShare a Scribd company logo
1 of 3
What is COBOL?
• COmmon Business Orientated Language
• “Invented” by Grace Hopper, who was the
inventor of FLOW-MATIC.
• Standardised between 1959 and 1960 by
CODASYL (Pentagon).
• Designed to be platform and proprietor
independent.
• Code should be readable by managers,
business people and not just computer
scientists.
• Originally an ANSI standard, now ISO with
latest specification in 2014!
• 500+ Reserved Words
• Modern versions support Cloud
computing and microservices
architectures
• Famous for spaghetti code using GOTO,
GOSUBs, and the ALTER statement
Descriptive
naming
Structured
COBOL example
Identification division.
program-id. Stack.
*> Implements a stack in COBOL
*> Operators are: Pop, Push, and Peek
data division.
working-storage section.
01 StackTable is global.
02 StackItem pic x(20) occurs 1 to 50 times.
01 ItemsInStack pic 99 value zero is global.
linkage section.
01 Command pic x any length.
01 Item pic x any length.
procedure division using Command, Item.
Main section.
evaluate function trim(Command)
when "Push" perform PushItemOntoStack
when "Pop" perform PopItemOffStack
when "Peek" perform PeekWhichItemIsOnTopOfStack
end-evaluate
goback
.
PushItemOntoStack section.
add 1 to ItemsInStack
move Item to StackItem(ItemsInStack)
.
PeekWhichItemIsOnTopOfStack section.
move StackItem(ItemsInStack) to Item
.
PopItemOffStack section.
if ItemsInStack less than 1 then
move spaces to Item
else
move StackItem(ItemsInStack) to Item
move spaces to StackItem(ItemsInStack)
subtract 1 from ItemsInStack
end-if
.
end program Stack.
identification division.
program-id. StackTest.
*> A simple stack in COBOL
data division.
working-storage section.
01 Item pic x(10) value spaces.
01 Result pic x(10) value spaces.
procedure division.
TestShouldPopPushedItemsInReverseOrder.
*> Given
move "hello" to Item
call "Stack" using by content "Push", by content Item
move "hola" to Item
call "Stack" using by content "Push", by content Item
move "bonjour" to Item
call "Stack" using by content "Push", by content Item
*> When
call "Stack" using by content "Pop", by reference Result
*> Then
call "AssertEquals" using Result,
"bonjour", "Returned 3rd value put on stack”
*> When
call "Stack" using by content "Pop", by reference Result
*>Then
call "AssertEquals" using Result,
"hola", "Returned 2nd value put on stack”
Test Driven
Summary
• Become a better (COBOL) programmer, be a professional
and craft your code.
• Read Bob Martin’s Clean Code and The Clean Coder. Read
them again.
• Write tests.
• Bad code can be written in the latest and greatest trendy
new Google language; good code can be written in an old
dinosaur of a language.
• COBOL doesn’t suck as much as you might have thought.
• In fact it’s old methodologies, ignorance, sloppiness, and
yes, limitations of older programming languages.
• Some modern GNU COBOL examples wot I wrote at
https://github.com/mikebharris/

More Related Content

Similar to Clean COBOL Lightning Talk - Ox:Agile 2019

A quick and dirty intro to objective c
A quick and dirty intro to objective cA quick and dirty intro to objective c
A quick and dirty intro to objective cBilly Abbott
 
The Basic Concept Of IOC
The Basic Concept Of IOCThe Basic Concept Of IOC
The Basic Concept Of IOCCarl Lu
 
Beachhead implements new opcode on CLR JIT
Beachhead implements new opcode on CLR JITBeachhead implements new opcode on CLR JIT
Beachhead implements new opcode on CLR JITKouji Matsui
 
iPhone Programming [1/17] : Objective-C
iPhone Programming [1/17] : Objective-CiPhone Programming [1/17] : Objective-C
iPhone Programming [1/17] : Objective-CIMC Institute
 
Webinar: What's new in the .NET Driver
Webinar: What's new in the .NET DriverWebinar: What's new in the .NET Driver
Webinar: What's new in the .NET DriverMongoDB
 
iOS overview
iOS overviewiOS overview
iOS overviewgupta25
 
Learn OOP'S at ASIT
Learn OOP'S at ASITLearn OOP'S at ASIT
Learn OOP'S at ASITASIT
 
A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9Marcus Lagergren
 
Digging into asyncio
Digging into asyncioDigging into asyncio
Digging into asyncioMinJeong Kim
 
Vladimir Ulogov - Beyond the Loadable Module
Vladimir Ulogov - Beyond the Loadable ModuleVladimir Ulogov - Beyond the Loadable Module
Vladimir Ulogov - Beyond the Loadable ModuleZabbix
 
Beyond the Loadable Module
Beyond the Loadable ModuleBeyond the Loadable Module
Beyond the Loadable ModuleVladimir Ulogov
 
Cappuccino - A Javascript Application Framework
Cappuccino - A Javascript Application FrameworkCappuccino - A Javascript Application Framework
Cappuccino - A Javascript Application FrameworkAndreas Korth
 
1B-Introduction_to_python.ppt
1B-Introduction_to_python.ppt1B-Introduction_to_python.ppt
1B-Introduction_to_python.pptAmritMarwaha1
 
Introduction to underscore.js
Introduction to underscore.jsIntroduction to underscore.js
Introduction to underscore.jsJitendra Zaa
 

Similar to Clean COBOL Lightning Talk - Ox:Agile 2019 (20)

A quick and dirty intro to objective c
A quick and dirty intro to objective cA quick and dirty intro to objective c
A quick and dirty intro to objective c
 
The Basic Concept Of IOC
The Basic Concept Of IOCThe Basic Concept Of IOC
The Basic Concept Of IOC
 
2-Functions.pdf
2-Functions.pdf2-Functions.pdf
2-Functions.pdf
 
Beachhead implements new opcode on CLR JIT
Beachhead implements new opcode on CLR JITBeachhead implements new opcode on CLR JIT
Beachhead implements new opcode on CLR JIT
 
iPhone Programming [1/17] : Objective-C
iPhone Programming [1/17] : Objective-CiPhone Programming [1/17] : Objective-C
iPhone Programming [1/17] : Objective-C
 
Webinar: What's new in the .NET Driver
Webinar: What's new in the .NET DriverWebinar: What's new in the .NET Driver
Webinar: What's new in the .NET Driver
 
iOS overview
iOS overviewiOS overview
iOS overview
 
Mkl mic lab_0
Mkl mic lab_0Mkl mic lab_0
Mkl mic lab_0
 
Learn OOP'S at ASIT
Learn OOP'S at ASITLearn OOP'S at ASIT
Learn OOP'S at ASIT
 
5. react native-package
5. react native-package5. react native-package
5. react native-package
 
MacRuby, an introduction
MacRuby, an introductionMacRuby, an introduction
MacRuby, an introduction
 
A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9
 
Digging into asyncio
Digging into asyncioDigging into asyncio
Digging into asyncio
 
Vladimir Ulogov - Beyond the Loadable Module
Vladimir Ulogov - Beyond the Loadable ModuleVladimir Ulogov - Beyond the Loadable Module
Vladimir Ulogov - Beyond the Loadable Module
 
Beyond the Loadable Module
Beyond the Loadable ModuleBeyond the Loadable Module
Beyond the Loadable Module
 
RubyMotion
RubyMotionRubyMotion
RubyMotion
 
Cappuccino - A Javascript Application Framework
Cappuccino - A Javascript Application FrameworkCappuccino - A Javascript Application Framework
Cappuccino - A Javascript Application Framework
 
C by balaguruswami - e.balagurusamy
C   by balaguruswami - e.balagurusamyC   by balaguruswami - e.balagurusamy
C by balaguruswami - e.balagurusamy
 
1B-Introduction_to_python.ppt
1B-Introduction_to_python.ppt1B-Introduction_to_python.ppt
1B-Introduction_to_python.ppt
 
Introduction to underscore.js
Introduction to underscore.jsIntroduction to underscore.js
Introduction to underscore.js
 

More from Mike Harris

Extreme Programming (XP): Revisted
Extreme Programming (XP): RevistedExtreme Programming (XP): Revisted
Extreme Programming (XP): RevistedMike Harris
 
Using neuroscience to build high performance teams - Elaine Sullivan
Using neuroscience to build high performance teams - Elaine SullivanUsing neuroscience to build high performance teams - Elaine Sullivan
Using neuroscience to build high performance teams - Elaine SullivanMike Harris
 
Kotlin - A very quick introduction
Kotlin - A very quick introductionKotlin - A very quick introduction
Kotlin - A very quick introductionMike Harris
 
A Brief Introduction to Kanban
A Brief Introduction to KanbanA Brief Introduction to Kanban
A Brief Introduction to KanbanMike Harris
 
It's XP Stupid (2019)
It's XP Stupid (2019)It's XP Stupid (2019)
It's XP Stupid (2019)Mike Harris
 
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018Mike Harris
 
Contract Testing: An Introduction
Contract Testing: An IntroductionContract Testing: An Introduction
Contract Testing: An IntroductionMike Harris
 
Being a better programmer: Writing Clean COBOL
Being a better programmer: Writing Clean COBOLBeing a better programmer: Writing Clean COBOL
Being a better programmer: Writing Clean COBOLMike Harris
 
Aws assimilation
Aws assimilationAws assimilation
Aws assimilationMike Harris
 
This is heavy doc! Lessons on just in time architecture - Adrian Potter
This is heavy doc! Lessons on just in time architecture - Adrian PotterThis is heavy doc! Lessons on just in time architecture - Adrian Potter
This is heavy doc! Lessons on just in time architecture - Adrian PotterMike Harris
 
Working towards ideal ux, product and tech partnership
Working towards ideal ux, product and tech partnershipWorking towards ideal ux, product and tech partnership
Working towards ideal ux, product and tech partnershipMike Harris
 
Agile around the World - Glaudia Califano
Agile around the World - Glaudia Califano Agile around the World - Glaudia Califano
Agile around the World - Glaudia Califano Mike Harris
 
How To Handle Your Tech Debt Better - Sean Moir
How To Handle Your Tech Debt Better - Sean MoirHow To Handle Your Tech Debt Better - Sean Moir
How To Handle Your Tech Debt Better - Sean MoirMike Harris
 
Welcome to Elsevier - presentation for Ox:Agile Conference
Welcome to Elsevier - presentation for Ox:Agile ConferenceWelcome to Elsevier - presentation for Ox:Agile Conference
Welcome to Elsevier - presentation for Ox:Agile ConferenceMike Harris
 
HacktionLab: how LEAN is your non-hierarchical community education project
HacktionLab: how LEAN is your non-hierarchical community education projectHacktionLab: how LEAN is your non-hierarchical community education project
HacktionLab: how LEAN is your non-hierarchical community education projectMike Harris
 
How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....Mike Harris
 

More from Mike Harris (17)

Extreme Programming (XP): Revisted
Extreme Programming (XP): RevistedExtreme Programming (XP): Revisted
Extreme Programming (XP): Revisted
 
Using neuroscience to build high performance teams - Elaine Sullivan
Using neuroscience to build high performance teams - Elaine SullivanUsing neuroscience to build high performance teams - Elaine Sullivan
Using neuroscience to build high performance teams - Elaine Sullivan
 
Kotlin - A very quick introduction
Kotlin - A very quick introductionKotlin - A very quick introduction
Kotlin - A very quick introduction
 
A Brief Introduction to Kanban
A Brief Introduction to KanbanA Brief Introduction to Kanban
A Brief Introduction to Kanban
 
It's XP Stupid (2019)
It's XP Stupid (2019)It's XP Stupid (2019)
It's XP Stupid (2019)
 
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
 
Contract Testing: An Introduction
Contract Testing: An IntroductionContract Testing: An Introduction
Contract Testing: An Introduction
 
Being a better programmer: Writing Clean COBOL
Being a better programmer: Writing Clean COBOLBeing a better programmer: Writing Clean COBOL
Being a better programmer: Writing Clean COBOL
 
Aws assimilation
Aws assimilationAws assimilation
Aws assimilation
 
This is heavy doc! Lessons on just in time architecture - Adrian Potter
This is heavy doc! Lessons on just in time architecture - Adrian PotterThis is heavy doc! Lessons on just in time architecture - Adrian Potter
This is heavy doc! Lessons on just in time architecture - Adrian Potter
 
Working towards ideal ux, product and tech partnership
Working towards ideal ux, product and tech partnershipWorking towards ideal ux, product and tech partnership
Working towards ideal ux, product and tech partnership
 
Agile around the World - Glaudia Califano
Agile around the World - Glaudia Califano Agile around the World - Glaudia Califano
Agile around the World - Glaudia Califano
 
How To Handle Your Tech Debt Better - Sean Moir
How To Handle Your Tech Debt Better - Sean MoirHow To Handle Your Tech Debt Better - Sean Moir
How To Handle Your Tech Debt Better - Sean Moir
 
Welcome to Elsevier - presentation for Ox:Agile Conference
Welcome to Elsevier - presentation for Ox:Agile ConferenceWelcome to Elsevier - presentation for Ox:Agile Conference
Welcome to Elsevier - presentation for Ox:Agile Conference
 
It's XP, Stupid
It's XP, StupidIt's XP, Stupid
It's XP, Stupid
 
HacktionLab: how LEAN is your non-hierarchical community education project
HacktionLab: how LEAN is your non-hierarchical community education projectHacktionLab: how LEAN is your non-hierarchical community education project
HacktionLab: how LEAN is your non-hierarchical community education project
 
How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....
 

Recently uploaded

Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencessuser9e7c64
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingShane Coughlan
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 

Recently uploaded (20)

Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conference
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 

Clean COBOL Lightning Talk - Ox:Agile 2019

  • 1. What is COBOL? • COmmon Business Orientated Language • “Invented” by Grace Hopper, who was the inventor of FLOW-MATIC. • Standardised between 1959 and 1960 by CODASYL (Pentagon). • Designed to be platform and proprietor independent. • Code should be readable by managers, business people and not just computer scientists. • Originally an ANSI standard, now ISO with latest specification in 2014! • 500+ Reserved Words • Modern versions support Cloud computing and microservices architectures • Famous for spaghetti code using GOTO, GOSUBs, and the ALTER statement
  • 2. Descriptive naming Structured COBOL example Identification division. program-id. Stack. *> Implements a stack in COBOL *> Operators are: Pop, Push, and Peek data division. working-storage section. 01 StackTable is global. 02 StackItem pic x(20) occurs 1 to 50 times. 01 ItemsInStack pic 99 value zero is global. linkage section. 01 Command pic x any length. 01 Item pic x any length. procedure division using Command, Item. Main section. evaluate function trim(Command) when "Push" perform PushItemOntoStack when "Pop" perform PopItemOffStack when "Peek" perform PeekWhichItemIsOnTopOfStack end-evaluate goback . PushItemOntoStack section. add 1 to ItemsInStack move Item to StackItem(ItemsInStack) . PeekWhichItemIsOnTopOfStack section. move StackItem(ItemsInStack) to Item . PopItemOffStack section. if ItemsInStack less than 1 then move spaces to Item else move StackItem(ItemsInStack) to Item move spaces to StackItem(ItemsInStack) subtract 1 from ItemsInStack end-if . end program Stack. identification division. program-id. StackTest. *> A simple stack in COBOL data division. working-storage section. 01 Item pic x(10) value spaces. 01 Result pic x(10) value spaces. procedure division. TestShouldPopPushedItemsInReverseOrder. *> Given move "hello" to Item call "Stack" using by content "Push", by content Item move "hola" to Item call "Stack" using by content "Push", by content Item move "bonjour" to Item call "Stack" using by content "Push", by content Item *> When call "Stack" using by content "Pop", by reference Result *> Then call "AssertEquals" using Result, "bonjour", "Returned 3rd value put on stack” *> When call "Stack" using by content "Pop", by reference Result *>Then call "AssertEquals" using Result, "hola", "Returned 2nd value put on stack” Test Driven
  • 3. Summary • Become a better (COBOL) programmer, be a professional and craft your code. • Read Bob Martin’s Clean Code and The Clean Coder. Read them again. • Write tests. • Bad code can be written in the latest and greatest trendy new Google language; good code can be written in an old dinosaur of a language. • COBOL doesn’t suck as much as you might have thought. • In fact it’s old methodologies, ignorance, sloppiness, and yes, limitations of older programming languages. • Some modern GNU COBOL examples wot I wrote at https://github.com/mikebharris/