enjoyable_programmin..

An “enjoyable” introduction to
Programming
Dr. Jeyakesavan Veerasamy
University of Texas at Dallas, USA
[email protected]
What is programming?
• Developing applications & games
• Software is not limited to PC
– most complex systems run software
– smart phones, game devices, even DVD players
Programming …
• is NOT a boring or repetitive activity
• does NOT require you to sit in dark room and
type in computer all day!
• does NOT involve complex Math
• requires logical thinking – technical common
sense
• write minimal code & combine with existing
components to build new applications
• Solve customers’ problems & improves quality
of life for every one.
Why learn programming?
• Software Engineers get great pay!
• Less stressful compared to several other high
paying jobs
• Automation continues…
• Computer touches our lives more & more
every day…
• More component based programming 
always room for simple programs to do large
tasks!
Learning to ride bicycle
• Difficulties for beginners:
• Difficulties for experienced folks:
Learning to ride bicycle
• Difficulties for beginners:
– Learning to balance & go forward together
• Difficulties for experienced folks:
– None.
Solution
• Training wheels
• Helmet
• Makes learning enjoyable and safe!
• Similar difficulties are there while learning to
program in a computer.
Learning to program
• We have similar challenges.
• Most students try to learn syntax and logic
together, waste lot of hours and get confused
& frustrated.
• Indian students resort to memorization of
programs. US students run away from
programming. Both are NOT good 
• It is possible to do much better!
Solution
• Visual Programming Tools to teach
programming concepts without encountering
syntax errors
• Focus on the logic first & build confidence.
Free Visual Programming Tools
Tool
Alice 2.2
Provider
Web-site
Scratch
Carnegie Mellon www.alice.org
University, USA
MIT, USA
scratch.mit.edu
Snap!
UCBerkeley, USA byob.berkeley.edu
Lego MindStorm
Lego, USA
Several more…
mindstorms.lego.com
Sample program in Snap 4.0
Program Output
Programming Concepts
A few examples
• Recipe to make your favorite food
• Assembly instructions for a toy
• Coming to school from home
What is common about these activities?
Programming concepts:
Sequence structure
instruction 1;
instruction 2;
instruction 3;
…
A few more examples
•
•
•
•
Bike to school or walk?
Become a doctor or programmer?
Do homework or play?
Eat Poori or Chapathi?
What is the common thing here?
Selection structure
IF condition is true THEN
do this;
ELSE
do that;
ENDIF
A few more examples
• Go on a shopping spree with lot of cash!
• Take an exam that has several questions
• Eat chips from a packet
What is the common thing here?
Repetition structure
WHILE (more items to process)
process the next item;
ENDWHILE
FOR month = 1 to 12
do monthly processing
ENDFOR
Programming Concepts
• Control Structures: Sequence, Selection &
Repetition
• These are 3 pillars of Programming.
• Every complex program is only a combination
of these structures.
Purpose of Alice
• Enjoyable introduction to Programming
• Learning to program with training wheels
• Stepping stone to learn more serious
languages (C/C++/Java)
• Natural introduction to Object Oriented
Programming
Hands-on Introduction to Alice
It is a good idea to save each
program separately so that you can
go back and review later.
Alice environment
• World
• Gallery
• Creating the initial scene
– Adding objects
– Working with objects
Alice Examples
•
•
•
•
Sequence
Selection
Repetition/loop
Parallel actions
Alice Examples …
•
•
•
•
Modules
Arrays
Event based programming
Games
References
• Alice website: www.alice.org
• Textbook: Learning to Program with Alice by
Wanda Dann, Steve Cooper and Randy Pausch
ISBN: 0-1318-7289-3
• Ebook: http://www.dickbaldwin.com/tocalice.htm
• My presentation & examples:
www.utdallas.edu/~jeyv/alice
Questions & Answers
Dr. V. Jeyakesavan
[email protected]