SlideShare a Scribd company logo
1 of 16
Download to read offline
Real Programmers Use
Programming Languages
(Not Shell Scripts)
Daniel Laeng - May 2014
daniel@laeng.org
About Me
I’m a programmer (not a sysadmin)
● I like simple, readable, well tested code
● My background: Ruby, Java, C, R, PHP, bash
● I try to use the right tool for the right job
● I have seen bad code in every language
(My) Definitions
Shell Script
● Primarily used as command line interpreter
● Can also be used to write scripts/programs
● e.g. sh, csh, bash, tcsh, ksh, powershell
● Shell language of choice: bash
Programming Language
● Primarily for writing programs
● Rich set of libraries
● Compiled or uncompiled
● e.g. C, C++, Java, Python, Ruby, Perl, PHP
Why Shell Scripts are Good
● Quick to write
● Use commands you know (cp, mv, ps, etc)
● Complex tasks can be done in a short script
● Easy to try out on command prompt
● Power of unix pipes for free
Shell Programming Issues
What’s bad about programming in shell scripts
● Confusing syntax
● Untyped (everything is a string)
● Slow
● Not always portable
● No exception handling
Confusing Syntax 1
Bash
● Outputs: “No”
● Comparison operator “>” does string comparison
● Should have used “-eq” instead
Confusing Syntax 2
● Outputs: “No”
● Is actually a syntax error!!
● $A must be wrapped in double quotes
Confusing Syntax!
● Non standard comparison operators
● Variables need to be quoted... sometimes
● Variables need to be prepended with "$"...
sometimes
● Syntax errors can be caused by variable
contents
Untyped
● All variables behave like strings
● Some integer operations are allowed
● No built in floating point operators!!
● Can’t define your own types
Speed - Which is faster?
18 seconds (touch is an external command)
1 second (echo is a bash builtin)
Slow
● Built in commands are very limited
● You must use external commands often
● External commands are SLOW
● Slow code is not obvious. This takes 6 seconds:
● Equivalent code takes 0.1 seconds in ruby
Not Reliably Portable
Shell on my computer != Shell your computer
● ksh, tcsh and zsh are not common
● bash is common (but not universal)
● bourne shell (sh) is universal but weak
● None of them are likely to work on Windows
● Strong reliance on OS commands - which differ
across computers
No Exception Handling
● There is no built in exception handling
● There are (complicated) ways to work around
this
● Errors are hard to debug
When To Use Shell Scripts
Shell (Scripts)
● Working on the command line
● Wrapper to start a program
● One off hack to automate tedious task
● Keep it SHORT! (under 50 lines)
Programming Languages
● Anything with complicated logic
● Anything that needs to be fast
● Anything that needs to be portable
● Anything that should be tested
Generic
● Python
● Ruby
● Perl
What To Use Instead
Building / Compiling
● Make
● Rake
● Ant
● Maven
Deployment
● Capistrano
● Bamboo
● Jenkins
● Chef / Puppet
Dev-Ops
● Chef
● Puppet
● Vagrant
Conclusions
Understand your tools
● Shell scripts are very useful
● But - they are not a replacement for
programming languages
● Think about your choice - pick the right tool
● Happy scripting

More Related Content

What's hot

Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
Sway Wang
 
Introducing Yeoman 1.0 beta
Introducing Yeoman 1.0 betaIntroducing Yeoman 1.0 beta
Introducing Yeoman 1.0 beta
digitalzombie
 

What's hot (20)

Fisl13 gstreamer
Fisl13 gstreamerFisl13 gstreamer
Fisl13 gstreamer
 
Debugging Ruby (with Pry)
Debugging Ruby (with Pry)Debugging Ruby (with Pry)
Debugging Ruby (with Pry)
 
Django Toolbox
Django ToolboxDjango Toolbox
Django Toolbox
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
The History of Free Software
The History of Free SoftwareThe History of Free Software
The History of Free Software
 
Hackathon
HackathonHackathon
Hackathon
 
My talk on Piter Py 2016
My talk on Piter Py 2016My talk on Piter Py 2016
My talk on Piter Py 2016
 
Bash script (mask off remix)
Bash script (mask off remix)Bash script (mask off remix)
Bash script (mask off remix)
 
Ubuntu presentation
Ubuntu presentationUbuntu presentation
Ubuntu presentation
 
Introducing Yeoman 1.0 beta
Introducing Yeoman 1.0 betaIntroducing Yeoman 1.0 beta
Introducing Yeoman 1.0 beta
 
DIEMS Repository Server - GitLab
DIEMS Repository Server - GitLabDIEMS Repository Server - GitLab
DIEMS Repository Server - GitLab
 
Give me 15 minutes and i'll change your view of gdb
Give me 15 minutes and i'll change your view of gdbGive me 15 minutes and i'll change your view of gdb
Give me 15 minutes and i'll change your view of gdb
 
Shell.me
Shell.meShell.me
Shell.me
 
A Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoA Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to Go
 
Wait what? Postgresql can do that?
Wait what? Postgresql can do that?Wait what? Postgresql can do that?
Wait what? Postgresql can do that?
 
Ripping web accessible .git files
Ripping web accessible .git filesRipping web accessible .git files
Ripping web accessible .git files
 
Wonderful world of (distributed) SCM or VCS
Wonderful world of (distributed) SCM or VCSWonderful world of (distributed) SCM or VCS
Wonderful world of (distributed) SCM or VCS
 
Managing Windows Systems with Puppet - PuppetConf 2013
Managing Windows Systems with Puppet - PuppetConf 2013Managing Windows Systems with Puppet - PuppetConf 2013
Managing Windows Systems with Puppet - PuppetConf 2013
 
linux_distro
linux_distrolinux_distro
linux_distro
 
Central Iowa Linux Users Group October Meeting: Centos 8
Central Iowa Linux Users Group October Meeting: Centos 8Central Iowa Linux Users Group October Meeting: Centos 8
Central Iowa Linux Users Group October Meeting: Centos 8
 

Viewers also liked

Programming languages
Programming languagesProgramming languages
Programming languages
Tammy London
 
Chapter 5-programming
Chapter 5-programmingChapter 5-programming
Chapter 5-programming
Aten Kecik
 

Viewers also liked (20)

Why Zsh is Cooler than Your Shell
Why Zsh is Cooler than Your ShellWhy Zsh is Cooler than Your Shell
Why Zsh is Cooler than Your Shell
 
Why zsh is Cooler than Your Shell
Why zsh is Cooler than Your ShellWhy zsh is Cooler than Your Shell
Why zsh is Cooler than Your Shell
 
Zsh shell-for-humans
Zsh shell-for-humansZsh shell-for-humans
Zsh shell-for-humans
 
Selenium IDE
Selenium IDESelenium IDE
Selenium IDE
 
Zsh & fish: better *bash* for hackers
Zsh & fish: better *bash* for hackersZsh & fish: better *bash* for hackers
Zsh & fish: better *bash* for hackers
 
Vim kindergarten
Vim kindergartenVim kindergarten
Vim kindergarten
 
The Bash Love
The Bash LoveThe Bash Love
The Bash Love
 
Lets enjoy-terminal-life
Lets enjoy-terminal-lifeLets enjoy-terminal-life
Lets enjoy-terminal-life
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Introduction to Selenium IDE
Introduction to Selenium IDEIntroduction to Selenium IDE
Introduction to Selenium IDE
 
TMUX Rocks!
TMUX Rocks!TMUX Rocks!
TMUX Rocks!
 
ICT, Importance of programming and programming languages
ICT, Importance of programming and programming languagesICT, Importance of programming and programming languages
ICT, Importance of programming and programming languages
 
How to name things: the hardest problem in programming
How to name things: the hardest problem in programmingHow to name things: the hardest problem in programming
How to name things: the hardest problem in programming
 
Reactor 3.0, a reactive foundation for java 8 and Spring
Reactor 3.0, a reactive foundation for java 8 and SpringReactor 3.0, a reactive foundation for java 8 and Spring
Reactor 3.0, a reactive foundation for java 8 and Spring
 
Reactive Programming in Spring 5
Reactive Programming in Spring 5Reactive Programming in Spring 5
Reactive Programming in Spring 5
 
Evaluation Question: 02
Evaluation Question: 02Evaluation Question: 02
Evaluation Question: 02
 
Automated Testing vs Manual Testing
Automated Testing vs Manual TestingAutomated Testing vs Manual Testing
Automated Testing vs Manual Testing
 
Reactive Spring Framework 5
Reactive Spring Framework 5Reactive Spring Framework 5
Reactive Spring Framework 5
 
Presentation on computer language
Presentation on computer languagePresentation on computer language
Presentation on computer language
 
Chapter 5-programming
Chapter 5-programmingChapter 5-programming
Chapter 5-programming
 

Similar to Real programmers use programming languages (Not shell scripts)

Week 5
Week 5Week 5
Week 5
A VD
 
Week 5
Week 5Week 5
Week 5
A VD
 
Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1
Henry S
 
D turner power_pointpres
D turner power_pointpresD turner power_pointpres
D turner power_pointpres
david114811
 
ProgFund_Lecture_1_Introduction_to_Programming.pdf
ProgFund_Lecture_1_Introduction_to_Programming.pdfProgFund_Lecture_1_Introduction_to_Programming.pdf
ProgFund_Lecture_1_Introduction_to_Programming.pdf
lailoesakhan
 

Similar to Real programmers use programming languages (Not shell scripts) (20)

Introduction to Shell script
Introduction to Shell scriptIntroduction to Shell script
Introduction to Shell script
 
Presentation-1.pptx
Presentation-1.pptxPresentation-1.pptx
Presentation-1.pptx
 
Week 5
Week 5Week 5
Week 5
 
Week 5
Week 5Week 5
Week 5
 
Adopting language server for apache camel feedback from a java/Eclipse plugi...
Adopting language server for apache camel  feedback from a java/Eclipse plugi...Adopting language server for apache camel  feedback from a java/Eclipse plugi...
Adopting language server for apache camel feedback from a java/Eclipse plugi...
 
Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1
 
NANO266 - Lecture 9 - Tools of the Modeling Trade
NANO266 - Lecture 9 - Tools of the Modeling TradeNANO266 - Lecture 9 - Tools of the Modeling Trade
NANO266 - Lecture 9 - Tools of the Modeling Trade
 
Introduction to programming languages
Introduction to programming languagesIntroduction to programming languages
Introduction to programming languages
 
Shell programing|Shel Scripting
Shell programing|Shel ScriptingShell programing|Shel Scripting
Shell programing|Shel Scripting
 
Computer programming programming_langugages
Computer programming programming_langugagesComputer programming programming_langugages
Computer programming programming_langugages
 
D turner power_pointpres
D turner power_pointpresD turner power_pointpres
D turner power_pointpres
 
Number of Computer Languages = 3
Number of Computer Languages = 3Number of Computer Languages = 3
Number of Computer Languages = 3
 
Shell scrpting(payal harne)
Shell scrpting(payal harne)Shell scrpting(payal harne)
Shell scrpting(payal harne)
 
Anatomy of PHP Shells
Anatomy of PHP ShellsAnatomy of PHP Shells
Anatomy of PHP Shells
 
Go fundamentals
Go fundamentalsGo fundamentals
Go fundamentals
 
Bridging Ousterhout's Dichotomy
Bridging Ousterhout's DichotomyBridging Ousterhout's Dichotomy
Bridging Ousterhout's Dichotomy
 
Code Camp NYC 2017 - How to deal with everything... | Chris Ozog - Codesushi
Code Camp NYC 2017 - How to deal with everything... | Chris Ozog - Codesushi Code Camp NYC 2017 - How to deal with everything... | Chris Ozog - Codesushi
Code Camp NYC 2017 - How to deal with everything... | Chris Ozog - Codesushi
 
The art of concurrent programming
The art of concurrent programmingThe art of concurrent programming
The art of concurrent programming
 
ProgFund_Lecture_1_Introduction_to_Programming.pdf
ProgFund_Lecture_1_Introduction_to_Programming.pdfProgFund_Lecture_1_Introduction_to_Programming.pdf
ProgFund_Lecture_1_Introduction_to_Programming.pdf
 
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 

Real programmers use programming languages (Not shell scripts)

  • 1. Real Programmers Use Programming Languages (Not Shell Scripts) Daniel Laeng - May 2014 daniel@laeng.org
  • 2. About Me I’m a programmer (not a sysadmin) ● I like simple, readable, well tested code ● My background: Ruby, Java, C, R, PHP, bash ● I try to use the right tool for the right job ● I have seen bad code in every language
  • 3. (My) Definitions Shell Script ● Primarily used as command line interpreter ● Can also be used to write scripts/programs ● e.g. sh, csh, bash, tcsh, ksh, powershell ● Shell language of choice: bash Programming Language ● Primarily for writing programs ● Rich set of libraries ● Compiled or uncompiled ● e.g. C, C++, Java, Python, Ruby, Perl, PHP
  • 4. Why Shell Scripts are Good ● Quick to write ● Use commands you know (cp, mv, ps, etc) ● Complex tasks can be done in a short script ● Easy to try out on command prompt ● Power of unix pipes for free
  • 5. Shell Programming Issues What’s bad about programming in shell scripts ● Confusing syntax ● Untyped (everything is a string) ● Slow ● Not always portable ● No exception handling
  • 6. Confusing Syntax 1 Bash ● Outputs: “No” ● Comparison operator “>” does string comparison ● Should have used “-eq” instead
  • 7. Confusing Syntax 2 ● Outputs: “No” ● Is actually a syntax error!! ● $A must be wrapped in double quotes
  • 8. Confusing Syntax! ● Non standard comparison operators ● Variables need to be quoted... sometimes ● Variables need to be prepended with "$"... sometimes ● Syntax errors can be caused by variable contents
  • 9. Untyped ● All variables behave like strings ● Some integer operations are allowed ● No built in floating point operators!! ● Can’t define your own types
  • 10. Speed - Which is faster? 18 seconds (touch is an external command) 1 second (echo is a bash builtin)
  • 11. Slow ● Built in commands are very limited ● You must use external commands often ● External commands are SLOW ● Slow code is not obvious. This takes 6 seconds: ● Equivalent code takes 0.1 seconds in ruby
  • 12. Not Reliably Portable Shell on my computer != Shell your computer ● ksh, tcsh and zsh are not common ● bash is common (but not universal) ● bourne shell (sh) is universal but weak ● None of them are likely to work on Windows ● Strong reliance on OS commands - which differ across computers
  • 13. No Exception Handling ● There is no built in exception handling ● There are (complicated) ways to work around this ● Errors are hard to debug
  • 14. When To Use Shell Scripts Shell (Scripts) ● Working on the command line ● Wrapper to start a program ● One off hack to automate tedious task ● Keep it SHORT! (under 50 lines) Programming Languages ● Anything with complicated logic ● Anything that needs to be fast ● Anything that needs to be portable ● Anything that should be tested
  • 15. Generic ● Python ● Ruby ● Perl What To Use Instead Building / Compiling ● Make ● Rake ● Ant ● Maven Deployment ● Capistrano ● Bamboo ● Jenkins ● Chef / Puppet Dev-Ops ● Chef ● Puppet ● Vagrant
  • 16. Conclusions Understand your tools ● Shell scripts are very useful ● But - they are not a replacement for programming languages ● Think about your choice - pick the right tool ● Happy scripting