SlideShare a Scribd company logo
1 of 26
Problem Solving with Data
Structures using Java:
A Multimedia Approach
Chapter 1: Objects for
Modeling a World
Todayā€™s story
ļ¬ Whatā€™s the point of this book?
ļ¬ Whatā€™s a model?
ļ¬ What are data structures?
ļ¬ Why Java?
ļ¬ Details on the course
ļ¬ Getting set up for the course
The Point of this Book
ļ¬ Real computer-based media developers
rarely work in terms of pixels and
samples
ā€¢ Computer musicians deal in terms of notes,
instruments, patches, and other structures.
ā€¢ Computer animators deal in terms of
characters, movement, scenes, and other
structures
ļ¬ Bottom-line: They structure their media.
Driving Questions of the Book
ļ¬ How did the wildebeestā€™s charge over the
ridge in The Lion King?
ļ¬ How did the villages wave in The
Hunchback of Notre Dame?
The Wildebeests in
The Lion King
The Villagers in The Hunchback
of Notre Dame
The answer: Modeling and
Simulation
ļ¬ These are two of the (rare) times that Disney
stepped away from their traditional drawn cel
animation.
ļ¬ Instead they:
ā€¢ Modeled the structure of wildebeests and villagers,
ā€¢ Modeled the behavior of wildebeests (how they
stampede) and villagers (how they wave),
ā€¢ Then started a computer simulation that executed the
modelsā€¦and basically filmed the screen.
Whatā€™s ā€œmodelingā€?
ļ¬ Describing things in the world in terms of their
structure and behavior.
ā€¢ F=ma (Force=mass * acceleration) is part of a model
of the world that describes what happens when one
thing hits another.
ā€¢ Maps model physical spaces and their physical
relationships
ļ¬ On a computer, we can execute these models:
Make them work, plug values into equations,
move things in space, see what happens.
ā€¢ Thatā€™s simulation: Executing a model
Whatā€™s a data structure?
ļ¬ A way of organizing information.
ļ¬ Different physical structures organize
space differently.
ā€¢ Skyscrapers vs. ranch homes.
ā€¢ Trees vs. snail shells
ļ¬ Data structures organize the information
we use in our programs in different ways.
Data structures you know
Age Eye
Color
Matt 13 Brown
Jenny 7 Blue
Data structures that youā€™ll come
to know
Note in Kitchen
Note in Living
Room
Note in Study
Note in Bedroom
Data structures have different
properties
ļ¬ Arrays and tables keep things organized
right next to one another.
ā€¢ Makes it easy to find something in the array or
table
ā€¢ But if you want to insert something new, you
have to move everything over.
ļ¬ Linked lists and trees keep track of
relationships with links (or edges)
ā€¢ Easier to insert new things
Thought experiment:
Adding a second of silence into a
sound
ļ¬ Assuming that thereā€™s room for another second
in the soundā€¦
ļ¬ We copy samples from the insertion point to
the end of sound down one second:
setSampleValueAt(sound,soundIndex+oneSec,
getSampleValueAt(sound,soundIndex))
ļ¬ Then we can insert oneSecā€™s worth of 0ā€™s into
the insertion point
How that looks visually
Here is some sound
Here is some sound
One second
000000000000000Here is some sound
One second
Inserting into a table
Age Eye
Color
Matt 13 Brown
Jenny 7 Blue
Age Eye
Color
Matt 13 Brown
Jenny 7 Blue
Age Eye
Color
Matt 13 Brown
Jenny 7 Blue
Age Eye
Color
Katie 9 Brown
Matt 13 Brown
Jenny 7 Blue
1 2
3
4
Inserting into a linked list
Note in Kitchen
Note in Living
Room
Note in Study
Note in Bedroom
Note in Den
Modeling and Simulations are
about data structures
ļ¬ The visual structure of villagers and
wildebeests (e.g., how legs and arms attach to
bodies) is a tree or graph.
ļ¬ Tracking which villager does something next is
a queue.
ļ¬ All of the wildebeests to stampede are stored
in a list.
ļ¬ The images to be used in making the villagers
wave or wildebeests run are usually stored in a
list.
Learning objectives in the book
Computer Science Learning Objectives
ļ¬ Students will be able to program Java classes and methods based on
modification.
ļ¬ Students will learn how to use and manipulate several core data
structures: Arrays, linked lists, trees, stacks, and queues.
Media Learning Objectives
ļ¬ Students will be able to explain the role of data structures in structuring
and manipulating data, especially multimedia.
ļ¬ Students will be able to explain key issues of modern animations, such as
sound synchronization and moving objects in layers.
ļ¬ Students will be able to discuss the properties, strengths, and weaknesses
of the different structuring approaches for media.
ļ¬ Students will be able to design, define, and implement some simulations.
ļ¬ Students will be able to explain the value of computation for modeling and
simulation.
Why are we using Java?
(Why arenā€™t we using Python?)
ļ¬ Java is faster than Python
ā€¢ We can do more operations in less time, so
we can do more complicated media in less
time.
ļ¬ Java is more well-known than Python.
ā€¢ So thereā€™s more ā€œresume valueā€ than Python.
ļ¬ If you take more CS, itā€™ll probably be in
Java.
ā€¢ More CS classes are being taught now in
Java than in other programming languages.
General flow of book
ļ¬ Introduction to Java
ā€¢ Manipulation of pictures and sounds
ā€¢ Manipulating music and turtles
ļ¬ Using arrays, linked lists, and trees
ā€¢ With music, pictures, and sounds
ā€¢ Creating animations using arrays, lists, and trees
ā€¢ Generalized linked lists and trees
ļ¬ Creating simulations
ā€¢ Predator/prey, disease propagation models, movement of
people
ā€¢ Different kinds of random
ā€¢ Sorting our events
ā€¢ Simulations with resources
ā€¢ Resource queues
ā€¢ Creating animations with simulations
Things to do to get started
ļ¬ Download and install JDK (Java Development Kit)
ā€¢ http://www.java.sun.com
ļ¬ Download and install DrJava
ā€¢ http://www.drjava.org
ļ¬ Download Jmusic
ā€¢ http://jmusic.ci.qut.edu.au/
You need jmusic.jar and the inst instrument files
ļ¬ Download the Java source files for class
ā€¢ http://www.mediacomputation.org
ļ¬ Then, tell Java where to find the JMusic and Java
source files.
Open DrJava Preferences
Telling DrJava where to find
Jmusic files
Adding in java-source
Everything that has to be there
ā€¢ Java-source
ā€¢ Jmusic: inst folder, music.jar
ā€¢ All jars in java-source
Parts of DrJava
Text of
your
class file
(.java)
Where you
interact
with Java
List of
class
files that
you have
open

More Related Content

Similar to Objects for modeling world

Mobile Learning apps for Science
Mobile Learning apps for ScienceMobile Learning apps for Science
Mobile Learning apps for ScienceHawkesdale P12 College
Ā 
Deep Learning with Python (PyData Seattle 2015)
Deep Learning with Python (PyData Seattle 2015)Deep Learning with Python (PyData Seattle 2015)
Deep Learning with Python (PyData Seattle 2015)Alexander Korbonits
Ā 
Turning On The Lights
Turning On The LightsTurning On The Lights
Turning On The Lightsnbruno
Ā 
Scenario-based Design
Scenario-based DesignScenario-based Design
Scenario-based DesignHans PƵldoja
Ā 
Scenario-Based Design
Scenario-Based DesignScenario-Based Design
Scenario-Based DesignHans PƵldoja
Ā 
Designing a synergistic relationship between undergraduate Data Science educa...
Designing a synergistic relationship between undergraduate Data Science educa...Designing a synergistic relationship between undergraduate Data Science educa...
Designing a synergistic relationship between undergraduate Data Science educa...Ciera Martinez
Ā 
Normal Considered Harmful
Normal Considered HarmfulNormal Considered Harmful
Normal Considered Harmfulgreenwop
Ā 
Design Patterns - Inspirations From Nature
Design Patterns - Inspirations From NatureDesign Patterns - Inspirations From Nature
Design Patterns - Inspirations From NaturePrakash Sathiyamoorthy
Ā 
Out-of-this-World Activities - Part 2 Webinar
Out-of-this-World Activities - Part 2 WebinarOut-of-this-World Activities - Part 2 Webinar
Out-of-this-World Activities - Part 2 WebinarNCIL - STAR_Net
Ā 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structureselliando dias
Ā 
BL Labs 2014 Symposium: The Mechanical Curator
BL Labs 2014 Symposium: The Mechanical CuratorBL Labs 2014 Symposium: The Mechanical Curator
BL Labs 2014 Symposium: The Mechanical Curatorbenosteen
Ā 
Artificial Intelligence is back, Deep Learning Networks and Quantum possibili...
Artificial Intelligence is back, Deep Learning Networks and Quantum possibili...Artificial Intelligence is back, Deep Learning Networks and Quantum possibili...
Artificial Intelligence is back, Deep Learning Networks and Quantum possibili...John Mathon
Ā 
StsenaariumidepƵhine disain
StsenaariumidepƵhine disainStsenaariumidepƵhine disain
StsenaariumidepƵhine disainHans PƵldoja
Ā 
Cell Structures and Functions Using SketchUp pg 2.pdf
Cell Structures and Functions Using SketchUp pg 2.pdfCell Structures and Functions Using SketchUp pg 2.pdf
Cell Structures and Functions Using SketchUp pg 2.pdfsanet10
Ā 
An Introduction to Recent Advances in the Field of NLP
An Introduction to Recent Advances in the Field of NLPAn Introduction to Recent Advances in the Field of NLP
An Introduction to Recent Advances in the Field of NLPRrubaa Panchendrarajan
Ā 
Scenario-Based Design
Scenario-Based DesignScenario-Based Design
Scenario-Based DesignHans PƵldoja
Ā 
Deep learning tutorial 9/2019
Deep learning tutorial 9/2019Deep learning tutorial 9/2019
Deep learning tutorial 9/2019Amr Rashed
Ā 
Deep Learning Tutorial
Deep Learning TutorialDeep Learning Tutorial
Deep Learning TutorialAmr Rashed
Ā 
Creating systems for success in a early childhood special education classroom
Creating systems for success in a early childhood special education classroomCreating systems for success in a early childhood special education classroom
Creating systems for success in a early childhood special education classroomConsiderateClassroom
Ā 

Similar to Objects for modeling world (20)

Mobile Learning apps for Science
Mobile Learning apps for ScienceMobile Learning apps for Science
Mobile Learning apps for Science
Ā 
Deep Learning with Python (PyData Seattle 2015)
Deep Learning with Python (PyData Seattle 2015)Deep Learning with Python (PyData Seattle 2015)
Deep Learning with Python (PyData Seattle 2015)
Ā 
Turning On The Lights
Turning On The LightsTurning On The Lights
Turning On The Lights
Ā 
Scenario-based Design
Scenario-based DesignScenario-based Design
Scenario-based Design
Ā 
Scenario-Based Design
Scenario-Based DesignScenario-Based Design
Scenario-Based Design
Ā 
Designing a synergistic relationship between undergraduate Data Science educa...
Designing a synergistic relationship between undergraduate Data Science educa...Designing a synergistic relationship between undergraduate Data Science educa...
Designing a synergistic relationship between undergraduate Data Science educa...
Ā 
Normal Considered Harmful
Normal Considered HarmfulNormal Considered Harmful
Normal Considered Harmful
Ā 
Design Patterns - Inspirations From Nature
Design Patterns - Inspirations From NatureDesign Patterns - Inspirations From Nature
Design Patterns - Inspirations From Nature
Ā 
Out-of-this-World Activities - Part 2 Webinar
Out-of-this-World Activities - Part 2 WebinarOut-of-this-World Activities - Part 2 Webinar
Out-of-this-World Activities - Part 2 Webinar
Ā 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structures
Ā 
BL Labs 2014 Symposium: The Mechanical Curator
BL Labs 2014 Symposium: The Mechanical CuratorBL Labs 2014 Symposium: The Mechanical Curator
BL Labs 2014 Symposium: The Mechanical Curator
Ā 
Artificial Intelligence is back, Deep Learning Networks and Quantum possibili...
Artificial Intelligence is back, Deep Learning Networks and Quantum possibili...Artificial Intelligence is back, Deep Learning Networks and Quantum possibili...
Artificial Intelligence is back, Deep Learning Networks and Quantum possibili...
Ā 
StsenaariumidepƵhine disain
StsenaariumidepƵhine disainStsenaariumidepƵhine disain
StsenaariumidepƵhine disain
Ā 
Cell Structures and Functions Using SketchUp pg 2.pdf
Cell Structures and Functions Using SketchUp pg 2.pdfCell Structures and Functions Using SketchUp pg 2.pdf
Cell Structures and Functions Using SketchUp pg 2.pdf
Ā 
Power Up Review
Power Up ReviewPower Up Review
Power Up Review
Ā 
An Introduction to Recent Advances in the Field of NLP
An Introduction to Recent Advances in the Field of NLPAn Introduction to Recent Advances in the Field of NLP
An Introduction to Recent Advances in the Field of NLP
Ā 
Scenario-Based Design
Scenario-Based DesignScenario-Based Design
Scenario-Based Design
Ā 
Deep learning tutorial 9/2019
Deep learning tutorial 9/2019Deep learning tutorial 9/2019
Deep learning tutorial 9/2019
Ā 
Deep Learning Tutorial
Deep Learning TutorialDeep Learning Tutorial
Deep Learning Tutorial
Ā 
Creating systems for success in a early childhood special education classroom
Creating systems for success in a early childhood special education classroomCreating systems for success in a early childhood special education classroom
Creating systems for success in a early childhood special education classroom
Ā 

Recently uploaded

AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
Ā 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
Ā 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
Ā 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
Ā 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
Ā 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
Ā 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
Ā 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
Ā 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
Ā 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
Ā 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
Ā 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationAadityaSharma884161
Ā 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
Ā 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
Ā 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
Ā 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxLigayaBacuel1
Ā 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
Ā 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
Ā 

Recently uploaded (20)

AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
Ā 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
Ā 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Ā 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
Ā 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
Ā 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
Ā 
Model Call Girl in Tilak Nagar Delhi reach out to us at šŸ”9953056974šŸ”
Model Call Girl in Tilak Nagar Delhi reach out to us at šŸ”9953056974šŸ”Model Call Girl in Tilak Nagar Delhi reach out to us at šŸ”9953056974šŸ”
Model Call Girl in Tilak Nagar Delhi reach out to us at šŸ”9953056974šŸ”
Ā 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
Ā 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
Ā 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
Ā 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
Ā 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
Ā 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint Presentation
Ā 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
Ā 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
Ā 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
Ā 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
Ā 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptx
Ā 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
Ā 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
Ā 

Objects for modeling world

  • 1. Problem Solving with Data Structures using Java: A Multimedia Approach Chapter 1: Objects for Modeling a World
  • 2. Todayā€™s story ļ¬ Whatā€™s the point of this book? ļ¬ Whatā€™s a model? ļ¬ What are data structures? ļ¬ Why Java? ļ¬ Details on the course ļ¬ Getting set up for the course
  • 3. The Point of this Book ļ¬ Real computer-based media developers rarely work in terms of pixels and samples ā€¢ Computer musicians deal in terms of notes, instruments, patches, and other structures. ā€¢ Computer animators deal in terms of characters, movement, scenes, and other structures ļ¬ Bottom-line: They structure their media.
  • 4. Driving Questions of the Book ļ¬ How did the wildebeestā€™s charge over the ridge in The Lion King? ļ¬ How did the villages wave in The Hunchback of Notre Dame?
  • 6. The Villagers in The Hunchback of Notre Dame
  • 7. The answer: Modeling and Simulation ļ¬ These are two of the (rare) times that Disney stepped away from their traditional drawn cel animation. ļ¬ Instead they: ā€¢ Modeled the structure of wildebeests and villagers, ā€¢ Modeled the behavior of wildebeests (how they stampede) and villagers (how they wave), ā€¢ Then started a computer simulation that executed the modelsā€¦and basically filmed the screen.
  • 8. Whatā€™s ā€œmodelingā€? ļ¬ Describing things in the world in terms of their structure and behavior. ā€¢ F=ma (Force=mass * acceleration) is part of a model of the world that describes what happens when one thing hits another. ā€¢ Maps model physical spaces and their physical relationships ļ¬ On a computer, we can execute these models: Make them work, plug values into equations, move things in space, see what happens. ā€¢ Thatā€™s simulation: Executing a model
  • 9. Whatā€™s a data structure? ļ¬ A way of organizing information. ļ¬ Different physical structures organize space differently. ā€¢ Skyscrapers vs. ranch homes. ā€¢ Trees vs. snail shells ļ¬ Data structures organize the information we use in our programs in different ways.
  • 10. Data structures you know Age Eye Color Matt 13 Brown Jenny 7 Blue
  • 11. Data structures that youā€™ll come to know Note in Kitchen Note in Living Room Note in Study Note in Bedroom
  • 12. Data structures have different properties ļ¬ Arrays and tables keep things organized right next to one another. ā€¢ Makes it easy to find something in the array or table ā€¢ But if you want to insert something new, you have to move everything over. ļ¬ Linked lists and trees keep track of relationships with links (or edges) ā€¢ Easier to insert new things
  • 13. Thought experiment: Adding a second of silence into a sound ļ¬ Assuming that thereā€™s room for another second in the soundā€¦ ļ¬ We copy samples from the insertion point to the end of sound down one second: setSampleValueAt(sound,soundIndex+oneSec, getSampleValueAt(sound,soundIndex)) ļ¬ Then we can insert oneSecā€™s worth of 0ā€™s into the insertion point
  • 14. How that looks visually Here is some sound Here is some sound One second 000000000000000Here is some sound One second
  • 15. Inserting into a table Age Eye Color Matt 13 Brown Jenny 7 Blue Age Eye Color Matt 13 Brown Jenny 7 Blue Age Eye Color Matt 13 Brown Jenny 7 Blue Age Eye Color Katie 9 Brown Matt 13 Brown Jenny 7 Blue 1 2 3 4
  • 16. Inserting into a linked list Note in Kitchen Note in Living Room Note in Study Note in Bedroom Note in Den
  • 17. Modeling and Simulations are about data structures ļ¬ The visual structure of villagers and wildebeests (e.g., how legs and arms attach to bodies) is a tree or graph. ļ¬ Tracking which villager does something next is a queue. ļ¬ All of the wildebeests to stampede are stored in a list. ļ¬ The images to be used in making the villagers wave or wildebeests run are usually stored in a list.
  • 18. Learning objectives in the book Computer Science Learning Objectives ļ¬ Students will be able to program Java classes and methods based on modification. ļ¬ Students will learn how to use and manipulate several core data structures: Arrays, linked lists, trees, stacks, and queues. Media Learning Objectives ļ¬ Students will be able to explain the role of data structures in structuring and manipulating data, especially multimedia. ļ¬ Students will be able to explain key issues of modern animations, such as sound synchronization and moving objects in layers. ļ¬ Students will be able to discuss the properties, strengths, and weaknesses of the different structuring approaches for media. ļ¬ Students will be able to design, define, and implement some simulations. ļ¬ Students will be able to explain the value of computation for modeling and simulation.
  • 19. Why are we using Java? (Why arenā€™t we using Python?) ļ¬ Java is faster than Python ā€¢ We can do more operations in less time, so we can do more complicated media in less time. ļ¬ Java is more well-known than Python. ā€¢ So thereā€™s more ā€œresume valueā€ than Python. ļ¬ If you take more CS, itā€™ll probably be in Java. ā€¢ More CS classes are being taught now in Java than in other programming languages.
  • 20. General flow of book ļ¬ Introduction to Java ā€¢ Manipulation of pictures and sounds ā€¢ Manipulating music and turtles ļ¬ Using arrays, linked lists, and trees ā€¢ With music, pictures, and sounds ā€¢ Creating animations using arrays, lists, and trees ā€¢ Generalized linked lists and trees ļ¬ Creating simulations ā€¢ Predator/prey, disease propagation models, movement of people ā€¢ Different kinds of random ā€¢ Sorting our events ā€¢ Simulations with resources ā€¢ Resource queues ā€¢ Creating animations with simulations
  • 21. Things to do to get started ļ¬ Download and install JDK (Java Development Kit) ā€¢ http://www.java.sun.com ļ¬ Download and install DrJava ā€¢ http://www.drjava.org ļ¬ Download Jmusic ā€¢ http://jmusic.ci.qut.edu.au/ You need jmusic.jar and the inst instrument files ļ¬ Download the Java source files for class ā€¢ http://www.mediacomputation.org ļ¬ Then, tell Java where to find the JMusic and Java source files.
  • 23. Telling DrJava where to find Jmusic files
  • 25. Everything that has to be there ā€¢ Java-source ā€¢ Jmusic: inst folder, music.jar ā€¢ All jars in java-source
  • 26. Parts of DrJava Text of your class file (.java) Where you interact with Java List of class files that you have open

Editor's Notes

  1. Table (Matrix or Array), Organization chart (tree), Map (graph)
  2. Excel or Word does this for you (sort of). Computer tables can only grow at the bottom.
  3. DrJava will ask you for tools.lib first time. Should do this live (will see it in recitation, too). Mention: Common problem ā€“ copying files in from CD, but becoming READ ONLY.
  4. For JMusic, need jmusic.jar and inst/ folder
  5. For JMusic, need jmusic.jar and inst/ folder