SlideShare a Scribd company logo
1 of 15
By
www.indiesjxe.com www.indiesinc.com
• What is Coffee Script ?
• How it can help us ?
• Coffee in Browse ?
• Advantage?
• Disadvantage?
Coffee Script
Basic Introduction
What is Coffee Script-1
• Coffee Script is a programming language that transcompiles to
JavaScript that means source code of a coffee script as its input
and outputs the source code into another programming language.
• The language adds syntactic sugar inspired by Ruby, Python and
Haskell to enhance JavaScript's brevity and readability, adding
sophisticated features like list comprehension and pattern
matching.
• Coffee Script is an attempt to expose the good parts of JavaScript
What is Coffee Script-1
• The golden rule of Coffee Script is: "It's just JavaScript". The code
compiles one-to-one into the equivalent JS, and there is no
interpretation at runtime.
• You can use any existing JavaScript library seamlessly from Coffee
Script (and vice-versa). a simple way. The compiled output is
readable and pretty-printed, will work in every JavaScript
runtime, and tends to run as fast or faster than the equivalent
handwritten JavaScript.
What is Coffee Script -2
• Cooperate with already existing JS libraries (like
jQuery, Facebook JS SDK, Google API etc.)
• Code compiles one-to-one into the equivalent JS
• Pass through JSLint without warnings
How it can help us ?
• Less lines of code with better readability,
• Code easy to understand, and maintain
• Standard code encapsulation and variables
• Protection (no var anymore)
• But... even if you are writing code in CoffeeScript
You should know how JavaScript`s concepts work
Example
Coffee Script in Your Browser
1. <script src=“coffee-script.js” type=“text/javascript”></script>
2. <script type=“text/CoffeScript”>
3. firstname = prompt “what is your first name?”
4. lastname= prompt “what is your last name ?”
5. fullname=firstname+ lastname
6. Alert “Hello, #{fullname}”
7. </script>
Advantages
• All the good Feature of java script are present in coffee
script
• English Like syntax and no return statement required.
• You don`t have to debug any “ }” in your script
• With the proper use of white space you can make your
script more readable as well as maintainable
Advantages
• The ability to write code that works in old versions of
Internet Explorer without having to compromise or
shim
• Not having to worry about JavaScript pitfalls like
trailing commas and automatic semicolon insertion
• Cleaned up semantics where every language construct
can be used as part of a larger expression
Disadvantages
• When you are using coffee script , there`s an additional
compilation step involved in the process.
• Coffee Script is very sensitive to whitespace, counting a tab
as a single space.
• The compiler provides very rudimentary diagnostic
information in the case of errors.
Disadvantages
• Priority rules are not always intuitive, sometimes causing
sub-expressions to end up in unexpected places.
• Debugging is a major problem because the compiled code
is not always readable.
• But Coffee script team is trying to solve this in the future
The Final Word
• Sole purpose is to remove the rough edges from the java
script and provide a smooth way of programming in
JavaScript
• Now Programming in JavaScript has an easy way and
hard way –the choice is yours.
• To learn Coffee script syntax you can refer
Coffeescript.org
www.indiesinc.com

More Related Content

What's hot

Db migration automation
Db migration automationDb migration automation
Db migration automation
Thomas Queste
 

What's hot (20)

Why use Go for web development?
Why use Go for web development?Why use Go for web development?
Why use Go for web development?
 
Async js
Async jsAsync js
Async js
 
Single page App
Single page AppSingle page App
Single page App
 
5 reasons to program javascript
5 reasons to program javascript5 reasons to program javascript
5 reasons to program javascript
 
Functional Programming in PHP
Functional Programming in PHPFunctional Programming in PHP
Functional Programming in PHP
 
Fast Web Applications with Go
Fast Web Applications with Go Fast Web Applications with Go
Fast Web Applications with Go
 
Analyse your web performance
Analyse your web performanceAnalyse your web performance
Analyse your web performance
 
A Gentle Introduction to Functions-as-a-Service
A Gentle Introduction to Functions-as-a-ServiceA Gentle Introduction to Functions-as-a-Service
A Gentle Introduction to Functions-as-a-Service
 
Migrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to GoMigrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to Go
 
Azkaban-en
Azkaban-enAzkaban-en
Azkaban-en
 
Gemboys
GemboysGemboys
Gemboys
 
CoffeeScript Design Patterns
CoffeeScript Design PatternsCoffeeScript Design Patterns
CoffeeScript Design Patterns
 
SCCI'15 - Devology - Session 6 - Servers and PHP
SCCI'15 - Devology - Session 6 - Servers and PHPSCCI'15 - Devology - Session 6 - Servers and PHP
SCCI'15 - Devology - Session 6 - Servers and PHP
 
Db migration automation
Db migration automationDb migration automation
Db migration automation
 
Why I will never write JavaScript ever again*
Why I will never write JavaScript ever again*Why I will never write JavaScript ever again*
Why I will never write JavaScript ever again*
 
An Example-Driven API Tester
An Example-Driven API TesterAn Example-Driven API Tester
An Example-Driven API Tester
 
Real World Rails Deployment
Real World Rails DeploymentReal World Rails Deployment
Real World Rails Deployment
 
Cucumber.js: Cuke up your JavaScript!
Cucumber.js: Cuke up your JavaScript!Cucumber.js: Cuke up your JavaScript!
Cucumber.js: Cuke up your JavaScript!
 
A idea of Powerful WooCmmerce Site
A idea of Powerful WooCmmerce SiteA idea of Powerful WooCmmerce Site
A idea of Powerful WooCmmerce Site
 
Vb script in asp
Vb script in aspVb script in asp
Vb script in asp
 

Viewers also liked (6)

Coffeescript
CoffeescriptCoffeescript
Coffeescript
 
Rails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript using CoffeeScript, Backbone.js and JasmineRails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
 
CoffeeScript in 5mins
CoffeeScript in 5minsCoffeeScript in 5mins
CoffeeScript in 5mins
 
Ruby Made Simple: Blocks Plus Iterators
Ruby Made Simple: Blocks Plus IteratorsRuby Made Simple: Blocks Plus Iterators
Ruby Made Simple: Blocks Plus Iterators
 
Coffee Script
Coffee ScriptCoffee Script
Coffee Script
 
Concurrency & Ruby
Concurrency & RubyConcurrency & Ruby
Concurrency & Ruby
 

Similar to Introduction to Coffeescript

Similar to Introduction to Coffeescript (20)

The ES6 Conundrum - All Things Open 2015
The ES6 Conundrum - All Things Open 2015The ES6 Conundrum - All Things Open 2015
The ES6 Conundrum - All Things Open 2015
 
Quo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynoteQuo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynote
 
Coffee script throwdown
Coffee script throwdownCoffee script throwdown
Coffee script throwdown
 
Let’s learn how to use JavaScript responsibly and stay up-to-date.
Let’s learn how to use JavaScript responsibly and stay up-to-date. Let’s learn how to use JavaScript responsibly and stay up-to-date.
Let’s learn how to use JavaScript responsibly and stay up-to-date.
 
[Start] Playing
[Start] Playing[Start] Playing
[Start] Playing
 
Shell scrpting(payal harne)
Shell scrpting(payal harne)Shell scrpting(payal harne)
Shell scrpting(payal harne)
 
Writing Bullet-Proof Javascript: By Using CoffeeScript
Writing Bullet-Proof Javascript: By Using CoffeeScriptWriting Bullet-Proof Javascript: By Using CoffeeScript
Writing Bullet-Proof Javascript: By Using CoffeeScript
 
Accelerate your career in Java.pptx
Accelerate your career in Java.pptxAccelerate your career in Java.pptx
Accelerate your career in Java.pptx
 
Smooth CoffeeScript
Smooth CoffeeScriptSmooth CoffeeScript
Smooth CoffeeScript
 
WT Module-3.pptx
WT Module-3.pptxWT Module-3.pptx
WT Module-3.pptx
 
Modern js in practice
Modern js in practiceModern js in practice
Modern js in practice
 
Top 10 programming languages
Top 10 programming languagesTop 10 programming languages
Top 10 programming languages
 
Cucumber in Practice(en)
Cucumber in Practice(en)Cucumber in Practice(en)
Cucumber in Practice(en)
 
java Features
java Featuresjava Features
java Features
 
Java script
Java scriptJava script
Java script
 
Java script
Java scriptJava script
Java script
 
Java (1)
Java (1)Java (1)
Java (1)
 
1 java introduction
1 java introduction1 java introduction
1 java introduction
 
1 java intro
1 java intro1 java intro
1 java intro
 
Interpreters & Debuggers
Interpreters  &  DebuggersInterpreters  &  Debuggers
Interpreters & Debuggers
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].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...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
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...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
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
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

Introduction to Coffeescript

  • 2. • What is Coffee Script ? • How it can help us ? • Coffee in Browse ? • Advantage? • Disadvantage?
  • 4. What is Coffee Script-1 • Coffee Script is a programming language that transcompiles to JavaScript that means source code of a coffee script as its input and outputs the source code into another programming language. • The language adds syntactic sugar inspired by Ruby, Python and Haskell to enhance JavaScript's brevity and readability, adding sophisticated features like list comprehension and pattern matching. • Coffee Script is an attempt to expose the good parts of JavaScript
  • 5. What is Coffee Script-1 • The golden rule of Coffee Script is: "It's just JavaScript". The code compiles one-to-one into the equivalent JS, and there is no interpretation at runtime. • You can use any existing JavaScript library seamlessly from Coffee Script (and vice-versa). a simple way. The compiled output is readable and pretty-printed, will work in every JavaScript runtime, and tends to run as fast or faster than the equivalent handwritten JavaScript.
  • 6. What is Coffee Script -2 • Cooperate with already existing JS libraries (like jQuery, Facebook JS SDK, Google API etc.) • Code compiles one-to-one into the equivalent JS • Pass through JSLint without warnings
  • 7. How it can help us ? • Less lines of code with better readability, • Code easy to understand, and maintain • Standard code encapsulation and variables • Protection (no var anymore) • But... even if you are writing code in CoffeeScript You should know how JavaScript`s concepts work
  • 9. Coffee Script in Your Browser 1. <script src=“coffee-script.js” type=“text/javascript”></script> 2. <script type=“text/CoffeScript”> 3. firstname = prompt “what is your first name?” 4. lastname= prompt “what is your last name ?” 5. fullname=firstname+ lastname 6. Alert “Hello, #{fullname}” 7. </script>
  • 10. Advantages • All the good Feature of java script are present in coffee script • English Like syntax and no return statement required. • You don`t have to debug any “ }” in your script • With the proper use of white space you can make your script more readable as well as maintainable
  • 11. Advantages • The ability to write code that works in old versions of Internet Explorer without having to compromise or shim • Not having to worry about JavaScript pitfalls like trailing commas and automatic semicolon insertion • Cleaned up semantics where every language construct can be used as part of a larger expression
  • 12. Disadvantages • When you are using coffee script , there`s an additional compilation step involved in the process. • Coffee Script is very sensitive to whitespace, counting a tab as a single space. • The compiler provides very rudimentary diagnostic information in the case of errors.
  • 13. Disadvantages • Priority rules are not always intuitive, sometimes causing sub-expressions to end up in unexpected places. • Debugging is a major problem because the compiled code is not always readable. • But Coffee script team is trying to solve this in the future
  • 14. The Final Word • Sole purpose is to remove the rough edges from the java script and provide a smooth way of programming in JavaScript • Now Programming in JavaScript has an easy way and hard way –the choice is yours. • To learn Coffee script syntax you can refer Coffeescript.org