introduction to programming concepts & logic cop1000 professor: dr. meg mcmanus mcmanuscop10001
TRANSCRIPT
![Page 1: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/1.jpg)
COP1000 1
Introduction to Programming Concepts & Logic
COP1000Professor: Dr. Meg McManus
McManus
![Page 2: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/2.jpg)
COP1000 2
Introduction
• Course Outline• Open Lab• Asthma & Allergies• Food• Course Website• Tests• Assignments
McManus
![Page 3: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/3.jpg)
COP1000 3McManus
Puzzles, anyone?
Do you Suduku?
![Page 4: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/4.jpg)
COP1000 4
Why Programming?
• We encounter problems every day.• Programs are simply solutions to
problems.• Puzzles are simply a
solution to a problem• To create programs• We have to learn to think
a different way…• The way computers think.McManus
![Page 5: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/5.jpg)
COP1000 5
General Problem-Solving Concepts
Lesson 1
McManus
![Page 6: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/6.jpg)
COP1000 6
6 Steps in Problem Solving
1. Identify the problem– If you don’t know what the problem is,
you can’t create a solution for it.– Ex. Calculate Payroll for 10 Employees– Ex. Provide directions
McManus
![Page 7: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/7.jpg)
COP1000 7
6 Steps in Problem Solving
2. Understand the problem– Clients rarely completely
understand what they want let alone how to tell you.
– Perform • Research - to form your own
knowledge base• Observations by
– Watching current activity– Reviewing past activities
• Ex. Giving instructions to someone on how to find an address.McManus
![Page 8: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/8.jpg)
COP1000 8
6 Steps in Problem Solving
3. Identify alternative ways to solve the problem.– Rarely does a problem have only one
solution. – Look at
• Efficiency• Speed• Accuracy• Acceptability
McManus
Don’t just find one solution and stop there. Rarely is it the best solution…especially
for novice programmers…
![Page 9: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/9.jpg)
COP1000 9
6 Steps in Problem Solving
4. Select the best way to solve the problem from the list of alternative solutions.– Establish criteria to help when
performing evaluations on each alternative
– Include pros and cons for each solution – Select the best solution based
on the research
McManus
![Page 10: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/10.jpg)
COP1000 10
6 Steps in Problem Solving
5. List instructions that enable you to solve the problem using the selected solution.
1. Create a numbered, step-by-step set of instructions
2. Instructions must be included in the knowledge base…So, what’s a knowledge base?McManus
![Page 11: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/11.jpg)
COP1000 11
6 Steps in Problem Solving
6. Evaluate the solution.– Test the solution
• Are the results accurate?• Does it satisfy the needs of the client?• Is it acceptable to the client?• Does the solution solve the original
problem?
McManus
![Page 12: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/12.jpg)
COP1000 12
2 Types of Problems
• Algorithmic Solutions– Steps involved in following a
set of instructions.• Ex. Calculating your checkbook
balance– The solution will be the same
each time the algorithm is followed.
– Most computers use algorithmic types of problems.
McManus
![Page 13: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/13.jpg)
COP1000 13
2 Types of Problems
• Heuristic Solutions– Solutions that can’t be reached by
following a direct set of steps.• Created by using reasoning built upon
knowledge and experience…and by trial and error.
• Ex. Determining which stock is the best value
– The results may not produce the same results each time the algorithm is executed.
– Artificial intelligence deals with heuristic types of problems.
McManus
![Page 14: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/14.jpg)
COP1000 14
Solutions
• The instructions that will result in the best solution. – Again, the result may
• Be more Efficient• Be Faster• Be more Understandable• Be more Maintainable• Be Reusable
McManus
![Page 15: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/15.jpg)
COP1000 15
Results
• The outcome of the program– Or the completed
computer-assisted answer…• May take any form:
– Printout– Updated files– Output to monitor,
speakers, etc.
McManus
![Page 16: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/16.jpg)
COP1000 16
The Program
• The set of instructions that make up the solution after they have been coded into a particular computer language.
McManus
Although we won’t be actually writing programs, at least not in
any specific language, this is what we will be working toward
throughout this course!
![Page 17: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/17.jpg)
COP1000 17
Steps in Building a Program
• Understanding the problem (What does it mean?)
• Developing an algorithm (what is the solution to the problem)
• Writing the program (by the programmer, including internal commenting)
• Documenting (external) the program (for the user/system administrator)
• Testing and debugging the program – Testing - by anyone other than the programmer– Debugging - by the programmer
McManus
![Page 18: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/18.jpg)
COP1000 18
So? What are the Problems?
Humans!
McManus
![Page 19: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/19.jpg)
COP1000 19
Difficulties in Problem Solving?
• Humans must– Change the way we think– Work through the problem
completely– Follow a logical sequence of
steps– Not make hasty decisions– Not make haphazard
evaluations of potential solutions
McManus
![Page 20: Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManusCOP10001](https://reader036.vdocuments.net/reader036/viewer/2022081514/56649e4f5503460f94b4607b/html5/thumbnails/20.jpg)
COP1000 20McManus
Next?