JavaScript for C# Programmers Kevin
|
|
- Alan Griffin McDonald
- 6 years ago
- Views:
Transcription
1 JavaScript for C# Programmers Kevin
2 Agenda Types Basic Syntax Objects Functions 2
3 Basics 'C' like language braces brackets functions function dosomething(){ 3
4 Variables Use var to introduce variables Not typed (mostly) var age = 1; var name = "Alice"; Use let in ES6 Better scoping if(age > 18) { let isadult = true;... for ( let i=i ; i < 10 ; i++ ) { console.log(i); 4
5 Types JavaScript has a limited number of types Object Number String Function Boolean Undefined Null 5
6 Equality Be afraid, be very afraid Not transitive ==/!= Compares values does type coercion ===/!== also compares types '' == '0' // false 0 == '' // true 0 == '0' // true 6
7 Truthyness and Falsyness 0, false, '', '0', null, undefined, NaN all falsey Everything else truthy 7
8 Control Statements if..else switch for while do..while with 8
9 Functions Many ways of declaring and calling functions More later 9
10 Exceptions try..catch throw finally 10
11 OO in JavaScript (Post ES6) class keyword constructors inheritance 11
12 ES6 Classes class Person { constructor(name) { this.name = name; printname () { console.log(this.name); 12
13 Inheritance class User extends Person { constructor(name) { super(name); printname () { super.printname(); 13
14 OO in JavaScript (Pre ES6) How to define objects in JavaScript Prototypes Inheritance Instantiation Sub-classing 14
15 Prototypes JavaScript supports prototypical inheritance Each JavaScript functions have a 'prototype' property Shared across instances Can use to share functions 15
16 Constructor functions Can create objects many ways in JavaScript Can use the object syntax var k = {name: 'Kevin'; Can use the constructor syntax function User(){ ; var user = new User(); 16
17 Issues with instances Creating instances creates multiple copies Each instance gets its own copy of functions function User(){ this.name = function(){... ; var kevin = new User(); kevin.name("kevin"); var terry = new User(); terry.name("terry"); 17
18 Inheritance Prototypes also enable inheritance Via the prototype chain Can use instance of one object as prototype of another 18
19 Inheritance Set 'derived' prototype as 'base class' Sometimes see User.prototype = new Person() Now all derived instances share single base's properties function Dummy () { function Person() { this.age = function (){... function User() { this.name = function (name) {... Dummy.prototype = Person.prototype; User.prototype = new Dummy(); // otherwise User's ctor == Person User.prototype.constructor = User; 19
20 Delegates Enable lots of functional features Functions as first class features in a language Higher order functions Functions that take functions Functions that return functions 20
21 Delegates c# type Can think of as a function pointer delegate bool Predicate<T>(T value); Predicate<int> IsAdult = x => x >= 18; void DoIfAdult(Person p) { if(isadult(p.age)) { 21
22 JavaScript Functions JavaScript is more functional than OO based Higher order functions Closures Arrow functions (ES6) 22
23 Functions as first class objects Functions Can be assigned to variables Passed to other functions Returned from functions 23
24 Assigning functions One of the first things we'll do as a JavaScript programmer function onstart(){ window.onload = onstart; // or window.onload = function(){ ; 24
25 Declaring functions Declared using a function literal function keyword optional name comma separated parameter list body 25
26 Examples of functions function foo(){return true; assert(typeof foo === "function", "defined"); assert(foo.name === "foo", "named"); var bar = function(){return true; assert(typeof bar === "function", "defined"); assert(bar.name === "", "no name"); window.baz = function(){return true; assert(typeof baz === "function", "defined"); assert(baz.name === "", "no name"); 26
27 Non global functions Previous slide showed global functions Scoped to 'window' Functions can be scoped function outer(){ assert(typeof outer === "function", "function"); assert(typeof inner === "function", "nested"); function inner(){ outer(); assert(typeof inner === "undefined", "nested"); 27
28 JavaScript scoping Scopes created by functions not blocks i.e. { does not create a scope functions are hoisted to the top of the declaring block function outer(){ assert(typeof outer === "function", "function"); assert(typeof inner === "function", "nested"); function inner(){ outer(); assert(typeof inner === "undefined", "nested"); 28
29 Function parameters A list of arguments can be provided when calling a function these are assigned to the function parameters numbers of arguments and parameters do not have to match If fewer arguments than parameters extra parameters are set to undefined If more arguments than parameters excess arguments are not assigned 29
30 Implicit argument parameter 'this' and 'arguments' are also available inside the function 'arguments' is collection of all arguments passed has.length property access using array syntax 30
31 'arguments' parameter Not an array is 'array like' 31
32 Implicit 'this' parameter Reference to the invoker of the function Also known as the function context 'this' can vary depending on how the function is invoked 32
33 'function' invocation This is invocation as you would think of it function createuser(){ createuser(); var updateuser = function(){; updateuser(); 33
34 'method' invocation Function added as a property on an object and called through that object Inside the function 'this' is a reference to the calling object var user; user.createuser = function(){; user.createuser(); function createuser(){ return this; createuser(); // this === window var user = {; user.createuser = createuser; user.createuser(); // this === user 34
35 Closures Closure defines a scope Created when function is declared Allows access to variables defined outside function Variables can still be accessed when function is used Even if their scope has disappeared 35
36 Example var outervalue = 'outer'; var inner; test("closure tests", function () { function outerfunction() { var innervalue = 'inner'; assert(outervalue == "outer","ok"); ); function innerfunction(){ assert(innervalue == "inner","ok"); inner = innerfunction; outerfunction(); inner(); // called but 'outerfunction' has // long gone away 36
37 How Closures work innerfunction is a closure It captures the scope of where it was when it was declared 'closes over' the scope outerfunction innerfunction outervalue inner innervalue 37
38 Using closures Closures have many uses Private variables Binding 'this' Event handlers 38
39 Declaring private variables Can define a constructor Variables defined within are 'private' to the constructor function User(name) { var _name = name; this.getname = function () { return _name; ; var kevin = new User('kevin'); assert("kevin" == kevin.getname(), "Name is kevin"); 39
40 Arrow functions Removes ceremony from anonymous functions function displaymessage(displayer, message) { displayer.write(message); displaymessage(function displayer(m) { console.log(m);, "Hello World"); displaymessage(m => console.log(m), "Hello, World"); 40
41 C#6 Iterators Simple way of implementing IEnumerator/IEnumerable pair IEnumerable<int> GetValue() { for(int i = 0; i < 10; i++) yield return i; foreach(var i in GetValue()) Console.WriteLine(i); 41
42 Generators and Iterators Generators function *foo() { var x = 1 + (yield "foo"); console.log(x); var foo = foo(); foo.next(); // {value: foo; done: false foo.next(23); // {value: undefined; done: true 42
43 Iterators function *foo() { yield 1; yield 2; yield 3; yield 4; yield 5; var it = foo(); var value = it.next(); for (var v of foo()) { console.log( v ); 43
44 Async function getprofile() { var result = $.get(); gen.next(result); function getmeetings() { var result = $.get(); gen.next(result); function *getusermeetings() { var a = yield getprofile(); var b = yield getmeetings(); console.log(a, b); var gen = getusermeetings(); gen.next(); 44
45 Further Reading Combining generators with promises async/await in ES7 and TypeScript 45
46 Q & A kevin@rocksolidknowledge.com
FALL 2017 CS 498RK JAVASCRIPT. Fashionable and Functional!
CS 498RK FALL 2017 JAVASCRIPT Fashionable and Functional! JAVASCRIPT popular scripting language on the Web, supported by browsers separate scripting from structure (HTML) and presentation (CSS) client-
More informationJavaScript: Sort of a Big Deal,
: Sort of a Big Deal, But Sort of Quirky... March 20, 2017 Lisp in C s Clothing (Crockford, 2001) Dynamically Typed: no static type annotations or type checks. C-Like Syntax: curly-braces, for, semicolons,
More informationBoot Camp JavaScript Sioux, March 31, 2011
Boot Camp JavaScript http://rix0r.nl/bootcamp Sioux, March 31, 2011 Agenda Part 1: JavaScript the Language Short break Part 2: JavaScript in the Browser History May 1995 LiveScript is written by Brendan
More informationJavaScript: More Syntax
JavaScript: More Syntax CISC 282 October 23, 2018 null and undefined What s the difference? null is synonymous with nothing i.e., no value, nothing there undefined is synonymous with the unknown i.e.,
More informationJavaScript. Training Offer for JavaScript Introduction JavaScript. JavaScript Objects
JavaScript CAC Noida is an ISO 9001:2015 certified training center with professional experience that dates back to 2005. The vision is to provide professional education merging corporate culture globally
More informationJAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)
Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 2 Professional Program: Data Administration and Management JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1) AGENDA
More informationINF3110 Programming Languages Runtime Organization part II
INF3110 Programming Languages Runtime Organization part II 10/13/16 1 Higher-Order Functions Language features Functions passed as arguments Functions that return functions from nested blocks Need to maintain
More informationSymbols. accessor properties, attributes, creating, adding properties, 8 anonymous functions, 20, 80
Index Symbols { } (braces) for function contents, 18 and object properties, 9 == (double equals operator), 5 === (triple equals operator), 5 [ ] (square brackets) for array literals, 10 for property access,
More informationDecision Making in C
Decision Making in C Decision making structures require that the programmer specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed
More informationMatchaScript: Language Reference Manual Programming Languages & Translators Spring 2017
MatchaScript: Language Reference Manual Programming Languages & Translators Spring 2017 Language Guru: Kimberly Hou - kjh2146 Systems Architect: Rebecca Mahany - rlm2175 Manager: Jordi Orbay - jao2154
More informationNode.js Training JavaScript. Richard richardrodger.com
Node.js Training JavaScript Richard Rodger @rjrodger richardrodger.com richard.rodger@nearform.com A New Look at JavaScript Embracing JavaScript JavaScript Data Structures JavaScript Functions Functional
More informationClient-Side Web Technologies. JavaScript Part I
Client-Side Web Technologies JavaScript Part I JavaScript First appeared in 1996 in Netscape Navigator Main purpose was to handle input validation that was currently being done server-side Now a powerful
More informationJavaScript or: HOW I LEARNED TO STOP WORRYING AND LOVE A CLASSLESS*
JavaScript or: HOW I LEARNED TO STOP WORRYING AND LOVE A CLASSLESS* LOOSELY TYPED LANGUAGE Two parts Part 1 JavaScript the language Part 2 What is it good for? Part 1 JavaScript the language What is JavaScript?
More informationJavaScript: Coercion, Functions, Arrays
JavaScript: Coercion, Functions, Arrays Computer Science and Engineering College of Engineering The Ohio State University Lecture 20 Conversion of Primitive Values String Number Boolean numbers 0 "0" false
More informationJavaScript Syntax. Web Authoring and Design. Benjamin Kenwright
JavaScript Syntax Web Authoring and Design Benjamin Kenwright Milestone Dates Demonstrate Coursework 1 Friday (15 th December) 10 Minutes Each Coursework 2 (Group Project) Website (XMAS) Javascript Game
More informationINF5750. Introduction to JavaScript and Node.js
INF5750 Introduction to JavaScript and Node.js Outline Introduction to JavaScript Language basics Introduction to Node.js Tips and tools for working with JS and Node.js What is JavaScript? Built as scripting
More informationINF3110 Programming Languages Runtime Organization part II
INF3110 Programming Languages Runtime Organization part II 10/24/17 1 Today: Higher-Order Functions, and Objects at runtime Higher-order functions: Functions passed as arguments Functions that return functions
More informationJAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)
Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 4 Professional Program: Data Administration and Management JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1) AGENDA
More informationIntroduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p.
Preface p. xiii Introduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p. 5 Client-Side JavaScript: Executable Content
More informationPrincess Nourah bint Abdulrahman University. Computer Sciences Department
Princess Nourah bint Abdulrahman University 1 And use http://www.w3schools.com/ JavaScript Objectives Introduction to JavaScript Objects Data Variables Operators Types Functions Events 4 Why Study JavaScript?
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationWeb Application Development
Web Application Development Produced by David Drohan (ddrohan@wit.ie) Department of Computing & Mathematics Waterford Institute of Technology http://www.wit.ie JavaScript JAVASCRIPT FUNDAMENTALS Agenda
More informationCompiler Errors. Flash CS4 Professional ActionScript 3.0 Language Reference. 1 of 18 9/6/2010 9:40 PM
1 of 18 9/6/2010 9:40 PM Flash CS4 Professional ActionScript 3.0 Language Reference Language Reference only Compiler Errors Home All Packages All Classes Language Elements Index Appendixes Conventions
More informationTypescript on LLVM Language Reference Manual
Typescript on LLVM Language Reference Manual Ratheet Pandya UNI: rp2707 COMS 4115 H01 (CVN) 1. Introduction 2. Lexical Conventions 2.1 Tokens 2.2 Comments 2.3 Identifiers 2.4 Reserved Keywords 2.5 String
More informationJavaScript or: How I Learned to Stop Worrying and Love a Classless Loosely Typed Language
JavaScript or: How I Learned to Stop Worrying and Love a Classless Loosely Typed Language Part 1 JavaScript the language What is JavaScript? Why do people hate JavaScript? / Should *you* hate JavaScript?
More informationSebastiano
Sebastiano Armeli @sebarmeli http://html5hub.com/wp-content/uploads/2013/11/es6-hiway-sign.png Sebastiano Armeli @sebarmeli ES6 History 199 199 199 199 199 200 200 5 6 7 8 9 0 3 JSScript ECMA-262 Ed.2
More informationJavaScript: the language of browser interactions. Claudia Hauff TI1506: Web and Database Technology
JavaScript: the language of browser interactions Claudia Hauff TI1506: Web and Database Technology ti1506-ewi@tudelft.nl Densest Web lecture of this course. Coding takes time. Be friendly with Codecademy
More informationJavascript. Many examples from Kyle Simpson: Scope and Closures
Javascript Many examples from Kyle Simpson: Scope and Closures What is JavaScript? Not related to Java (except that syntax is C/Java- like) Created by Brendan Eich at Netscape later standardized through
More informationBusy.NET Developer's Guide to ECMAScript
Busy.NET Developer's Guide to ECMAScript Ted Neward http://www.tedneward.com Level: Intermediate Credentials Who is this guy? Principal Consultant, architect, mentor BEA Technical Director, Microsoft MVP
More informationJavaScript: More Syntax and Using Events
JavaScript: Me Syntax and Using Events CISC 282 October 4, 2017 null and undefined null is synonymous with nothing i.e., no value, nothing there undefined in synonymous with confusion i.e., what's this?
More informationFundamental Concepts and Definitions
Fundamental Concepts and Definitions Identifier / Symbol / Name These terms are synonymous: they refer to the name given to a programming component. Classes, variables, functions, and methods are the most
More informationJavaScript Lecture 3b (Some language features)
Lecture 3b (Some language features) Waterford Institute of Technology June 10, 2016 John Fitzgerald Waterford Institute of Technology, Lecture 3b (Some language features) 1/30 Introduction Topics discussed
More informationCSC Web Programming. Introduction to JavaScript
CSC 242 - Web Programming Introduction to JavaScript JavaScript JavaScript is a client-side scripting language the code is executed by the web browser JavaScript is an embedded language it relies on its
More informationLesson 06 Arrays. MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL
Lesson 06 Arrays MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL Array An array is a group of variables (called elements or components) containing
More informationMidterm Exam. 5. What is the character - (minus) used for in JavaScript? Give as many answers as you can.
First Name Last Name CSCi 90.3 March 23, 2010 Midterm Exam Instructions: For multiple choice questions, circle the letter of the one best choice unless the question explicitly states that it might have
More informationJavaScript. The Bad Parts. Patrick Behr
JavaScript The Bad Parts Patrick Behr History Created in 1995 by Netscape Originally called Mocha, then LiveScript, then JavaScript It s not related to Java ECMAScript is the official name Many implementations
More informationHierarchical inheritance: Contains one base class and multiple derived classes of the same base class.
1. What is C#? C# (pronounced "C sharp") is a simple, modern, object oriented, and type safe programming language. It will immediately be familiar to C and C++ programmers. C# combines the high productivity
More informationStandard. Number of Correlations
Computer Science 2016 This assessment contains 80 items, but only 80 are used at one time. Programming and Software Development Number of Correlations Standard Type Standard 2 Duty 1) CONTENT STANDARD
More informationThe course is supplemented by numerous hands-on labs that help attendees reinforce their theoretical knowledge of the learned material.
Lincoln Land Community College Capital City Training Center 130 West Mason Springfield, IL 62702 217-782-7436 www.llcc.edu/cctc WA2442 Introduction to JavaScript Objectives This intensive training course
More informationPOLYMORPHISM 2 PART. Shared Interface. Discussions. Abstract Base Classes. Abstract Base Classes and Pure Virtual Methods EXAMPLE
Abstract Base Classes POLYMORPHISM 2 PART Abstract Classes Static and Dynamic Casting Common Programming Errors class B { // base class virtual void m( ) =0; // pure virtual function class D1 : public
More informationPOLYMORPHISM 2 PART Abstract Classes Static and Dynamic Casting Common Programming Errors
POLYMORPHISM 2 PART Abstract Classes Static and Dynamic Casting Common Programming Errors CSC 330 OO Software Design 1 Abstract Base Classes class B { // base class virtual void m( ) =0; // pure virtual
More informationStatic Analysis for JavaScript
Static Analysis for JavaScript Adi Yoga Sidi Prabawa Supervisor: Associate Professor Chin Wei Ngan Department of Computer Science School of Computing National University of Singapore June 30, 2013 Abstract
More informationInheritance. Transitivity
Inheritance Classes can be organized in a hierarchical structure based on the concept of inheritance Inheritance The property that instances of a sub-class can access both data and behavior associated
More informationNested Classes in Java. Slides by: Alon Mishne Edited by: Eran Gilad, Eyal Moscovici April 2013
Nested Classes in Java Slides by: Alon Mishne Edited by: Eran Gilad, Eyal Moscovici April 2013 1 In This Tutorial Explanation of the nested class concept. Access modifiers and nested classes. The types
More informationCommon Misunderstandings from Exam 1 Material
Common Misunderstandings from Exam 1 Material Kyle Dewey Stack and Heap Allocation with Pointers char c = c ; char* p1 = malloc(sizeof(char)); char** p2 = &p1; Where is c allocated? Where is p1 itself
More informationJAVASCRIPT FOR THE C# DEVELOPER
JAVASCRIPT FOR THE C# DEVELOPER Philip Japikse (@skimedic) skimedic@outlook.com www.skimedic.com/blog Microsoft MVP, ASPInsider, MCSD, MCDBA, CSM, CSP Consultant, Teacher, Writer Phil.About() Consultant,
More informationFlow Control. CSC215 Lecture
Flow Control CSC215 Lecture Outline Blocks and compound statements Conditional statements if - statement if-else - statement switch - statement? : opertator Nested conditional statements Repetitive statements
More informationRuby: Introduction, Basics
Ruby: Introduction, Basics Computer Science and Engineering College of Engineering The Ohio State University Lecture 4 Ruby vs Java: Similarities Imperative and object-oriented Classes and instances (ie
More informationJavaScript: Objects, Methods, Prototypes
JavaScript: Objects, Methods, Prototypes Computer Science and Engineering College of Engineering The Ohio State University Lecture 22 What is an Object? Property: a key/value pair (aka "name"/value) Object:
More informationRuby: Introduction, Basics
Ruby: Introduction, Basics Computer Science and Engineering College of Engineering The Ohio State University Lecture 3 Ruby vs Java: Similarities Imperative and object-oriented Classes and instances (ie
More informationOOPS Viva Questions. Object is termed as an instance of a class, and it has its own state, behavior and identity.
OOPS Viva Questions 1. What is OOPS? OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class.
More informationAn Introduction to TypeScript. Personal Info
An Introduction to TypeScript Jason Bock Practice Lead Magenic Level: Beginner/Intermediate Personal Info http://www.magenic.com http://www.jasonbock.net https://www.twitter.com/jasonbock https://www.github.com/jasonbock
More informationINTRODUCTION TO JAVASCRIPT
INTRODUCTION TO JAVASCRIPT JAVASCRIPT OBJECT SYNTAX var empty_object = {} var student ={ "first name": "Daniel", "last name": "Graham", title: "PHD", } IT IS OK TO INCLUDE OR EXCLUDE TRAILING COMMAS JAVASCRIPT
More informationJava: introduction to object-oriented features
Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer Java: introduction to object-oriented features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer
More informationOops known as object-oriented programming language system is the main feature of C# which further support the major features of oops including:
Oops known as object-oriented programming language system is the main feature of C# which further support the major features of oops including: Abstraction Encapsulation Inheritance and Polymorphism Object-Oriented
More informationLanguage Features. 1. The primitive types int, double, and boolean are part of the AP
Language Features 1. The primitive types int, double, and boolean are part of the AP short, long, byte, char, and float are not in the subset. In particular, students need not be aware that strings are
More informationC++11: 10 Features You Should be Using. Gordon R&D Runtime Engineer Codeplay Software Ltd.
C++11: 10 Features You Should be Using Gordon Brown @AerialMantis R&D Runtime Engineer Codeplay Software Ltd. Agenda Default and Deleted Methods Static Assertions Delegated and Inherited Constructors Null
More informationComputer Science II (20082) Week 1: Review and Inheritance
Computer Science II 4003-232-08 (20082) Week 1: Review and Inheritance Richard Zanibbi Rochester Institute of Technology Review of CS-I Syntax and Semantics of Formal (e.g. Programming) Languages Syntax
More informationJavaScript CS 4640 Programming Languages for Web Applications
JavaScript CS 4640 Programming Languages for Web Applications 1 How HTML, CSS, and JS Fit Together {css} javascript() Content layer The HTML gives the page structure and adds semantics Presentation
More informationThis document defines the ActionScript 3.0 language, which is designed to be forward- compatible with the next edition of ECMAScript (ECMA-262).
ActionScript 3.0 Language Specification This document defines the ActionScript 3.0 language, which is designed to be forward- compatible with the next edition of ECMAScript (ECMA-262). This document is
More informationObjectives. Introduce static keyword examine syntax describe common uses
Static Objectives Introduce static keyword examine syntax describe common uses 2 Static Static represents something which is part of a type rather than part of an object Two uses of static field method
More informationAbout Codefrux While the current trends around the world are based on the internet, mobile and its applications, we try to make the most out of it. As for us, we are a well established IT professionals
More informationGoal. Generic Programming and Inner classes. Minor rewrite of linear search. Obvious linear search code. Intuitive idea of generic linear search
Goal Generic Programming and Inner classes First version of linear search Input was array of int More generic version of linear search Input was array of Comparable Can we write a still more generic version
More informationOrganizing Code in Web Apps. SWE 432, Fall 2016 Design and Implementation of Software for the Web
Organizing Code in Web Apps SWE 432, Fall 2016 Design and Implementation of Software for the Web Today Some basics on how and why to organize code (SWE!) Closures Classes Modules For further reading: http://stackoverflow.com/questions/111102/how-dojavascript-closures-work
More informationVariable Declarations
Variable Declarations Variables can be declared using var or the newer let. Note that declaration is simply var x = 1 or let x = 1; there is no type as js variables do not have types. Constant variables
More informationCOMP-520 GoLite Tutorial
COMP-520 GoLite Tutorial Alexander Krolik Sable Lab McGill University Winter 2019 Plan Target languages Language constructs, emphasis on special cases General execution semantics Declarations Types Statements
More informationLecture 5 Tao Wang 1
Lecture 5 Tao Wang 1 Objectives In this chapter, you will learn about: Selection criteria Relational operators Logical operators The if-else statement Nested if statements C++ for Engineers and Scientists,
More informationMore on JavaScript Functions
More on JavaScript Functions Nesting Function Definitions Function definitions can be nested. function hypotenuse(a, b) function square(x) return x * x; return Math.sqrt(square(a) + square(b));
More informationBackground. Javascript is not related to Java in anyway other than trying to get some free publicity
JavaScript I Introduction JavaScript traditionally runs in an interpreter that is part of a browsers Often called a JavaScript engine Was originally designed to add interactive elements to HTML pages First
More informationChapter 6 Introduction to Defining Classes
Introduction to Defining Classes Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives Design and implement a simple class from user requirements. Organize a program in terms of
More informationJavaScript. History. Adding JavaScript to a page. CS144: Web Applications
JavaScript Started as a simple script in a Web page that is interpreted and run by the browser Supported by most modern browsers Allows dynamic update of a web page More generally, allows running an arbitrary
More informationPackages Inner Classes
Packages Inner Classes Sisoft Technologies Pvt Ltd SRC E7, Shipra Riviera Bazar, Gyan Khand-3, Indirapuram, Ghaziabad Website: www.sisoft.in Email:info@sisoft.in Phone: +91-9999-283-283 Learning - Topics
More informationJavaScript. History. Adding JavaScript to a page. CS144: Web Applications
JavaScript Started as a simple script in a Web page that is interpreted and run by the browser Supported by most modern browsers Allows dynamic update of a web page More generally, allows running an arbitrary
More information1 Shyam sir JAVA Notes
1 Shyam sir JAVA Notes 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write
More informationStackVsHeap SPL/2010 SPL/20
StackVsHeap Objectives Memory management central shared resource in multiprocessing RTE memory models that are used in Java and C++ services for Java/C++ programmer from RTE (JVM / OS). Perspectives of
More informationJava Fundamentals (II)
Chair of Software Engineering Languages in Depth Series: Java Programming Prof. Dr. Bertrand Meyer Java Fundamentals (II) Marco Piccioni static imports Introduced in 5.0 Imported static members of a class
More information204111: Computer and Programming
204111: Computer and Programming Week 4: Control Structures t Monchai Sopitkamon, Ph.D. Overview Types of control structures Using selection structure Using repetition structure Types of control ol structures
More informationComputer Science II. OO Programming Classes Scott C Johnson Rochester Institute of Technology
Computer Science II OO Programming Classes Scott C Johnson Rochester Institute of Technology Outline Object-Oriented (OO) Programming Review Initial Implementation Constructors Other Standard Behaviors
More informationDATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6)
Technology & Information Management Instructor: Michael Kremer, Ph.D. Database Program: Microsoft Access Series DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6) AGENDA 3. Executing VBA
More informationExceptions, Case Study-Exception handling in C++.
PART III: Structuring of Computations- Structuring the computation, Expressions and statements, Conditional execution and iteration, Routines, Style issues: side effects and aliasing, Exceptions, Case
More informationFORM 2 (Please put your name and form # on the scantron!!!!)
CS 161 Exam 2: FORM 2 (Please put your name and form # on the scantron!!!!) True (A)/False(B) (2 pts each): 1. Recursive algorithms tend to be less efficient than iterative algorithms. 2. A recursive function
More informationJavaScript I Language Basics
JavaScript I Language Basics Chesapeake Node.js User Group (CNUG) https://www.meetup.com/chesapeake-region-nodejs-developers-group START BUILDING: CALLFORCODE.ORG Agenda Introduction to JavaScript Language
More informationEMBEDDED SYSTEMS PROGRAMMING More About Languages
EMBEDDED SYSTEMS PROGRAMMING 2015-16 More About Languages JAVA: ANNOTATIONS (1/2) Structured comments to source code (=metadata). They provide data about the code, but they are not part of the code itself
More informationNotes on JavaScript (aka ECMAScript) and the DOM
Notes on JavaScript (aka ECMAScript) and the DOM JavaScript highlights: Syntax and control structures superficially resemble Java/C/C++ Dynamically typed Has primitive types and strings (which behave more
More informationAn Activation Record for Simple Subprograms. Activation Record for a Language with Stack-Dynamic Local Variables
Activation Records The storage (for formals, local variables, function results etc.) needed for execution of a subprogram is organized as an activation record. An Activation Record for Simple Subprograms.
More informationChapter 2: Functions and Control Structures
Chapter 2: Functions and Control Structures TRUE/FALSE 1. A function definition contains the lines of code that make up a function. T PTS: 1 REF: 75 2. Functions are placed within parentheses that follow
More information9 Working with the Java Class Library
9 Working with the Java Class Library 1 Objectives At the end of the lesson, the student should be able to: Explain object-oriented programming and some of its concepts Differentiate between classes and
More informationJavaScript Patterns O'REILLY* S toy an Stefanov. Sebastopol. Cambridge. Tokyo. Beijing. Farnham K8ln
JavaScript Patterns S toy an Stefanov O'REILLY* Beijing Cambridge Farnham K8ln Sebastopol Tokyo Table of Contents Preface xiii 1. Introduction 1 Patterns 1 JavaScript: Concepts 3 Object-Oriented 3 No Classes
More informationClasses. Logical method to organise data and functions in a same structure. Also known as abstract data type (ADT).
UNITII Classes Logical method to organise data and functions in a same structure. Also known as abstract data type (ADT). It s a User Defined Data-type. The Data declared in a Class are called Data- Members
More informationDecaf Language Reference Manual
Decaf Language Reference Manual C. R. Ramakrishnan Department of Computer Science SUNY at Stony Brook Stony Brook, NY 11794-4400 cram@cs.stonybrook.edu February 12, 2012 Decaf is a small object oriented
More informationClass, Variable, Constructor, Object, Method Questions
Class, Variable, Constructor, Object, Method Questions http://www.wideskills.com/java-interview-questions/java-classes-andobjects-interview-questions https://www.careerride.com/java-objects-classes-methods.aspx
More informationQUIZ. What is wrong with this code that uses default arguments?
QUIZ What is wrong with this code that uses default arguments? Solution The value of the default argument should be placed in either declaration or definition, not both! QUIZ What is wrong with this code
More informationUMBC CMSC 331 Final Exam
UMBC CMSC 331 Final Exam Name: UMBC Username: You have two hours to complete this closed book exam. We reserve the right to assign partial credit, and to deduct points for answers that are needlessly wordy
More informationJava Bytecode (binary file)
Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.
More informationCGS 3066: Spring 2015 JavaScript Reference
CGS 3066: Spring 2015 JavaScript Reference Can also be used as a study guide. Only covers topics discussed in class. 1 Introduction JavaScript is a scripting language produced by Netscape for use within
More informationThe results for a few specific cases below are indicated. allequal ([1,1,1,1]) should return true allequal ([1,1,2,1]) should return false
Test 1 Multiple Choice. Write your answer to the LEFT of each problem. 4 points each 1. Which celebrity has not received an ACM Turing Award? A. Alan Kay B. John McCarthy C. Dennis Ritchie D. Bjarne Stroustrup
More informationCMSC 132: Object-Oriented Programming II
CMSC 132: Object-Oriented Programming II Java Support for OOP Department of Computer Science University of Maryland, College Park Object Oriented Programming (OOP) OO Principles Abstraction Encapsulation
More informationC# Programming in the.net Framework
50150B - Version: 2.1 04 May 2018 C# Programming in the.net Framework C# Programming in the.net Framework 50150B - Version: 2.1 6 days Course Description: This six-day instructor-led course provides students
More informationObjectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments
Basics Objectives Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments 2 Class Keyword class used to define new type specify
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Type Systems, Names and Binding CMSC 330 - Spring 2013 1 Topics Covered Thus Far! Programming languages Ruby OCaml! Syntax specification Regular expressions
More information