Introduction to Programming Concepts & Logic

Slides:



Advertisements
Similar presentations
A Systems Approach To Training
Advertisements

DATA PROCESSING SYSTEMS
1 CS101 Introduction to Computing Lecture 17 Algorithms II.
Chapter 1 - An Introduction to Computers and Problem Solving
Lecture Notes 1/21/04 Program Design & Intro to Algorithms.
Introduction to a Programming Environment
Recursion Chapter 7. Chapter 7: Recursion2 Chapter Objectives To understand how to think recursively To learn how to trace a recursive method To learn.
Chapter 1 General Problem Solving Concepts
Lecture Notes 8/30/05 Program Design & Intro to Algorithms.
C OMPUTER P ROGRAMMING 1 Introduction to Programming.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Problem Solving Methodology
The Study of Computer Science Chapter 0 Intro to Computer Science CS1510, Section 2.
Introduction to Systems Analysis and Design Trisha Cummings.
Sw development1 Software Development 1.Define the problem (Analysis) 2.Plan the solution 3.Code 4.Test and debug 5.Maintain and Document.
Artificial Intelligence Lecture No. 15 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Planning for the Solution
Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.
Chapter 1 General Problem Solving Concepts
11 C H A P T E R Artificial Intelligence and Expert Systems.
Decision Making Mrs. Nations Introduction to Business and Technology.
Chapter 3: Completing the Problem- Solving Process and Getting Started with C++ Introduction to Programming with C++ Fourth Edition.
Introduction to problem solving. Introductory Discussion? What problems are you faced with daily? Do you think a computer can be designed to solve those.
Problem Solving with the Sequential Logic Structure Lesson 5 McManusCOP10061.
Program Development Life Cycle (PDLC)
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights ReservedAn Introduction.
E145/STS173 Case Study Tips E145/STS173 Case Study Tips Professors Tom Byers and Randy Komisar Stanford University With special thanks to: Jan Chong Copyright.
Lesson 3 McManus COP  You have to tell them ◦ what to do ◦ what to use ◦ in what order to do itand ◦ what to do if your user does not do what.
Computer Programming TCP1224 Chapter 3 Completing the Problem-Solving Process and Getting Started with C++
Programming Concepts Chapter 3.
CSIS 123A Lecture 9 Recursion Glenn Stevenson CSIS 113A MSJC.
WHS AP Psychology Unit 6: Cognition Essential Task 6-2: Identify problem-solving techniques (algorithms and heuristics) as well as factors that influence.
Introduction to Programming Concepts & Logic COP1006 with Dr. Meg McManus McManusCOP10061.
ALGORITHM List of instructions for carrying out some process step by step. A sequence of instructions which has a clear meaning and can performed with.
Definition of Terms Software/Programs Programs that directs the operation of a computer system Set of instructions Codes Programming Process of planning,
Structured Programming (4 Credits)
Lesson 5 McManus COP  Algorithm Instructions  Sequential Logic Structure  Solution Development McManusCOP10062.
The Art of Programming. The process of breaking problems down into smaller, manageable parts By breaking the problem down, each part becomes more specific.
How to Program? -- Part 1 Part 1: Problem Solving –Analyze a problem –Decide what steps need to be taken to solve it. –Take into consideration any special.
Introduction to problem solving.
How Are Computers Programmed? CPS120: Introduction to Computer Science Lecture 5.
A Brief History of AI Fall 2013 COMP3710 Artificial Intelligence Computing Science Thompson Rivers University.
Flowcharts C++ Lab. Algorithm An informal definition of an algorithm is: a step-by-step method for solving a problem or doing a task. Input data A step-by-step.
Clients/Faculty Advisors Dr. Eric Bartlett May01-14 Team Members David Herrick Brian Kerhin Chris Kirk Ayush Sharma Incremental Learning With Neural Networks.
Software. Introduction n A computer can’t do anything without a program of instructions. n A program is a set of instructions a computer carries out.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
1 Structured Programming Arab Academy for Science and Technology CC112 Dr. Sherif Mohamed Tawfik The Course.
CHAPTER 3 COMPLETING THE PROBLEM- SOLVING PROCESS AND GETTING STARTED WITH C++ An Introduction to Programming with C++ Fifth Edition.
Introduction to Problem Solving Programming is a problem solving activity. When you write a program, you are actually writing an instruction for the computer.
Problem Solving Techniques & Algorithm
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Problem Solving CSC 1750 Spring References Sprankle, Maureen and Jim Hubbard, Problem Solving and Programming Concepts, Eighth Edition, Prentice.
 Problem Analysis  Coding  Debugging  Testing.
COP1006 with Dr. Meg McManus McManus COP  Course Outline  Asthma & Allergies  Course Website  Tests  Assignments McManusCOP10062.
Advanced Higher Computing Science The Project. Introduction Worth 60% of the total marks for the course Must include: An appropriate interface using input.
Introduction to Programming Lecture 1 – Overview
JavaScript/ App Lab Programming:
ICS 3UI - Introduction to Computer Science
14 Compilers, Interpreters and Debuggers
Understand the Programming Process
Introduction to Problem Solving
Programming & languages
Introduction to Systems Analysis and Design
Problem Solving General Problem Solving Concepts
Understand the Programming Process
E145/STS173 Case Study Tips Professors Tom Byers and Randy Komisar
ICT Gaming Lesson 2.
CS104 Problem Solving and Programming
Hour of Code Code.org/lightbot
WRITING AN ALGORITHM, PSEUDOCODE, AND FLOWCHART LESSON 2.
Presentation transcript:

Introduction to Programming Concepts & Logic COP1000 4/22/2017 Introduction to Programming Concepts & Logic COP1000 Professor: Dr. Meg McManus McManus COP1000 COP1000_01

Introduction Course Outline Open Lab Asthma & Allergies Food Course Website Tests Assignments McManus COP1000

Puzzles, anyone? Do you Suduku? McManus COP1000 COP1000 4/22/2017 Research shows that doing puzzles (or games) improves significantly your ability to be a successful programmer. Why? Because by solving a puzzle, you are solving a problem, and that’s what programming is all about…solving a problem using a computer-assisted solution. So, game on! McManus COP1000 COP1000_01

Why Programming? We encounter problems every day. COP1000 4/22/2017 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. Every day we encounter all sorts of problems. What am I going to wear today? Where am I going to go to lunch? Am I going to get up enough nerve to ask the cute girl in the 2nd row out on a date? These are all problems we encounter, but organizations are faced with different sets of problems. These problems take the form of solving payroll problems. Ex. What is the Net Pay for Employee X based on Hours Worked and Pay Rate? To solve these kinds of problems, we have to learn to think not the way we’re used to thinking, but, instead, we have to learn to think the way the computer thinks. We cannot skip steps in our solutions, because the computer would not understand. McManus COP1000 COP1000_01

General Problem-Solving Concepts COP1000 4/22/2017 General Problem-Solving Concepts Lesson 1 The following are general problem-solving concepts that all programming students should understand and follow when developing programs. McManus COP1000 COP1000_01

6 Steps in Problem Solving COP1000 4/22/2017 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 Identifying the problem (or the Requirements part of the Software Life Cycle) is where we learn about the problem from the client’s perspective. If you can’t restate the problem, how are you ever going to build a program to solve the client’s problem? It’s kind of like Algebra problems. Solve for X…when presented with an equation, if you don’t know how to go through the steps to solve the problem, how are you going to come up with the correct answer? An all to obvious example is giving someone directions. If you give the person the instruction Go North 1 mile and the person doesn’t know which direction North is, how effective are your instructions going to be for that person? Likewise, if you tell the person to go to Beal Parkway and turn left, and the person doesn’t know where Beal Parkway is, you have not helped the person. McManus COP1000 COP1000_01

6 Steps in Problem Solving COP1000 4/22/2017 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. Understanding the problem is next… Being able to restate is one way you can verify that you understand the “what” you will be doing, but you have to understand the problem, too. One way to figure out the problem is to perform research on the problem. Another method is through observing the client do what they do without the computer-assisted solution that you’re going to develop for them. By observing what they are doing, you can better understand the problem and thus, create a better designed solution that will serve the client’s needs. Another method is to review past activities of the client. This will give you a historical perspective of what the client has been doing and what they want to change about the way they are doing things. McManus COP1000 COP1000_01

6 Steps in Problem Solving COP1000 4/22/2017 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 Next comes solving the problem, but not just solve it one way and you’re done. This is usually called doing the “down and dirty” method and usually results in bad code. By creating multiple solutions to your problem, you can evaluate the different solutions to find the one best for your particular problem. Different aspects to look at include efficiency of the code, the speed of the code (not always the most important aspect), obviously the accuracy of the code (it should work correctly) and the acceptability of the code (by the client/user). Other factors to consider include the maintainability and reusability of the code—factors that have become more important in programming in the large environments. Don’t just find one solution and stop there. Rarely is it the best solution…especially for novice programmers… McManus COP1000 COP1000_01

6 Steps in Problem Solving COP1000 4/22/2017 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 Next, you need to select the best solution from the alternatives by establishing the criteria by which you’re going to evaluate your solutions. Create a list of pros and cons for each solution and evaluate how pro or how con is each. The select the best solution based upon your research. McManus COP1000 COP1000_01

6 Steps in Problem Solving COP1000 4/22/2017 6 Steps in Problem Solving List instructions that enable you to solve the problem using the selected solution. Create a numbered, step-by-step set of instructions Instructions must be included in the knowledge base… So, what’s a knowledge base? Next, you need to list the instructions that will solve your problem. But, it’s not just about the list of instructions. You also have to know what your users will know. This is the knowledge base. So…what’s a knowledge base? A knowledge base is a list of what the user needs to know before the user can complete the instructions you’ve created in your computer-aided solution. In other words, if I create a program that give directions to find a location for users using North, South, East and West, and they don’t know where they are with relation to the compass, my program will be worthless to them. Similarly, if I give them street addresses and they don’t know the name of the streets, again the program will be useless to them. You have to be aware of your users knowledge base or establish one for them, before they can successfully use your program. McManus COP1000 COP1000_01

6 Steps in Problem Solving COP1000 4/22/2017 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? Finally, evaluate the solution. Make sure the solution Is accurate Solves the right problem Satisfies the needs of the client/user Is acceptable to the user Comes in under budge and within the time constraints of the contract with the client Solves the original problem without embellishments McManus COP1000 COP1000_01

2 Types of Problems Algorithmic Solutions COP1000 4/22/2017 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. So what types of problems do we deal with “usually”? Most of the problems that we create for computers are algorithmic solutions. Algorithmic Solutions are a set of instructions that will be followed each time the program is run. Calculating a payroll problem is an example of an algorithmic solution. McManus COP1000 COP1000_01

2 Types of Problems Heuristic Solutions COP1000 4/22/2017 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. Heuristic Solutions, on the other hand, create different solutions each time the program is run. Calculating an appropriate stock to purchase is an example of a heuristic problem because what is appropriate one minute may not be in the next minute. Artificial Intelligence programs use heuristic computer-aided solutions. McManus COP1000 COP1000_01

Solutions The instructions that will result in the best solution. COP1000 4/22/2017 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 Solutions, then, are the result of our research and coding creating the best solution for the particular problem being solved. Each solution may be: More efficient More or less faster than another solution More understandable More maintainable (a definite plus) More reusable (preferred) McManus COP1000 COP1000_01

Results The outcome of the program May take any form: COP1000 4/22/2017 Results The outcome of the program Or the completed computer-assisted answer… May take any form: Printout Updated files Output to monitor, speakers, etc. The results of the process is the computer-aided (or assisted) solution to the problem. Results may take the form of: Printouts Updated files or databases Outputs sent to monitors, speakers, hard drives, etc. McManus COP1000 COP1000_01

COP1000 4/22/2017 The Program The set of instructions that make up the solution after they have been coded into a particular computer language. 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! The program is the set of instructions that make up the solution after they have been coded into a particular computer language. Although we won’t be actually writing programs, at least not in any specific language, we will be researching the problems, designing the solutions, creating the algorithms, and writing out the solution in pseudocode! McManus COP1000 COP1000_01

Steps in Building a Program COP1000 4/22/2017 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 So the basic steps in building a program include: Understanding the problem Developing the algorithms to solve the different components of the problem Writing the program (in a particular language appropriate to the problem) Writing the documentation for both other programmers/maintainers/testers (internal documentation) and the users/system administrators (external documentation) Debugging the solution by the programmer Testing the solution—preferably by anyone other than the programmer McManus COP1000 COP1000_01

So? What are the Problems? Humans! McManus COP1000

Difficulties in Problem Solving? COP1000 4/22/2017 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 Finally, are there difficulties that humans have in creating computer programs? Of course! We’re used to thinking quickly and heuristically. Computers can’t think that way. So, humans have to learn to think differently to create programs that will be useful to their users. These changes include: Changing the way we think Working through the problem completely Following a logical sequence of steps Not making hasty decisions Not making haphazard evaluations of potential solutions McManus COP1000 COP1000_01

Next? Lesson 2! McManus COP1000