SlideShare una empresa de Scribd logo
1 de 18
Descargar para leer sin conexión
From last time…
•

Quiz 2: Variables, Conditionals, & Loops!

•

We started to organize our sketches by defining
functions and simplifying our draw loop!

•

I sent out / posted expectations for Iteration 1!

•

I’ve cancelled class next Monday, 10 Feb 2014
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

Define

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 fill 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 float.”
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

Más contenido relacionado

La actualidad más candente

Ruby object model
Ruby object modelRuby object model
Ruby object modelmbeizer
 
Learn Ruby 2011 - Session 3
Learn Ruby 2011 - Session 3Learn Ruby 2011 - Session 3
Learn Ruby 2011 - Session 3James Thompson
 
Dependent Types make bad data unrepresentable
Dependent Types make bad data unrepresentableDependent Types make bad data unrepresentable
Dependent Types make bad data unrepresentableJack Fox
 
Learn Ruby 2011 - Session 2
Learn Ruby 2011 - Session 2Learn Ruby 2011 - Session 2
Learn Ruby 2011 - Session 2James Thompson
 
Metaprogramming in Ruby
Metaprogramming in RubyMetaprogramming in Ruby
Metaprogramming in RubyVolodymyr Byno
 
Decorator Design Pattern
Decorator Design PatternDecorator Design Pattern
Decorator Design PatternAdeel Riaz
 

La actualidad más candente (8)

Ruby object model
Ruby object modelRuby object model
Ruby object model
 
Learn Ruby 2011 - Session 3
Learn Ruby 2011 - Session 3Learn Ruby 2011 - Session 3
Learn Ruby 2011 - Session 3
 
04 inheritance
04 inheritance04 inheritance
04 inheritance
 
Decorator pattern
Decorator patternDecorator pattern
Decorator pattern
 
Dependent Types make bad data unrepresentable
Dependent Types make bad data unrepresentableDependent Types make bad data unrepresentable
Dependent Types make bad data unrepresentable
 
Learn Ruby 2011 - Session 2
Learn Ruby 2011 - Session 2Learn Ruby 2011 - Session 2
Learn Ruby 2011 - Session 2
 
Metaprogramming in Ruby
Metaprogramming in RubyMetaprogramming in Ruby
Metaprogramming in Ruby
 
Decorator Design Pattern
Decorator Design PatternDecorator Design Pattern
Decorator Design Pattern
 

Destacado

Social media jones
Social media jonesSocial media jones
Social media jonesjoness_jaida
 
MoretonSmith Receivables Management Intro
MoretonSmith Receivables Management IntroMoretonSmith Receivables Management Intro
MoretonSmith Receivables Management IntroMoretonSmith
 
rory reyes
rory reyesrory reyes
rory reyesmamayay
 
20140220pln final2
20140220pln final220140220pln final2
20140220pln final2pguenthe
 
Wc unit 3 work place commuication
Wc unit 3 work place commuicationWc unit 3 work place commuication
Wc unit 3 work place commuicationGanesha Pandian
 
Social media fox
Social media foxSocial media fox
Social media foxtucker6
 
15. Final Project - Iteration 1
15. Final Project - Iteration 115. Final Project - Iteration 1
15. Final Project - Iteration 1Joseph Murphy
 
การคิดราคาต้นทุน
การคิดราคาต้นทุนการคิดราคาต้นทุน
การคิดราคาต้นทุนJirawat Laiyung
 
09 tajuk 1 إعداد خطة التدريس
09 tajuk 1 إعداد خطة التدريس09 tajuk 1 إعداد خطة التدريس
09 tajuk 1 إعداد خطة التدريسLutfi Hakimi
 

Destacado (18)

1. Pixels
1. Pixels1. Pixels
1. Pixels
 
Q the music
Q the musicQ the music
Q the music
 
Presentation1
Presentation1Presentation1
Presentation1
 
28. Video II
28. Video II28. Video II
28. Video II
 
Adachris
AdachrisAdachris
Adachris
 
Social media jones
Social media jonesSocial media jones
Social media jones
 
MoretonSmith Receivables Management Intro
MoretonSmith Receivables Management IntroMoretonSmith Receivables Management Intro
MoretonSmith Receivables Management Intro
 
rory reyes
rory reyesrory reyes
rory reyes
 
20140220pln final2
20140220pln final220140220pln final2
20140220pln final2
 
Wc unit 3 work place commuication
Wc unit 3 work place commuicationWc unit 3 work place commuication
Wc unit 3 work place commuication
 
Social media fox
Social media foxSocial media fox
Social media fox
 
15. Final Project - Iteration 1
15. Final Project - Iteration 115. Final Project - Iteration 1
15. Final Project - Iteration 1
 
HUMAN RIGHTS
HUMAN RIGHTSHUMAN RIGHTS
HUMAN RIGHTS
 
การคิดราคาต้นทุน
การคิดราคาต้นทุนการคิดราคาต้นทุน
การคิดราคาต้นทุน
 
La brújula
La brújulaLa brújula
La brújula
 
4. Interaction
4. Interaction4. Interaction
4. Interaction
 
09 tajuk 1 إعداد خطة التدريس
09 tajuk 1 إعداد خطة التدريس09 tajuk 1 إعداد خطة التدريس
09 tajuk 1 إعداد خطة التدريس
 
Evaluation 4
Evaluation 4Evaluation 4
Evaluation 4
 

Similar a Iterative Design Process and Functions in Processing

Not Everything is an Object - Rocksolid Tour 2013
Not Everything is an Object  - Rocksolid Tour 2013Not Everything is an Object  - Rocksolid Tour 2013
Not Everything is an Object - Rocksolid Tour 2013Gary Short
 
Functions, List and String methods
Functions, List and String methodsFunctions, List and String methods
Functions, List and String methodsPranavSB
 
Functional programming for the Advanced Beginner
Functional programming for the Advanced BeginnerFunctional programming for the Advanced Beginner
Functional programming for the Advanced BeginnerLuis Atencio
 
A Type-level Ruby Interpreter for Testing and Understanding
A Type-level Ruby Interpreter for Testing and UnderstandingA Type-level Ruby Interpreter for Testing and Understanding
A Type-level Ruby Interpreter for Testing and Understandingmametter
 
JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)Eduard Tomàs
 
JavaScript in 2016
JavaScript in 2016JavaScript in 2016
JavaScript in 2016Codemotion
 
The disaster of mutable state
The disaster of mutable stateThe disaster of mutable state
The disaster of mutable statekenbot
 
Advanced Reflection in Pharo
Advanced Reflection in PharoAdvanced Reflection in Pharo
Advanced Reflection in PharoPharo
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almostQuinton Sheppard
 
Object Oriented Paradigm
Object Oriented ParadigmObject Oriented Paradigm
Object Oriented ParadigmHüseyin Ergin
 
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018Mike Harris
 
RubyConf Portugal 2014 - Why ruby must go!
RubyConf Portugal 2014 - Why ruby must go!RubyConf Portugal 2014 - Why ruby must go!
RubyConf Portugal 2014 - Why ruby must go!Gautam Rege
 
CPP13 - Object Orientation
CPP13 - Object OrientationCPP13 - Object Orientation
CPP13 - Object OrientationMichael Heron
 
Actors and Threads
Actors and ThreadsActors and Threads
Actors and Threadsmperham
 
Pythonlearn-04-Functions (1).pptx
Pythonlearn-04-Functions (1).pptxPythonlearn-04-Functions (1).pptx
Pythonlearn-04-Functions (1).pptxleavatin
 
Hacker 101/102 - Introduction to Programming w/Processing
Hacker 101/102 - Introduction to Programming w/ProcessingHacker 101/102 - Introduction to Programming w/Processing
Hacker 101/102 - Introduction to Programming w/ProcessingDan Chudnov
 
Teaching Constraint Programming, Patrick Prosser
Teaching Constraint Programming,  Patrick ProsserTeaching Constraint Programming,  Patrick Prosser
Teaching Constraint Programming, Patrick ProsserPierre Schaus
 

Similar a Iterative Design Process and Functions in Processing (20)

10. Function I
10. Function I10. Function I
10. Function I
 
Not Everything is an Object - Rocksolid Tour 2013
Not Everything is an Object  - Rocksolid Tour 2013Not Everything is an Object  - Rocksolid Tour 2013
Not Everything is an Object - Rocksolid Tour 2013
 
Functions, List and String methods
Functions, List and String methodsFunctions, List and String methods
Functions, List and String methods
 
9. Loops II
9. Loops II9. Loops II
9. Loops II
 
Functional programming for the Advanced Beginner
Functional programming for the Advanced BeginnerFunctional programming for the Advanced Beginner
Functional programming for the Advanced Beginner
 
A Type-level Ruby Interpreter for Testing and Understanding
A Type-level Ruby Interpreter for Testing and UnderstandingA Type-level Ruby Interpreter for Testing and Understanding
A Type-level Ruby Interpreter for Testing and Understanding
 
JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)
 
JavaScript in 2016
JavaScript in 2016JavaScript in 2016
JavaScript in 2016
 
The disaster of mutable state
The disaster of mutable stateThe disaster of mutable state
The disaster of mutable state
 
Advanced Reflection in Pharo
Advanced Reflection in PharoAdvanced Reflection in Pharo
Advanced Reflection in Pharo
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almost
 
Object Oriented Paradigm
Object Oriented ParadigmObject Oriented Paradigm
Object Oriented Paradigm
 
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
 
Javascript
JavascriptJavascript
Javascript
 
RubyConf Portugal 2014 - Why ruby must go!
RubyConf Portugal 2014 - Why ruby must go!RubyConf Portugal 2014 - Why ruby must go!
RubyConf Portugal 2014 - Why ruby must go!
 
CPP13 - Object Orientation
CPP13 - Object OrientationCPP13 - Object Orientation
CPP13 - Object Orientation
 
Actors and Threads
Actors and ThreadsActors and Threads
Actors and Threads
 
Pythonlearn-04-Functions (1).pptx
Pythonlearn-04-Functions (1).pptxPythonlearn-04-Functions (1).pptx
Pythonlearn-04-Functions (1).pptx
 
Hacker 101/102 - Introduction to Programming w/Processing
Hacker 101/102 - Introduction to Programming w/ProcessingHacker 101/102 - Introduction to Programming w/Processing
Hacker 101/102 - Introduction to Programming w/Processing
 
Teaching Constraint Programming, Patrick Prosser
Teaching Constraint Programming,  Patrick ProsserTeaching Constraint Programming,  Patrick Prosser
Teaching Constraint Programming, Patrick Prosser
 

Más de Joseph Murphy

Más de Joseph Murphy (20)

33. Input II
33. Input II33. Input II
33. Input II
 
32. Input I
32. Input I32. Input I
32. Input I
 
30. Text II
30. Text II30. Text II
30. Text II
 
29. Text I
29. Text I29. Text I
29. Text I
 
27. Video I
27. Video I27. Video I
27. Video I
 
26. Images II
26. Images II26. Images II
26. Images II
 
25. Images I
25. Images I25. Images I
25. Images I
 
24. Translation & Rotation II
24. Translation & Rotation II24. Translation & Rotation II
24. Translation & Rotation II
 
23. Final Project Iteration II
23. Final Project Iteration II23. Final Project Iteration II
23. Final Project Iteration II
 
34. Final Project Iteration 3
34. Final Project Iteration 334. Final Project Iteration 3
34. Final Project Iteration 3
 
22. Translation & Rotation I
22. Translation & Rotation I22. Translation & Rotation I
22. Translation & Rotation I
 
21. Mathematics II
21. Mathematics II21. Mathematics II
21. Mathematics II
 
19. Algorithms II
19. Algorithms II19. Algorithms II
19. Algorithms II
 
20. Mathematics I
20. Mathematics I20. Mathematics I
20. Mathematics I
 
A. Design Thinking Lecture
A. Design Thinking LectureA. Design Thinking Lecture
A. Design Thinking Lecture
 
18. Algorithms
18. Algorithms18. Algorithms
18. Algorithms
 
14. Arrays I
14. Arrays I14. Arrays I
14. Arrays I
 
13. Objects II
13. Objects II13. Objects II
13. Objects II
 
8. Loops I
8. Loops I8. Loops I
8. Loops I
 
7. Conditionals II
7. Conditionals II7. Conditionals II
7. Conditionals II
 

Último

How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
CHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxCHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxAneriPatwari
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6Vanessa Camilleri
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptxmary850239
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptxmary850239
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 

Último (20)

How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
CHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxCHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptx
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 

Iterative Design Process and Functions in Processing

  • 1. From last time… • Quiz 2: Variables, Conditionals, & Loops! • We started to organize our sketches by defining functions and simplifying our draw loop! • I sent out / posted expectations for Iteration 1! • I’ve cancelled class next Monday, 10 Feb 2014
  • 3. 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…)
  • 4. Feedback • What works? What do you like?! • What doesn’t work? How could it be improved?! • Any other thoughts or comments?
  • 7. Functions • Functions allow Modularity and Reusability! • They allow us to have code which follows the principle of DRY: “Don’t Repeat Yourself”
  • 8. “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)
  • 9. 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…
  • 10. Functions returnType functionName( argumentList ) { // the function code is here } • Memorize the structure of a function!! • You need to be able to “read” functions
  • 11. Random Fill Color void setRandomRGBFillColor() { fill(random(255),random(255),random(255); } “This function takes no arguments, sets the fill color to a random RGB color, and returns nothing.”
  • 12. 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 float.”
  • 14. 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
  • 15. 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
  • 18. For next time… • Read Shiffman, p. 121–130 (Objects I)! • Two weeks until Iteration 1 is due