CHAPTER 6 ACTIONS, METHODS, REFACTORING

Size: px
Start display at page:

Download "CHAPTER 6 ACTIONS, METHODS, REFACTORING"

Transcription

1 VERSION 1 CHAPTER 6 In this chapter we cover ACTIONS in more depth and show how to easily create additional actions in a script by using a technique known as REFACTORING. The chapter covers two forms of refactoring supported in TouchDevelop. One form provides an easy way to create new actions, while the other form provides an easy way to add declarations for new variables to a script. We also show an extension to the second form of refactoring which promotes a local variable to become a new global data item. 6.1 ACTIONS 6.2 PARAMETER PASSING MECHANISMS 6.3 METHODS IN THE API 6.4 REFACTORING 6.1 ACTIONS An ACTION in TouchDevelop is very similar to a function in C or Python, or to a static method in Java or C#. It is an independent sequence of statements which has a name, it optionally has input parameters, and it optionally has result parameters. Let us take a look at the short example in Figure 6.1. This is similar to how the code would appear on the phone s screen. Figure 6.1: The send invite Action action send invite( recips, msg ) returns n n := 0 for each s in recips where true do social send (s, party invitation, msg) n := n + 1 This send invite action has some properties which can be viewed by tapping the first line of the action, tapping the edit button, and swiping left-to-right. The PARAMS property will show the names 61

2 VERSION 1 and the datatypes of all the input parameters. For the send invite action, the listing of the parameters is as shown in Figure 6.2. Figure 6.2: The send invite PARAMS Property Similarly, the RETURNS property provides more information about the result returned by the action. It is shown in Figure 6.3. Figure 6.3: The send invite RETURNS Property The input parameters work in a similar manner to parameters of methods in Java or C#. In other words, the parameters are considered to be local variables of the action and, each time the action is invoked, the parameters are initialized by copying values supplied by the caller. Suppose, for example, that one of the other actions in our script is bulk mailer as shown in Figure 6.4. This action creates a String Collection value as the value of variable addr list and initializes the variable msg to hold a String value. When send invite is invoked, its first parameter recips is initialized so that it refers to the same String Collection as addr list. Similarly, the second parameter msg is initialized to hold the same string as the caller s local variable named msg. Now that the parameters of send invite have been initialized, the body of the send invite action is executed. We will not go into any detail about what this action does (suffice to say it will likely annoy everyone whose name begins with j in the contacts collection held on your phone if you actually run it). However, while the action is running, it is computing a value held in the variable n. This variable is declared as an output parameter, but while the action is executing, it should be considered to be just like any local variable. When the action s body has finished executing, the value of this local variable is returned as the result. Its value will be assigned to variable cnt in the caller. 62

3 VERSION 1 Figure 6.4: A Caller of the send invite Action action bulk mailer( ) var my j friends := social search contacts("j") var addr list := collections create string collection for each c in my j friends where true do var addr := c address addr list add(addr) // a more realistic example would assign several lines // of text to the msg variable var msg := "Will you come to my party on Friday? " var cnt := send invite(addr list, msg) (cnt " friends have been invited") post to wall Unlike many programming languages, there is no return statement in TouchDevelop. Execution must reach the end of the action before control returns to the caller and any results are returned. Now for some details which serious script developers need to know. 6.2 PARAMETER PASSING MECHANISMS This is a topic which has been partially covered in Chapter 3 already. To recap, there are two kinds of datatypes in the TouchDevelop scripting language. There are VALUE TYPES, where the variable holds the value directly. For example, a variable of type Number corresponds to a word in the memory of the phone which holds the number directly (as a bit pattern). And there are REFERENCE TYPES. Every collection type in TouchDevelop is an example of a reference type. Suppose, for example, a variable has the Link Collection type. The link collection value is a data structure located somewhere in memory and the starting point for that data structure has a memory address (or a location number). A variable in the script which has the type Link Collection would correspond to a word in memory which holds the memory address of the data structure. When a variable which has a reference type is assigned to another variable or is passed as a parameter to an action, we have two references to the same data structure in memory. This situation is diagrammed in Figure 6.5 where the variable num1 has the Number type, while both links1 and links2 are variables with the Link Collection type. After creating a link collection as a list of three addresses and assigning it to links1, another assignment var links2 := links1 has been executed. Now any changes to the links1 link collection will change the links2 collection and vice versa, because they are both references to the same collection. 63

4 VERSION 1 Figure 6.5: Value Types and Reference Types Exactly the same behavior is observed for passing parameters to actions. If the parameter has one of the value types then the action has a completely independent copy. If the parameter has one of the reference types, then the caller and the action share references to the same value held in the phone s memory. Which are the value types exactly? They are Number, Boolean, DateTime and Vector3. Every other type is a reference type. RETURNING RESULTS The TouchDevelop editor allows an action to have any number of return parameters. What does this mean? It simply means that the action can return several results at once and they can have different types. As a highly contrived example, consider the action shown in Figure 6.6. Figure 6.6: An Action with Two Results action random stuff( ) returns song, pic var all songs := media songs var all pics := media pictures song := all songs random pic := all pics random 64

5 VERSION 1 All that matters for our example is that it has two result parameters, one of type Song and the other of type Picture. When it is invoked, the caller can assign the result to two variables simultaneously. Here is an example of how to write the calling code: var s, p := random stuff( ) s play p post to wall It declares s and p as local variables with type Song and Picture respectively, and then those variables are assigned the result of invoking the random stuff action. Not many programming languages support functions or methods which return multiple results. (Programmers in such languages must use various workarounds or less readable programming constructs.) This feature of TouchDevelop can be used to make scripts shorter and more readable. TouchDevelop treats a result parameter as a local variable with an invalid initial value. The action must assign a value to the result parameter before the action returns to the caller. To enforce that requirement, TouchDevelop analyzes the code of the action and checks that at least one assignment happens on every possible execution path through the action. 6.3 METHODS IN THE API The API provides various globals which have methods that can be invoked by a TouchDevelop script. For example, one such global is languages and one of its methods is detect language. (A Java or C# programmer might think of languages as being a class type and detect language as being a static method of the class.) The API also provides a number of datatypes, and values possessing those datatypes have associated methods. For example, chapter 2 used the Picture datatype in an example and it created a local variable named pic with that type. One of the examples used the set pixel method on that pic variable. (A Java or C# programmer might consider pic to be a reference to a class instance and set pixel to be an instance method.) When we write code to invoke these methods, parameter values may be passed into the methods and results may be returned from them. Although the API s methods are all implemented in the C# language (as is the whole TouchDevelop application), the methods all behave similarly to Touch- Develop actions. Value types are passed in to the methods using the call-by-value mechanism and reference type values are passed in using call-by-reference. Although methods provided by the API have the potential to return multiple results, none does. Every method provided in the API so far either returns a single value or it returns Nothing. 65

6 VERSION REFACTORING The word REFACTORING is used in software engineering to mean a reorganization of a program which does not change its behavior. Such a reorganization is normally performed to improve the quality of the software in some way, such as to make the code more efficient or to be more readable by humans. Most modern environments for software development, such as Visual Studio and Eclipse, provide a variety of tools to support different forms of refactoring. The TouchDevelop editor provides two forms of refactoring. One form extracts a group of statements from an action and creates a new action, with appropriate parameters, from those statements. We might want to perform such refactoring if we have an action which has become too long to comfortably display on the screen and we simply want to split the action up into smaller pieces. Or, perhaps we have recognized that there is a particular group of statements which we will need to execute several times with different parameterization. These are both excellent reasons to extract and create a new action. Finally, a TouchDevelop user is likely to find this form of refactoring to be a time saver because fewer taps and few swipes are needed to create a script composed of multiple actions. The second form of refactoring is to extract an expression or a subexpression, replace it with a newly created variable, and insert an initialization of that new variable with the extracted expression. A further step beyond extracting an expression and creating a new local variable is to convert that local variable into a new globally visible data item. This would make the value of the variable accessible to all the actions in the script (as well as preserving the value of the data item from one invocation of the script to the next invocation a feature known as persistence.) REFACTORING: EXTRACTION OF STATEMENTS TO A NEW ACTION Let s go through an example of refactoring in TouchDevelop. Chapter 2 contained an example, the Random circles script, which was constructed and entered as two separate actions. Suppose that we had entered the script as just one action. It would look like the script shown in Figure 6.7. There is nothing wrong with this version of the script, it is not too long and it runs perfectly well. However, we might decide that the group of statements which draws the circle is so useful that we want to extract that code and make a new action from it. 66

7 VERSION 1 Figure 6.7: A Monolithic Random circles Script action Random circles( ) pic := media create picture(400, 400) for 0 i < 20 do var radius := 5 + math random(95) var x := math random(400) // x coordinate of center var y := math random(400) // y coordinate of center var color := colors random for 0 i1 < 2 * math * radius do var xofs := x + radius * math cos(i1 / radius) var yofs := y + radius * math sin(i1 / radius) pic set pixel(x + xofs, y + yofs, color) pic post to wall Here are the steps we might perform extract the circle drawing code (which corresponds to the inner for loop). 1. Touch anywhere in the first line of the group of statements we wish to extract. For our example, that is the inner for loop (the one which uses i1 as the index variable). The screen should now look like this: 67

8 VERSION 1 2. Now touch the button labeled select more and the screen changes to look like this: 3. It so happens that everything we want has been selected because it is a single statement (the entire for loop) identified by the red bar on the left and show between the upper and lower rows of buttons. If we wanted to selected additional statements, we could drag the group of statements upward to increase the range of statements to be extracted. In our example, we do not need to do that, so we can proceed to tap the extract button. At this point, we are asked to provide a name for the extracted code (the new action). We enter the desired name, draw circle, and tap another extract button. 4. The screen should change to show the revised Random circles action after the refactoring has been performed. Here is a screenshot: 68

9 VERSION 1 5. The editor has created an invocation of the new action, with the name we gave it and with whatever parameters were needed to transmit values of variables from the caller (the Random circles action) to the callee (the new draw circle action). At this point, the refactoring has been completed. The modified script should work just as before. Finally, here is a quick way to see the code of the new action (or of any action being invoked in a script). We touch the line of code containing the call to the action. This brings up the edit statement menu, which looks like the following for our example: The go to button will take us to the code for the action invoked in the selected statement. After touching it, the screen will show our refactored action: The code is remarkably similar to the code originally shown in Chapter 2. The only differences are the order in which the parameters appear and the name used for the index variable of the for loop. These would usually be considered to be trivial and unimportant differences. REFACTORING: EXTRACTION OF AN EXPRESSION TO A VARIABLE If you discover that you have constructed an expression whose value you would like to reuse, or if you have a complicated expression which you would like to break up into smaller pieces, this form of refactoring is just what you need. Let s take a small example. Suppose that you have just entered the following script which calculates the length of the diagonal side of a right-angled triangle whose sides are x1 and y2: 69

10 VERSION 1 Perhaps we are now going to extend this script to perform more calculations and we will need to reuse the values of x1*x1 and x2*x2 in some statements we will add to the bottom. Here are the steps to follow. 1. Tap the line containing the expression you wish to extract. In our sample script, that is the line beginning var x := 2. Tap the first element of the expression, which is the first x1 appearing in that line. 3. Swipe from left to right, to highlight all the elements of the selected expression. For our example, the screen should now look like this, with a menu of available editing actions at the bottom: 4. Tap the extract to local button. The statement shown on the screen changes to the following, indicating that a new local variable named x3 has been created. 5. Let s repeat steps 2 to 4 in the same way to extract the expression x2*x2 into a new local variable named x4. 6. We can tap the phone back button to see how the code for our script has been transformed. 70

11 VERSION 1 7. If we do not like the default names provided for the new local variables, they are easy to rename. One just has to tap any line where the name appears, choose the option to edit the line, select an occurrence of the variable, and there will be a rename button provided on the screen. REFACTORING: PROMOTING A LOCAL VARIABLE TO A GLOBAL DATA ITEM Perhaps we are going to expand the example script by adding many new actions to it and lots of these actions will need access to the values of the new variables x3 and x4. One possibility is to pass x3 and x4 as parameters to the various actions. Another possibility is to convert x3 and x4 into global data items. TouchDevelop provides an easy way to make that transformation. The steps for converting the local variable x3 in the preceding example into a new data item are as follows. 1. Tap the line which declares and initializes the local variable. 2. Tap the edit button. 3. Tap the variable on the left-hand side. An edit menu like that shown below appears. 4. Tap the promote to button. The code displayed on the screen changes to that shown below, indicating that x3 is now being accessed as a global data item. A return to the main screen for the script would show that the script now includes x3 as a data item. 71

12 VERSION 1 72

CHAPTER 2 EDITING IN TOUCHDEVELOP

CHAPTER 2 EDITING IN TOUCHDEVELOP VERSION 1 CHAPTER 2 In this chapter we describe how to set up TouchDevelop on your phone, how to enter scripts from scratch, and how to extend existing scripts. At the end of the chapter, you should be

More information

Chapter 2 Editing in TouchDevelop

Chapter 2 Editing in TouchDevelop Chapter 2 In this chapter we describe how to set up TouchDevelop on your phone, how to enter scripts from scratch, and how to extend existing scripts. At the end of the chapter, you should be familiar

More information

introduction to records in touchdevelop

introduction to records in touchdevelop introduction to records in touchdevelop To help you keep your data organized, we are introducing records in release 2.8. A record stores a collection of named values called fields, e.g., a Person record

More information

Chapter 2 The Scripting Language

Chapter 2 The Scripting Language Chapter 2 The Scripting Language A TouchDevelop script appears to the user as statements in a language which is not unlike many other programming languages. This chapter covers the syntax and semantics

More information

touchdevelop R Nigel Horspool University of Victoria Judith Bishop Arjmand Samuel Nikolai Tillmann Michał Moskal Jonathan de Halleux Manuel Fähndrich

touchdevelop R Nigel Horspool University of Victoria Judith Bishop Arjmand Samuel Nikolai Tillmann Michał Moskal Jonathan de Halleux Manuel Fähndrich touchdevelop programming on a phone R Nigel Horspool University of Victoria Judith Bishop Arjmand Samuel Nikolai Tillmann Michał Moskal Jonathan de Halleux Manuel Fähndrich Microsoft Research Version 1.1

More information

touchdevelop R Nigel Horspool University of Victoria Judith Bishop Arjmand Samuel Nikolai Tillmann Michał Moskal Jonathan de Halleux Manuel Fähndrich

touchdevelop R Nigel Horspool University of Victoria Judith Bishop Arjmand Samuel Nikolai Tillmann Michał Moskal Jonathan de Halleux Manuel Fähndrich touchdevelop programming on a phone R Nigel Horspool University of Victoria Judith Bishop Arjmand Samuel Nikolai Tillmann Michał Moskal Jonathan de Halleux Manuel Fähndrich Microsoft Research Version 1

More information

Chapter 2 The Scripting Language

Chapter 2 The Scripting Language Chapter 2 The Scripting Language A TouchDevelop script appears to the user as statements in a language which is not unlike many other programming languages. This chapter covers the syntax and semantics

More information

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch Purpose: We will take a look at programming this week using a language called Scratch. Scratch is a programming language that was developed

More information

Implementing Continuations

Implementing Continuations Implementing Continuations sk and dbtucker 2002-10-18 1 Changing Representations Now that we ve seen how continuations work, let s study how to implement them in an interpreter. For this lecture onward,

More information

Professor Hugh C. Lauer CS-1004 Introduction to Programming for Non-Majors

Professor Hugh C. Lauer CS-1004 Introduction to Programming for Non-Majors First Python Program Professor Hugh C. Lauer CS-1004 Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An Introduction to Computer Science, 2 nd edition, by

More information

(Refer Slide Time: 01.26)

(Refer Slide Time: 01.26) Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture # 22 Why Sorting? Today we are going to be looking at sorting.

More information

Math Dr. Miller - Constructing in Sketchpad (tm) - Due via by Friday, Mar. 18, 2016

Math Dr. Miller - Constructing in Sketchpad (tm) - Due via  by Friday, Mar. 18, 2016 Math 304 - Dr. Miller - Constructing in Sketchpad (tm) - Due via email by Friday, Mar. 18, 2016 As with our second GSP activity for this course, you will email the assignment at the end of this tutorial

More information

(Refer Slide Time: 06:01)

(Refer Slide Time: 06:01) Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture 28 Applications of DFS Today we are going to be talking about

More information

T H E I N T E R A C T I V E S H E L L

T H E I N T E R A C T I V E S H E L L 3 T H E I N T E R A C T I V E S H E L L The Analytical Engine has no pretensions whatever to originate anything. It can do whatever we know how to order it to perform. Ada Lovelace, October 1842 Before

More information

Notes from the Boards Set # 5 Page

Notes from the Boards Set # 5 Page 1 Yes, this stuff is on the exam. Know it well. Read this before class and bring your questions to class. Starting today, we can no longer write our code as a list of function calls and variable declarations

More information

About Netscape Composer

About Netscape Composer An About Netscape Composer The pictures and directions in this handout are for Netscape Composer that comes with the Netscape Communicator 4.7 package available for free from Netscape s web site at http://www.netscape.com.

More information

Animations involving numbers

Animations involving numbers 136 Chapter 8 Animations involving numbers 8.1 Model and view The examples of Chapter 6 all compute the next picture in the animation from the previous picture. This turns out to be a rather restrictive

More information

The left menu is very flexible, allowing you to get to administrations screens with fewer clicks and faster load times.

The left menu is very flexible, allowing you to get to administrations screens with fewer clicks and faster load times. 12 Menu, Modules and Setting of Wordpress.com Collapse, Hide, Icons, Menu, Menus The left menu is very flexible, allowing you to get to administrations screens with fewer clicks and faster load times.

More information

This tutorial will teach you about operators. Operators are symbols that are used to represent an actions used in programming.

This tutorial will teach you about operators. Operators are symbols that are used to represent an actions used in programming. OPERATORS This tutorial will teach you about operators. s are symbols that are used to represent an actions used in programming. Here is the link to the tutorial on TouchDevelop: http://tdev.ly/qwausldq

More information

Refactoring with Eclipse

Refactoring with Eclipse Refactoring with Eclipse Seng 371 Lab 8 By Bassam Sayed Based on IBM article Explore refactoring functions in Eclipse JDT by Prashant Deva Code Refactoring Code refactoring is a disciplined way to restructure

More information

SILVACO. An Intuitive Front-End to Effective and Efficient Schematic Capture Design INSIDE. Introduction. Concepts of Scholar Schematic Capture

SILVACO. An Intuitive Front-End to Effective and Efficient Schematic Capture Design INSIDE. Introduction. Concepts of Scholar Schematic Capture TCAD Driven CAD A Journal for CAD/CAE Engineers Introduction In our previous publication ("Scholar: An Enhanced Multi-Platform Schematic Capture", Simulation Standard, Vol.10, Number 9, September 1999)

More information

Exploring SharePoint Designer

Exploring SharePoint Designer Exploring SharePoint Designer Microsoft Windows SharePoint Services 3.0 and Microsoft Office SharePoint Server 2007 are large and sophisticated web applications. It should come as no surprise, therefore,

More information

Lecture 4. Part 1. More on "First-Class" Procedures

Lecture 4. Part 1. More on First-Class Procedures Lecture 4. Part 1. More on "First-Class" Procedures 4.1 The Lambda Special Form An unnamed "doubling" procedure: (lambda (n) (* 2 n)) Think of this as saying "The procedure that takes an argument n, and,

More information

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture 10 Reference and Pointer Welcome to module 7 of programming in

More information

What is OneNote? The first time you start OneNote, it asks you to sign in. Sign in with your personal Microsoft account.

What is OneNote? The first time you start OneNote, it asks you to sign in. Sign in with your personal Microsoft account. OneNote What is OneNote? OneNote is a digital notebook. In OneNote, you can: Type notes or record audio at your laptop. Sketch or write ideas on your tablet. Add picture from your phone. Find notes instantly.

More information

Table of Contents. Revu ipad. v3.6. Navigation. Document Manager. File Access. Markups. Signature Tool. Field Verification Measurements

Table of Contents. Revu ipad. v3.6. Navigation. Document Manager. File Access. Markups. Signature Tool. Field Verification Measurements Table of Contents Navigation Document Manager File Access Markups Signature Tool Field Verification Measurements Editing Properties Tool Sets & the Tool Chest Markups List Forms Studio Sessions Studio

More information

COMPUTER DESCRIPTION...

COMPUTER DESCRIPTION... Conventions used in this document: Keyboard keys that must be pressed will be shown as Enter or Ctrl. Controls to be activated with the mouse will be shown as Start button > Settings > System > About.

More information

CS 6353 Compiler Construction Project Assignments

CS 6353 Compiler Construction Project Assignments CS 6353 Compiler Construction Project Assignments In this project, you need to implement a compiler for a language defined in this handout. The programming language you need to use is C or C++ (and the

More information

Remodeling Your Office A New Look for the SAS Add-In for Microsoft Office

Remodeling Your Office A New Look for the SAS Add-In for Microsoft Office Paper SAS1864-2018 Remodeling Your Office A New Look for the SAS Add-In for Microsoft Office ABSTRACT Tim Beese, SAS Institute Inc., Cary, NC Millions of people spend their weekdays in an office. Occasionally

More information

Exercise 1. Exercise 2. MAT 012 SS218 Worksheet 9 Sections Name: Consider the triangle drawn below. C. c a. A b

Exercise 1. Exercise 2. MAT 012 SS218 Worksheet 9 Sections Name: Consider the triangle drawn below. C. c a. A b Consider the triangle drawn below. C Exercise 1 c a A b B 1. Suppose a = 5 and b = 12. Find c, and then find sin( A), cos( A), tan( A), sec( A), csc( A), and cot( A). 2. Now suppose a = 10 and b = 24.

More information

Creating and Using File Folders

Creating and Using File Folders Creating and Using File Folders ~ 1 ~ Creating and Using File Folders Introduction: File Folders are named storage areas which we create in our computers to keep any documents, pictures, music, videos

More information

Math 1505G, 2013 Graphs and Matrices

Math 1505G, 2013 Graphs and Matrices Math 505G, 0 Graphs and Matrices September 7, 0 These are some notes for the short talk I gave the other day. We ll discuss an interesting application of matrix algebra. This is outside what will be tested

More information

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 43 Dynamic Binding (Polymorphism): Part III Welcome to Module

More information

A demo Wakanda solution (containing a project) is provided with each chapter. To run a demo:

A demo Wakanda solution (containing a project) is provided with each chapter. To run a demo: How Do I About these examples In the Quick Start, you discovered the basic principles of Wakanda programming: you built a typical employees/companies application by creating the datastore model with its

More information

CAPTCHAs and Information Hiding

CAPTCHAs and Information Hiding CAPTCHAs and Information Hiding Neal R. Wagner The University of Texas at San Antonio Department of Computer Science San Antonio, Texas 78249 USA wagner@cs.utsa.edu Abstract. The goal of steganography

More information

CHAPTER 1 WHAT IS TOUCHDEVELOP?

CHAPTER 1 WHAT IS TOUCHDEVELOP? CHAPTER 1 In this chapter we present an overview of how TouchDevelop works within your phone and the larger ecosystem the cloud, the communities you are involved in, and the websites you normally access.

More information

Chapter 5 Methods. public class FirstMethod { public static void main(string[] args) { double x= -2.0, y; for (int i = 1; i <= 5; i++ ) { y = f( x );

Chapter 5 Methods. public class FirstMethod { public static void main(string[] args) { double x= -2.0, y; for (int i = 1; i <= 5; i++ ) { y = f( x ); Chapter 5 Methods Sections Pages Review Questions Programming Exercises 5.1 5.11 142 166 1 18 2 22 (evens), 30 Method Example 1. This is of a main() method using a another method, f. public class FirstMethod

More information

SSJS Server-Side JavaScript WAF Wakanda Ajax Framework

SSJS Server-Side JavaScript WAF Wakanda Ajax Framework 1 28/06/2012 13:45 What You Will Find in those Examples In the Quick Start, you discovered the basic principles of Wakanda programming: you built a typical employees/companies application by creating the

More information

Go paperless by using OneNote 2013

Go paperless by using OneNote 2013 Work Smart by Microsoft IT Go paperless by using OneNote 2013 Customization note: This document contains guidance and/or step-by-step installation instructions that can be reused, customized, or deleted

More information

A2EZ A2Med A2Hard. Sequence 3 Sequence 2 Sequence 1. Sequence n. Sequence 3 Sequence 2 Sequence 1. EZ2 EZ3 EZ9 Etc.. Med1 Med7 Med12 Etc..

A2EZ A2Med A2Hard. Sequence 3 Sequence 2 Sequence 1. Sequence n. Sequence 3 Sequence 2 Sequence 1. EZ2 EZ3 EZ9 Etc.. Med1 Med7 Med12 Etc.. The Ceder Square Dance System (CSDS), authored by Vic Ceder, is rich in function and, although I have used it extensively for several years now, I make no claims to exhaustive expertise. What I will discuss

More information

Changes to questionnaire designer and programming language. New guides on the use of functions in Survey Solutions

Changes to questionnaire designer and programming language. New guides on the use of functions in Survey Solutions Dear friends of Survey Solutions, In version 5.0.0 that we have released on September 1, 2015 you will find a radically improved interface and lot of helpful new features to automate common tasks when

More information

Project and Production Management Prof. Arun Kanda Department of Mechanical Engineering Indian Institute of Technology, Delhi

Project and Production Management Prof. Arun Kanda Department of Mechanical Engineering Indian Institute of Technology, Delhi Project and Production Management Prof. Arun Kanda Department of Mechanical Engineering Indian Institute of Technology, Delhi Lecture - 8 Consistency and Redundancy in Project networks In today s lecture

More information

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to access them. Contents at a Glance About the Author...

More information

Desktop Studio: Charts. Version: 7.3

Desktop Studio: Charts. Version: 7.3 Desktop Studio: Charts Version: 7.3 Copyright 2015 Intellicus Technologies This document and its content is copyrighted material of Intellicus Technologies. The content may not be copied or derived from,

More information

Module 10A Lecture - 20 What is a function? Why use functions Example: power (base, n)

Module 10A Lecture - 20 What is a function? Why use functions Example: power (base, n) Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Module 10A Lecture - 20 What is a function?

More information

Session A First Game Program

Session A First Game Program 1 Session 11.1 A First Game Program Chapter 11.1: A First Game Program 2 Session Overview Begin the creation of an arcade game Learn software design techniques that apply to any form of game development

More information

touchdevelop tutorial

touchdevelop tutorial touchdevelop tutorial This document was written for touchdevelop v2.8 - more information at. This document is a step-by-step walkthrough of the in-app touchdevelop tutorial. This tutorial assumes little

More information

Automated Testing Frameworks: Test Automation with CodedUI

Automated Testing Frameworks: Test Automation with CodedUI Automated Testing Frameworks: Test Automation with CodedUI CodedUI Introduction CodeUI is one of the important new features in Visual Studio 2010 s Premium and Ultimate versions. It helps users to create

More information

Language Basics. /* The NUMBER GAME - User tries to guess a number between 1 and 10 */ /* Generate a random number between 1 and 10 */

Language Basics. /* The NUMBER GAME - User tries to guess a number between 1 and 10 */ /* Generate a random number between 1 and 10 */ Overview Language Basics This chapter describes the basic elements of Rexx. It discusses the simple components that make up the language. These include script structure, elements of the language, operators,

More information

Static Methods. Why use methods?

Static Methods. Why use methods? Static Methods A method is just a collection of code. They are also called functions or procedures. It provides a way to break a larger program up into smaller, reusable chunks. This also has the benefit

More information

Day 5: Inscribing and Circumscribing Getting Closer to π: Inscribing and Circumscribing Polygons - Archimedes Method. Goals:

Day 5: Inscribing and Circumscribing Getting Closer to π: Inscribing and Circumscribing Polygons - Archimedes Method. Goals: Day 5: Inscribing and Circumscribing Getting Closer to π: Inscribing and Circumscribing Polygons - Archimedes Method Goals: Construct an inscribed hexagon and dodecagon. Construct a circumscribed hexagon

More information

Part 1 Arithmetic Operator Precedence

Part 1 Arithmetic Operator Precedence California State University, Sacramento College of Engineering and Computer Science Computer Science 10: Introduction to Programming Logic Activity C Expressions Computers were originally designed for

More information

6.001 Notes: Section 8.1

6.001 Notes: Section 8.1 6.001 Notes: Section 8.1 Slide 8.1.1 In this lecture we are going to introduce a new data type, specifically to deal with symbols. This may sound a bit odd, but if you step back, you may realize that everything

More information

Definition: A data structure is a way of organizing data in a computer so that it can be used efficiently.

Definition: A data structure is a way of organizing data in a computer so that it can be used efficiently. The Science of Computing I Lesson 4: Introduction to Data Structures Living with Cyber Pillar: Data Structures The need for data structures The algorithms we design to solve problems rarely do so without

More information

CS125 : Introduction to Computer Science. Lecture Notes #11 Procedural Composition and Abstraction. c 2005, 2004 Jason Zych

CS125 : Introduction to Computer Science. Lecture Notes #11 Procedural Composition and Abstraction. c 2005, 2004 Jason Zych CS125 : Introduction to Computer Science Lecture Notes #11 Procedural Composition and Abstraction c 2005, 2004 Jason Zych 1 Lecture 11 : Procedural Composition and Abstraction Solving a problem...with

More information

Desktop Studio: Charts

Desktop Studio: Charts Desktop Studio: Charts Intellicus Enterprise Reporting and BI Platform Intellicus Technologies info@intellicus.com www.intellicus.com Working with Charts i Copyright 2011 Intellicus Technologies This document

More information

Game Board: Enabling Simple Games in TouchDevelop

Game Board: Enabling Simple Games in TouchDevelop Game Board: Enabling Simple Games in TouchDevelop Manuel Fähndrich Microsoft Research One Microsoft Way, Redmond WA 98052, USA maf@microsoft.com February 23, 2012 Abstract TouchDevelop is a novel application

More information

Laboratory 1: Eclipse and Karel the Robot

Laboratory 1: Eclipse and Karel the Robot Math 121: Introduction to Computing Handout #2 Laboratory 1: Eclipse and Karel the Robot Your first laboratory task is to use the Eclipse IDE framework ( integrated development environment, and the d also

More information

CS112 Lecture: Defining Classes. 1. To describe the process of defining an instantiable class

CS112 Lecture: Defining Classes. 1. To describe the process of defining an instantiable class CS112 Lecture: Defining Classes Last revised 2/3/06 Objectives: 1. To describe the process of defining an instantiable class Materials: 1. BlueJ SavingsAccount example project 2. Handout of code for SavingsAccount

More information

printf( Please enter another number: ); scanf( %d, &num2);

printf( Please enter another number: ); scanf( %d, &num2); CIT 593 Intro to Computer Systems Lecture #13 (11/1/12) Now that we've looked at how an assembly language program runs on a computer, we're ready to move up a level and start working with more powerful

More information

Tips & Tricks for Microsoft Word

Tips & Tricks for Microsoft Word T 330 / 1 Discover Useful Hidden Features to Speed-up Your Work in Word For what should be a straightforward wordprocessing program, Microsoft Word has a staggering number of features. Many of these you

More information

Unit 1: Working With Tables

Unit 1: Working With Tables Unit 1: Working With Tables Unit Overview This unit covers the basics of working with Tables and the Table wizard. It does not include working with fields, which is covered in Units 3 and 4. It is divided

More information

USING DRUPAL. Hampshire College Website Editors Guide https://drupal.hampshire.edu

USING DRUPAL. Hampshire College Website Editors Guide https://drupal.hampshire.edu USING DRUPAL Hampshire College Website Editors Guide 2014 https://drupal.hampshire.edu Asha Kinney Hampshire College Information Technology - 2014 HOW TO GET HELP Your best bet is ALWAYS going to be to

More information

Applying Code Generation Approach in Fabrique Kirill Kalishev, JetBrains

Applying Code Generation Approach in Fabrique Kirill Kalishev, JetBrains november 2004 Applying Code Generation Approach in Fabrique This paper discusses ideas on applying the code generation approach to help the developer to focus on high-level models rather than on routine

More information

Tips from the experts: How to waste a lot of time on this assignment

Tips from the experts: How to waste a lot of time on this assignment Com S 227 Spring 2018 Assignment 1 100 points Due Date: Friday, September 14, 11:59 pm (midnight) Late deadline (25% penalty): Monday, September 17, 11:59 pm General information This assignment is to be

More information

[Video] and so on... Problems that require a function definition can be phrased as a word problem such as the following:

[Video] and so on... Problems that require a function definition can be phrased as a word problem such as the following: Defining Functions (Time 20 minutes) Defining a value is helpful when a program has lots of identical expressions. Sometimes, however, a program has expressions that aren t identical, but are just very

More information

NCMail: Microsoft Outlook User s Guide

NCMail: Microsoft Outlook User s Guide NCMail: Microsoft Outlook 2003 Email User s Guide Revision 1.0 11/10/2007 This document covers how to use Microsoft Outlook 2003 for accessing your email with the NCMail Exchange email system. The syntax

More information

CS240: Programming in C

CS240: Programming in C CS240: Programming in C Lecture 5: Functions. Scope. 1 Functions: Explicit declaration Declaration, definition, use, order matters. Declaration: defines the interface of a function; i.e., number and types

More information

Tradeoffs. CSE 505: Programming Languages. Lecture 15 Subtyping. Where shall we add useful completeness? Where shall we add completeness?

Tradeoffs. CSE 505: Programming Languages. Lecture 15 Subtyping. Where shall we add useful completeness? Where shall we add completeness? Tradeoffs CSE 505: Programming Languages Lecture 15 Subtyping Zach Tatlock Autumn 2017 Desirable type system properties (desiderata): soundness - exclude all programs that get stuck completeness - include

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Fall 2016 Lecture 4a Andrew Tolmach Portland State University 1994-2016 Pragmatics of Large Values Real machines are very efficient at handling word-size chunks of data (e.g.

More information

First Java Program - Output to the Screen

First Java Program - Output to the Screen First Java Program - Output to the Screen These notes are written assuming that the reader has never programmed in Java, but has programmed in another language in the past. In any language, one of the

More information

How to Break Software by James Whittaker

How to Break Software by James Whittaker How to Break Software by James Whittaker CS 470 Practical Guide to Testing Consider the system as a whole and their interactions File System, Operating System API Application Under Test UI Human invokes

More information

Reporting Best Practices

Reporting Best Practices Note You can find troubleshooting information for Cisco Unified Customer Voice Portal (Unified CVP) Reporting on the Cisco Troubleshooting Doc Wiki site The chapter contains the following topics: Reporting

More information

Key Features. Let s Get Started!

Key Features. Let s Get Started! WELCOME TO plans Key Features swipe to next page Let s Get Started! There are many great things you ll discover as you begin using BluVue, like faster collaborative decisions in the field, saving money

More information

The Game of Criss-Cross

The Game of Criss-Cross Chapter 5 The Game of Criss-Cross Euler Characteristic ( ) Overview. The regions on a map and the faces of a cube both illustrate a very natural sort of situation: they are each examples of regions that

More information

Creating Two-dimensional Arrays

Creating Two-dimensional Arrays ANY TYPE CAN BE USED as the base type of an array. You can have an array of ints, an array of Strings, an array of Objects, and so on. In particular, since an array type is a first-class Java type, you

More information

CS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output

CS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output CS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output Last revised January 12, 2006 Objectives: 1. To introduce arithmetic operators and expressions 2. To introduce variables

More information

Software Testing Prof. Meenakshi D Souza Department of Computer Science and Engineering International Institute of Information Technology, Bangalore

Software Testing Prof. Meenakshi D Souza Department of Computer Science and Engineering International Institute of Information Technology, Bangalore Software Testing Prof. Meenakshi D Souza Department of Computer Science and Engineering International Institute of Information Technology, Bangalore Lecture 04 Software Test Automation: JUnit as an example

More information

This guide will help you with many of the basics of operation for your Epson 485wi BrightLink Projector with interactive functionality.

This guide will help you with many of the basics of operation for your Epson 485wi BrightLink Projector with interactive functionality. This guide will help you with many of the basics of operation for your Epson 485wi BrightLink Projector with interactive functionality. If you need further assistance with questions, you can refer to the

More information

Focus Group Analysis

Focus Group Analysis Focus Group Analysis Contents FOCUS GROUP ANALYSIS... 1 HOW CAN MAXQDA SUPPORT FOCUS GROUP ANALYSIS?... 1 IMPORTING FOCUS GROUP TRANSCRIPTS... 1 TRANFORMING AN ALREADY IMPORTED TEXT INTO A FOCUS GROUP

More information

A Tutorial for ECE 175

A Tutorial for ECE 175 Debugging in Microsoft Visual Studio 2010 A Tutorial for ECE 175 1. Introduction Debugging refers to the process of discovering defects (bugs) in software and correcting them. This process is invoked when

More information

TestComplete 3.0 Overview for Non-developers

TestComplete 3.0 Overview for Non-developers TestComplete 3.0 Overview for Non-developers Copyright 2003 by Robert K. Leahey and AutomatedQA, Corp. All rights reserved. Part : Table of Contents Introduction 1 About TestComplete 1 Basics 2 Types of

More information

This section provides some reminders and some terminology with which you might not be familiar.

This section provides some reminders and some terminology with which you might not be familiar. Chapter 3: Functions 3.1 Introduction The previous chapter assumed that all of your Bali code would be written inside a sole main function. But, as you have learned from previous programming courses, modularizing

More information

CS 465 Program 4: Modeller

CS 465 Program 4: Modeller CS 465 Program 4: Modeller out: 30 October 2004 due: 16 November 2004 1 Introduction In this assignment you will work on a simple 3D modelling system that uses simple primitives and curved surfaces organized

More information

Eclipse JWT Java Workflow Tooling. Workflow Editor (WE): Installation and Usage Tutorial

Eclipse JWT Java Workflow Tooling. Workflow Editor (WE): Installation and Usage Tutorial Eclipse JWT Java Workflow Tooling Title of this document Workflow Editor (WE): Installation and Usage Tutorial Document information last changes component version 13.02.2008 0.4.0 Document created by Florian

More information

The RASTA Framework. Joel Becker October 3, 2001

The RASTA Framework. Joel Becker October 3, 2001 The RASTA Framework Joel Becker October 3, 2001 Abstract RASTA is an framework for describing tasks on a computer system. It is well known that casual and non-expert users prefer to be guided through tasks

More information

Computer Vision. Matlab

Computer Vision. Matlab Computer Vision Matlab A good choice for vision program development because Easy to do very rapid prototyping Quick to learn, and good documentation A good library of image processing functions Excellent

More information

CSE341: Programming Languages Lecture 9 Function-Closure Idioms. Dan Grossman Winter 2013

CSE341: Programming Languages Lecture 9 Function-Closure Idioms. Dan Grossman Winter 2013 CSE341: Programming Languages Lecture 9 Function-Closure Idioms Dan Grossman Winter 2013 More idioms We know the rule for lexical scope and function closures Now what is it good for A partial but wide-ranging

More information

Opening the Program. Movie Maker II 1

Opening the Program. Movie Maker II 1 1 Opening the Program To open the Movie Maker II application, use the Start Programs Movie Maker combination from the desktop. Alternatively, you can create a shortcut on the desktop. After executing this

More information

Repe$$on CSC 121 Spring 2017 Howard Rosenthal

Repe$$on CSC 121 Spring 2017 Howard Rosenthal Repe$$on CSC 121 Spring 2017 Howard Rosenthal Lesson Goals Learn the following three repetition structures in Java, their syntax, their similarities and differences, and how to avoid common errors when

More information

OpenForms360 Validation User Guide Notable Solutions Inc.

OpenForms360 Validation User Guide Notable Solutions Inc. OpenForms360 Validation User Guide 2011 Notable Solutions Inc. 1 T A B L E O F C O N T EN T S Introduction...5 What is OpenForms360 Validation?... 5 Using OpenForms360 Validation... 5 Features at a glance...

More information

NCMail: Microsoft Outlook User s Guide

NCMail: Microsoft Outlook User s Guide NCMail: Microsoft Outlook 2007 Email User s Guide Revision 1.1 3/9/2009 This document covers how to use Microsoft Outlook 2007 for accessing your email with the NCMail Exchange email system. The syntax

More information

Software Paradigms (Lesson 3) Object-Oriented Paradigm (2)

Software Paradigms (Lesson 3) Object-Oriented Paradigm (2) Software Paradigms (Lesson 3) Object-Oriented Paradigm (2) Table of Contents 1 Reusing Classes... 2 1.1 Composition... 2 1.2 Inheritance... 4 1.2.1 Extending Classes... 5 1.2.2 Method Overriding... 7 1.2.3

More information

4. Java Project Design, Input Methods

4. Java Project Design, Input Methods 4-1 4. Java Project Design, Input Methods Review and Preview You should now be fairly comfortable with creating, compiling and running simple Java projects. In this class, we continue learning new Java

More information

CS558 Programming Languages Winter 2018 Lecture 4a. Andrew Tolmach Portland State University

CS558 Programming Languages Winter 2018 Lecture 4a. Andrew Tolmach Portland State University CS558 Programming Languages Winter 2018 Lecture 4a Andrew Tolmach Portland State University 1994-2018 Pragmatics of Large Values Real machines are very efficient at handling word-size chunks of data (e.g.

More information

Thread Safety. Review. Today o Confinement o Threadsafe datatypes Required reading. Concurrency Wrapper Collections

Thread Safety. Review. Today o Confinement o Threadsafe datatypes Required reading. Concurrency Wrapper Collections Thread Safety Today o Confinement o Threadsafe datatypes Required reading Concurrency Wrapper Collections Optional reading The material in this lecture and the next lecture is inspired by an excellent

More information

Windows 8.1. Tiles come in four shapes: small, medium, wide, and large. The red outlined tiles are live tiles.

Windows 8.1. Tiles come in four shapes: small, medium, wide, and large. The red outlined tiles are live tiles. Windows 8/8.1 was Microsoft s attempt to have one operating system for all devices desktops, laptops, phones, tablets, and everything else. Some like it more than others. Microsoft Windows 10 is supposed

More information

Mobile Computing Professor Pushpedra Singh Indraprasth Institute of Information Technology Delhi Andriod Development Lecture 09

Mobile Computing Professor Pushpedra Singh Indraprasth Institute of Information Technology Delhi Andriod Development Lecture 09 Mobile Computing Professor Pushpedra Singh Indraprasth Institute of Information Technology Delhi Andriod Development Lecture 09 Hello, today we will create another application called a math quiz. This

More information

Intro. Scheme Basics. scm> 5 5. scm>

Intro. Scheme Basics. scm> 5 5. scm> Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if

More information

Unit 1 Lesson 4. Introduction to Control Statements

Unit 1 Lesson 4. Introduction to Control Statements Unit 1 Lesson 4 Introduction to Control Statements Essential Question: How are control loops used to alter the execution flow of a program? Lesson 4: Introduction to Control Statements Objectives: Use

More information