1 / 73

An “enjoyable” introduction to Programming

An “enjoyable” introduction to Programming. Dr. Jeyakesavan Veerasamy The University of Texas at Dallas, USA Email: jeyv@utdallas.edu Alice 2.2 Software: www.alice.org Examples: www.utdallas.edu/~jeyv/alice. What is programming?. Developing applications & games

helen
Download Presentation

An “enjoyable” introduction to Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An “enjoyable” introduction to Programming Dr. Jeyakesavan Veerasamy The University of Texas at Dallas, USA Email: jeyv@utdallas.edu Alice 2.2 Software: www.alice.org Examples: www.utdallas.edu/~jeyv/alice

  2. What is programming? • Developing applications & games • Software is not limited to PC • most complex systems run software • smart phones, game devices, even DVD players

  3. 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.

  4. 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!

  5. Learning to ride bicycle • Difficulties for beginners: • Difficulties for experienced folks:

  6. Learning to ride bicycle • Difficulties for beginners: • Learning to balance & go forward together • Difficulties for experienced folks: • None.

  7. Solution for beginners • Training wheels • Helmet • Makes learning enjoyable and safe! • Similar difficulties are there while learning to program in a computer.

  8. Learning to program:Difficulties for beginners

  9. Learning to program:Difficulties for beginners • Syntax errors • struggle for hours to fix syntax errors • Loose confidence • Frustrating experience • Run away & never come back if possible! 2. Logic errors Not a serious issue.

  10. Difficulties for experienced programmers Logic errors Continuous learning

  11. Learning to program • 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 & CS major. Both are NOT good  • It is possible to do much better!

  12. Solution • Visual Programming Tools to teach programming concepts without encountering syntax errors. • Focus on the logic first & build confidence.

  13. Free Visual Programming Tools

  14. Sample program in Snap 4.0

  15. Program Output

  16. Programming Concepts

  17. A few examples • Recipe to make your favorite food • Assembly instructions for a toy • Coming to college from home What is common about these activities?

  18. A few examples • Recipe to make your favorite food • Assembly instructions for a toy • Coming to college from home What is common about these activities? Sequence

  19. Programming concepts:Sequence structure instruction 1; instruction 2; instruction 3; …

  20. A few more examples • Study at home or play cricket with friends? • Eat Parotta or Poori? • Go to Vijay’s movie or Karthik’s movie? • Go to job or go for higher studies? What is the common thing here?

  21. A few more examples • Study at home or play cricket with friends? • Eat Parotta or Poori? • Go to Vijay’s movie or Karthik’s movie? • Go to job or go for higher studies? What is the common thing here? Selection

  22. Selection structure IF condition is true THEN do this; ELSE do that; ENDIF

  23. A few more examples • Eat chips from a packet • Go on a shopping spree with lot of cash! • Take an exam that has several questions What is the common thing here?

  24. A few more examples • Eat chips from a packet • Go on a shopping spree with lot of cash! • Take an exam that has several questions What is the common thing here? Repetition

  25. Repetition structure WHILE (more items to process) process the next item; ENDWHILE FOR month = 1 to 12 do monthly processing ENDFOR

  26. Programming Concepts • Structures: Sequence, Selection & Repetition • Foundation for Programming • Every complex program is only a combination of these structures.

  27. More things we do… • Use a box to move lots of things from one room to another • Carry a pack of candies to class on your birthday! • What is the common thing here?

  28. More things we do… • Use a box to move lots of things from one room to another • Carry a pack of candies to class on your birthday! • What is the common thing here? Collection / Arrays

  29. Arrays • enable us to store data of similar type together. • enables us to handle varying size data. • Lines of code do not increase with more data! FOR each item in array add item to total ENDFOR

  30. Even more things we do… • Get phone call when you are driving a car • Friend knocks on the door when you are watching a movie • What is the common thing here?

  31. Even more things we do… • Get phone call when you are driving a car • Friend knocks on the door when you are watching a movie • What is the common thing here? Interrupts / events

  32. Event driven programming • Suspend current processing to process the event, or process it in parallel. • “Regular” processing flow & separate processing routine for each event.

  33. Object Oriented Programming (OOP) • Models the real-world better • Concepts learned from the manufactoring industry

  34. Hands-on Introduction to Alice It is a good idea to save each program separately so that you can go back and review later.

  35. Purpose of Alice • Enjoyable introduction to Programming • Natural introduction to OOP • Learning to program with training wheels • Stepping stone to learn more serious languages (C/C++/Java)

  36. Alice environment • World • Gallery • Scene Setup • Adding objects • Working with objects • Similar to Scene setup in move-making • Every object needs to be in starting position

  37. Methods & Actions • You are welcome to play along with me. • Add one object • Test out various movements (moves in 6 directions, turns in 4 ways & roll in 4 ways) • Add one more object • Test out relative movements

  38. Program #1: Choose your favorite object from the gallery and test various methods. 10 minutes?

  39. Our first program! • Sequence structure • do a few interesting actions!

  40. Program #2: Make your object do a few funny actions! 10 minutes?

  41. Program #3 • Introduce multiple objects • do a few interesting actions!

  42. Program #3: Make your objects do a few funny actions! 15 minutes?

  43. Program #4 • Use DO TOGETHER structure • Add realism & sophistication!

  44. Program #4: Use DO TOGETHER to do multiple things at same time! 15 minutes?

  45. Program #5 • Add Vehicles/Seaplane from local gallery. • Make it do loop the loop. • Use DO TOGETHER structure • seaplane move forward • seaplane turn backward • seaplane’s propeller roll right • Use “style = abruptly” to make the motion smooth 

  46. Program #5: Use DO TOGETHER to make the plane do loop the loop! 20 minutes?

  47. Program #6 • Introduce repetition – counted loop • do a few interesting actions!

  48. Program #6: Make your objects do a few funny actions multiple times! 10 minutes?

  49. Program #7 • How to do realistic walking? • Leg & body movements • Better to do with a human object from “People/Walking People” • Write your own methods.

  50. Program #7: Practice human walking/running animation 15 minutes?

More Related