By: Travis Powell and Chad Herman. About CoffeeScript The Golden Rule: o "Its just JavaScript" One-to-One Compilage into equivalent JavaScript Passes.

Slides:



Advertisements
Similar presentations
JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Advertisements

Ruby (on Rails) CSE 190M, Spring 2009 Week 2. Arrays Similar to PHP, Ruby arrays… – Are indexed by zero-based integer values – Store an assortment of.
Classes  All code in a Java program is part of a class  A class has two purposes  Provide functions to do work for the programmer  Represent data.
Session 5 JavaScript/JScript: Control Structures II Matakuliah: M0114/Web Based Programming Tahun: 2005 Versi: 5.
1 CS 161 Introduction to Programming and Problem Solving Chapter 9 C++ Program Components Herbert G. Mayer, PSU Status 10/20/2014.
1 CS101 Introduction to Computing Lecture 23 Flow Control & Loops (Web Development Lecture 8)
Advanced JS The World's Most Misunderstood Programming Language ) Douglas Crockford( Shimon Dahan
True or false A variable of type char can hold the value 301. ( F )
Homework Any Questions?. Statements / Blocks, Section 3.1 An expression becomes a statement when it is followed by a semicolon x = 0; Braces are used.
More loops Linag, Chpt 3, pp The do-loop continue- condition ? loop-body statements next statement false true WHILE-LOOP continue- condition? loop-body.
Scripting Languages Perl Chapter #4 Subroutines. Writing your own Functions Functions is a programming language serve tow purposes: –They allow you to.
COMP 110 Introduction to Programming Mr. Joshua Stough September 24, 2007.
TODAY’S LECTURE Review Chapter 2 Go over exercises.
Programming Concepts MIT - AITI. Variables l A variable is a name associated with a piece of data l Variables allow you to store and manipulate data in.
Chapter 9 Interactive Multimedia Authoring with Flash - Introduction to Programming “Computers and Creativity” Richard D. Webster, COSC 109 Instructor.
JS Arrays, Functions, Events Week 5 INFM 603. Agenda Arrays Functions Event-Driven Programming.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
Chapter 4: Decision Making with Control Structures and Statements JavaScript - Introductory.
CSCI 3328 Object Oriented Programming in C# Chapter 5: C# Control Statement – Part II UTPA – Fall
PHP Conditional Statements Conditional statements in PHP are used to perform different actions based on different conditions. Conditional Statements Very.
CPS120: Introduction to Computer Science Decision Making in Programs.
Chapter 2 Functions and Control Structures PHP Programming with MySQL 2 nd Edition.
JavaScript Syntax and Semantics. Slide 2 Lecture Overview Core JavaScript Syntax (I will not review every nuance of the language)
Current Assignments Homework 2 is available and is due in three days (June 19th). Project 1 due in 6 days (June 23 rd ) Write a binomial root solver using.
L OO P S While writing a program, there may be a situation when you need to perform some action over and over again. In such situation you would need.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 8 - JavaScript: Control Structures I Outline 8.1 Introduction 8.2 Algorithms 8.3 Pseudocode 8.4.
JavaScript Syntax, how to use it in a HTML document
Basic Java Syntax COMP 401, Spring 2014 Lecture 2 1/14/2014.
Prototypal Inheritance. Can We Do Inheritance Without Classes? How do we share behaviour across objects.
JavaScript, Fourth Edition
©Colin Jamison 2004 Shell scripting in Linux Colin Jamison.
Julian on JavaScript: Functions Julian M Bucknall, CTO.
 2000 Deitel & Associates, Inc. All rights reserved. Chapter 10 - JavaScript/JScript: Control Structures II Outline 10.1Introduction 10.2Essentials of.
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
Computer Science By: Erica Ligons Compound Statement A compound statement- block A compound statement- is a unit of code consisting of zero or more statement.
CPS120 Introduction to Computer Science Iteration (Looping)
COP 3813 Intro to Internet Computing Prof. Roy Levow Lecture 4 JavaScript.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
Working with Loops, Conditional Statements, and Arrays.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Rich Internet Applications 2. Core JavaScript. The importance of JavaScript Many choices open to the developer for server-side Can choose server technology.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
Repetition Statements (Loops). 2 Introduction to Loops We all know that much of the work a computer does is repeated many times. When a program repeats.
MIT-AITI: Functions Defining and Invoking Functions Functions as Data Function Scope: The call Object Function Arguments: The arguments objects Function.
1 CS428 Web Engineering Lecture 13 Flow Control & Loops (JavaScript - III)
LECTURE # 8 : REPETITION STATEMENTS By Mr. Ali Edan.
XP Tutorial 3 New Perspectives on JavaScript, Comprehensive1 Working with Arrays, Loops, and Conditional Statements Creating a Monthly Calendar.
Programming Language C++ Lecture 3. Control Structures  C++ provides control structures that serve to specify what has to be done to perform our program.
JavaScript and Ajax (Control Structures) Week 4 Web site:
1 Review for Midterm 2 Aaron Bloomfield CS 101-E.
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
CSC 4630 Perl 3 adapted from R. E. Beck. Problem But we worked on it first: Input: Read from a text file named in a command line argument Output: List.
Chapter 8 Statement-Level Control Structures. Copyright © 2012 Addison-Wesley. All rights reserved.1-2 Chapter 8 Topics Introduction Selection Statements.
Today… Preparation for doing Assignment 1. Invoking methods overview. Conditionals and Loops. Winter 2016CMPE212 - Prof. McLeod1.
Introduction to Programming G50PRO University of Nottingham Unit 6 : Control Flow Statements 2 Paul Tennent
Presentation By :- Nikhil R. Anande ( ) Electronic & Communication Engineering. 3 nd Year / 5 th Semester FACULTY GUIDE : RAHIUL PATEL SIR MICROCONTROLLER.
Lecture III Syntax ● Statements ● Output ● Variables ● Conditions ● Loops ● List Comprehension ● Function Calls ● Modules.
Web Systems & Technologies
JavaScript Syntax and Semantics
CSC215 Lecture Flow Control.
Homework Any Questions?.
Program Flow.
CSC215 Lecture Control Flow.
CIS 136 Building Mobile Apps
Controlling Program Flow
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Chapter 8 JavaScript: Control Statements, Part 2
Presentation transcript:

By: Travis Powell and Chad Herman

About CoffeeScript The Golden Rule: o "Its just JavaScript" One-to-One Compilage into equivalent JavaScript Passes through JSLint Runs as fast or faster than equivalent JavaScript

First Things First... White Space Delimiter o Semicolons ';' are useless Curly braces '{}' are unnecessary o Solved with indents or new lines Functions o () contains parameter list o -> points to the body

Variables and Conditions Compiler properly declares all variables within lexical scope Similar to Ruby's local variable scope All output wrapped in "hidden"(function(){...}) for safety If Statement o No '()' or '{}' o Typical  If....  else.... o However  and = &&  or = ||

Splat??? Splat =... Accept Variable number of arguments Useful for when function takes in many parameters

Loops For, While, Until, Do o Comprehensions over arrays, objects, ranges "Of" o iterate over keys/values of objects

Loops (Continued...)

Everything is an Expression Nothing requires "return" keyword o Always returns final value Good idea to return early

Conditional Operators Existential Operator In JS, "if (var)" is close o Fails on 0, "", and false In CoffeeScript o "?" returns true if null or undefined o Similar to Ruby's "nil?" o Good for null/undef chain of properties

Class Overviews

Switch Statements Typical Switch has o Switch cond: o case 1, break; case 2, break; Switch in CoffeeScript o Switch cond:  when... then... else o does not require "breaks" or "default"

The Cake is a Lie Cake is similar to Make o used to build and test tasks Tasks are set in o Cakefiles (like make files) Tasks can be invoked by typing "cake 'taskname' "

Demonstration

References 1. Ashkenas, Jeremy. "CoffeeScript." CoffeeScript. MIT, Web. 15 May