1 / 30

Introduction to Programming

Introduction to Programming. Doman’s Lecture CSCI101 . What is programming?.

akina
Download Presentation

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. Introduction to Programming Doman’s Lecture CSCI101

  2. What is programming? A deep understanding of programming, in particular the notions of successive decomposition as a mode of analysis and debugging of trial solutions, results in significant educational benefits in many domains of discourse, including those unrelated to computers and information technology per se. (Seymour Papert, in "Mindstorms")

  3. What is programming? Programming is a creative process done by programmers to instruct a computer on how to do a task. (http://cplus.about.com) Writing an original program that performs a particular task that meets all stated constraints (Think Like a Programmer, V.AntonSpraul, No Starch Press, Inc. 2012)

  4. What is programming? A lot of this lecture is taken from the book: Think Like a Programmer, By V.AntonSpraul, No Starch Press, Inc. 2012

  5. Instruct a computer Example: html <html> <body> <p> Hello World </p> </body> </html>

  6. Instruct a computer Method or interface to do this: PROGRAMMING LANGUAGES Example: Java: Public class helloWorld { Public static void main ( ) { system.out.println(“Hello World”) } }

  7. Instruct a computer Example: C++ #include<iostream> using namespace std; int main() { cout << “Hello World” << endl; }

  8. Instruct a computer GAMEMAKER Drag and drop structured language Uses icons, text…. Made to be easier than any of the previous languages.

  9. What is programming? Programming is a creative process done by programmers to instruct a computer on how to do a task. (http://cplus.about.com) Writing an original program that performs a particular task that meets all stated constraints (Think Like a Programmer, V.AntonSpraul, No Starch Press, Inc. 2012)

  10. What is programming? Puzzles Problem solving

  11. Problem Solving Your car has blue smoke coming from the tailpipe, is idling roughly and has lost fuel efficiency. How do you solve it?

  12. Constraints • Unbreakable rules about problems or the way in which problems must be solved. • Car problem constraints: • Cost of repair • How long before you need it fixed • No new tools be purchases

  13. Common Programming Constraints Programming language Platform Performance Memory footprint User/customer specific constraints Design constraints.

  14. Problem solving Figure out the steps to take to solve the problem Be able to list the steps Be able to repeat the steps You can NOT change the rules (constraints) to get something solved!

  15. Puzzle: Fox, goose, grain Problem: How to cross the river? A farmer with a fix, a goose and a sack of corn needs to cross a river. The farmer has a rowboat, but there is only room for the farmer and one of his three items. Unfortunately, both the fox and the goose are hungry. The fox cannot be left alone with the goose; the goose cannot be left alone with the grain. How does the farmer get everything across the river?

  16. Puzzle: Fox, goose, grain • Constraints • Only one item at a time in the boat • Can’t leave fox with goose • Can’t leave goose with grain • Operations • Carry the fox to the far side of the river • Carry the goose to the far side of the river • Carry the grain to the far side of the river

  17. Puzzle: Fox, goose, grain

  18. Rephrase the problem • Abstract the problem • Be more general in describing the way we will solve the problem • Concept: Variable Items are fox, goose or grain Let item vary between fox, goose or grain

  19. Puzzle: Fox, goose, grain • Constraints • Only one item at a time in the boat • Can’t leave fox with goose • Can’t leave goose with grain • Operations • Row the boat from one shore to the other • If the boat is empty, load an item on the boat • If the boat is full, take the item off the boat

  20. Puzzle: Fox, goose, grain

  21. Puzzle: Sudoku

  22. Divide the problem Do one row, column, or square first

  23. Solve the easiest part first Pick the square, row, or column with most data filled in.

  24. THINK like a programmer! Problem Solving • Have a plan • Generalize the problem • Restate the problem • Start with what you know • Divide the problem • Look for analogies or patterns • Experiment!!!

  25. Software Terminology • Programming: • turning an algorithm into an English-like language the computer can understand • there are lots of programming languages • also know as "coding" • Debugging: • Testing the software to find and remove errors

  26. Software Terminology • Algorithm: • set of steps that describe what the program must do • written in English

  27. Conditionals Do until Do while If something is true, then do something else

  28. Try it! • http://blockly-demo.appspot.com

  29. Introduction to gamemaker Tutorial is due in two weeks

  30. Test 2 NEXT WEEK

More Related