Information about 11. Functions II

Iteration 1 CAP

Expectations We will have 5 groups:! ! 1 GenArt, 1 DataViz, and 3 Game groups! • • Mon, 17 Feb: you will show Iteration 1 to your group and take notes (4–5 minutes per student)! • Wed, 19 Feb: you will submit your code, the notes you took in class, and an Iteration 2 plan before class (probably via Sakai…)

Feedback • What works? What do you like?! • What doesn’t work? How could it be improved?! • Any other thoughts or comments?

Ideate Empathize Deﬁne Prototype Test The Iterative Design Process

Functions II CAP

Functions • Functions allow Modularity and Reusability! • They allow us to have code which follows the principle of DRY: “Don’t Repeat Yourself”

“Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.” The Pragmatic Programmer! Hunt & Thomas on the Principle of Don’t Repeat Yourself (DRY)

DRY vs. WET • Non-DRY coding is often called WET coding:! ! - Write Everything Twice! ! - We Enjoy Typing!! • If you are repeating yourself in code, you should automatically start thinking about functions…

Functions returnType functionName( argumentList ) { // the function code is here } • Memorize the structure of a function!! • You need to be able to “read” functions

Random Fill Color void setRandomRGBFillColor() { fill(random(255),random(255),random(255); } “This function takes no arguments, sets the ﬁll color to a random RGB color, and returns nothing.”

Random Positions float randomXPosition() { return random(width); } ! float randomYPosition() { return random(height); } “This function takes no arguments, generates a random value based on width, and returns a ﬂoat.”

Demo! Square & Circle

Arguments • When need a function to use a value that we give to it, we give it arguments! • size(400,300); has two arguments! • Arguments are said to be “passed” to the function, and must follow some rules:! ! - they must have the correct number of arguments! ! - they must have the correct type of arguments

Passed by Copy • When arguments are passed, they are said to be “passed by copy”! • This means that your argument is duplicated (copied) and the copy is handed to the function! • The function can use/abuse the copy and return a value, without ever affecting the original value passed in

Demo! Passing An Argument

Quiz 2 CAP

For next time… • Read Shiffman, p. 121–130 (Objects I)! • Two weeks until Iteration 1 is due

In this live Grade 11 Maths show we continue with Functions. In this lesson we cover the effects of p & q on the exponential graph. We look at ...

Read more

11. Introduction to c++: Introduction to functions II; inline function; prototype declaration DigitalStage.

Read more

Nelson Education > School > Mathematics > Functions 11 : Functions 11. Web Links. Here are some useful links for students and teachers. Curriculum Correlation

Read more

Welcome to IXL's grade 11 math page. Practise math online with unlimited questions in more than 200 grade 11 math skills.

Read more

Math Functions II. PHP. 7. Functions, Part I. andisusanto 2015-11-05 03:02:53 UTC #1. ... bytewhiz09158 2015-11-14 10:55:45 UTC #5.

Read more

Contents This week we will look at some more details of functions: Arguments passed by value and by reference Default parameters Overloading ...

Read more

Posts about Chapter 11 Circular Functions II written by pgwoolfe. Mr Woolfe's Maths Heaven "Mathematics is the alphebet with which God created the universe

Read more

Nelson Education > School > Mathematics > Functions 11 > Web Links : Functions 11 Useful Websites for MCR3U ... Discrete Functions: Sequences and Series .

Read more

In this live Grade 11 Maths show we continue with Functions. In this lesson we cover the effects of p & q on the exponential graph. We look at finding the ...

Read more

Your studies in algebra 1 have built a solid foundation from which you can explore linear equations, inequalities, and functions. In algebra 2 we build ...

Read more

## Add a comment