pxt-calliope/docs/reference/js/lessons/transformers.md

126 lines
5.7 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# transformers lesson
2016-04-02 01:22:47 +02:00
use functions to return values.
2016-03-26 00:47:20 +01:00
### @video td/videos/transformers-0
## Topic
Return
## Quick Links
2016-04-13 17:27:45 +02:00
* [tutorial](/lessons/transformers/tutorial)
* [quiz](/lessons/transformers/quiz)
* [quiz answers](/lessons/transformers/quiz-answers)
* [challenges](/lessons/transformers/challenges)
2016-03-26 00:47:20 +01:00
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to create **functions**, ` function() ` to make your code easier to read, debug, and update. We will be learning how to create functions as well as a global variable, input on button pressed as well simple commands such as show number.
## What the teacher needs to know
* Algorithm: An unambiguous set of rules or a precise step-bystep guide to solve a problem or achieve a particular objective.
* Command: An instruction for the computer to execute, written in a particular programming language.
* Data: A structured set of numbers, possibly representing digitised text, images, sound or video, which can be processed or transmitted by a computer, also used for numerical (quantitative) information.
* Decomposing: The process through which problems or systems are broken down into their component parts, each of which may then be considered separately.
* Hardware: The physical systems and components of digital devices; see also software.
* Input: Data provided to a computer system, such as via a keyboard, mouse, microphone, camera or physical sensors.
* Output: The information produced by a computer system for its user, typically on a screen, through speakers or on a printer, but possibly through the control of motors in physical systems.
* Programmable toys: Robots designed for children to use, accepting input, storing short sequences of simple instructions and moving according to this stored program.
* Program: A stored set of instructions encoded in a language understood by the computer that does some form of computation, processing input and/or stored data to generate output.
* Script: A computer program typically executed one line at a time through an interpreter, such as the instructions for a Scratch character.
* Selection: A programming construct in which one section of code or another is executed depending on whether a particular condition is met.
* Sequence: To place program instructions in order, with each executed one after the other.
* Simulation: Using a computer to model the state and behaviour of real-world (or imaginary) systems, including physical or social systems; an integral part of most computer games.
* Variables: A way in which computer programs can store, retrieve or change data, such as a score, the time left, or the users name.
**QuickStart Computing Glossary
## Documentation
2016-04-13 17:27:45 +02:00
* **function** : [read more...](/js/function)
* **return** : [read more...](/js/return)
* **call** : [read more...](/js/call)
* **global variable** : [read more...](/js/data)
* **on button pressed** : [read more...](/reference/input/on-button-pressed)
* **local variable** : [read more...](/reference/variables/var)
* **show number** : [read more...](/reference/basic/show-number)
2016-03-26 00:47:20 +01:00
## Resources
2016-04-13 17:27:45 +02:00
* Activity: [tutorial](/lessons/transformers/tutorial)
* Activity: [quiz](/lessons/transformers/quiz)
* Extended Activity: [challenges](/lessons/transformers/challenges)
2016-03-26 00:47:20 +01:00
## Objectives
* learn how to create a function that performs a specific task to make your code easier to read, debug, and update
* learn how the return statement exits a function and returns a value to the code
* learn how to call an existing function in your script
* learn how to create a global variable to store data so that you can use it later in your code and accessible across functions and in nested code blocks
* learn how to run code when an input button is pressed
* learn how to create a local variable to store data, so that you can use it in your code
* learn how to show a number on the LED screen
## Links to the National Curriculum Programmes of Study for Computing
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Uses diagrams to express solutions.(AB)
* Uses logical reasoning to predict outputs, showing an awareness of inputs (AL)
* Designs solutions by decomposing a problem and creates a sub-solution for each of these parts. (DE) (AL) (AB)
* Represents solutions using a structured notation (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Declares and assigns variables(AB)
* Uses a variable and relational operators within a loop to govern termination (AL) (GE)
* Uses a range of operators and expressions e.g. Boolean, and applies them in the context of program control. (AL)
* Selects the appropriate data types(AL) (AB
#### Data & Data Representation
* Uses filters or can perform single criteria searches for information.(AL)
* Defines data types: real numbers and Boolean (AB)
#### Hardware & Processing
* Knows that computers collect data from various input devices, including sensors and application software (AB)
#### Information Technology
* Collects, organizes, and presents data and information in digital content (AB)
* Makes appropriate improvements to solutions based on feedback received, and can comment on the success of the solution (EV)
* Recognises ethical issues surrounding the application of information technology beyond school.
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
2016-04-13 17:27:45 +02:00
* [tutorial](/lessons/transformers/tutorial)
* [quiz](/lessons/transformers/quiz)
2016-03-26 00:47:20 +01:00
## Extended Activity
* time: 20 min.
2016-04-13 17:27:45 +02:00
* [challenges](/lessons/transformers/challenges)
2016-03-26 00:47:20 +01:00
## Homework
2016-04-13 17:27:45 +02:00
* Extended Activity: [challenges](/lessons/transformers/challenges)
2016-03-26 00:47:20 +01:00
## Intended follow on
Publish script to the classroom.