16
CS 100 Introduction to Computing Seminar September 21, 2015

CS 100 Introduction to Computing Seminar September 21, 2015

Embed Size (px)

Citation preview

Page 1: CS 100 Introduction to Computing Seminar September 21, 2015

CS 100 Introduction to Computing Seminar

September 21, 2015

Page 2: CS 100 Introduction to Computing Seminar September 21, 2015

Let's Review the Homework

Page 3: CS 100 Introduction to Computing Seminar September 21, 2015

What Can a Computer Do?

1. A computer can receive or accept data (input)

2. A computer can store data in a memory device

3. A computer can perform arithmetic operations/instruction and data manipulation operations/instructions

4. A computer can select one of some number of alternatives based upon some decision criteria

5. A computer can repeat a group of operations/instructions

6. A computer can output information

Page 4: CS 100 Introduction to Computing Seminar September 21, 2015

What Are The Steps In Developing a Program?

1. Determine the desired output(s)

2. Determine the necessary input(s)

3. Develop an algorithm

A. Select the ordered, atomic steps necessary to transform the necessary input(s) into the desired outputs

B. Check the algorithm by hand for correctness

4. Use the algorithm to guide development of source-code using a programming language (we will use C)

A. Test and troubleshoot every algorithmic step

B. Document (comment) as source-code is being developed

5. Test and troubleshoot the entire program

Page 5: CS 100 Introduction to Computing Seminar September 21, 2015

Designing a Program

• Programs must be designed before they are written

• Program development cycle: Design the program Write the code Correct syntax errors Test the program Correct logic errors

Page 6: CS 100 Introduction to Computing Seminar September 21, 2015

Designing a Program (cont’d.)

• Design is the most important part of the program development cycle

• Understand the task that the program is to perform Work with customer to get a sense what the

program is supposed to do Ask questions about program details Create one or more software requirements

Page 7: CS 100 Introduction to Computing Seminar September 21, 2015

Designing a Program (cont’d.)

• Determine the steps that must be taken to perform the task Break down required task into a series of steps Create an algorithm, listing logical steps that

must be taken

• Algorithm: set of well-defined logical steps that must be taken to perform a task

Page 8: CS 100 Introduction to Computing Seminar September 21, 2015

Pseudocode

• Pseudocode: fake code Informal language that has no syntax rule Not meant to be compiled or executed Used to create model program

No need to worry about syntax errors, can focus on program’s design

Can be translated directly into actual code in any programming language

Page 9: CS 100 Introduction to Computing Seminar September 21, 2015

Flowcharts

• Flowchart: diagram that graphically depicts the steps in a program Ovals are terminal symbols Parallelograms are input and output symbols Rectangles are processing symbols Symbols are connected by arrows that

represent the flow of the program

Page 10: CS 100 Introduction to Computing Seminar September 21, 2015
Page 11: CS 100 Introduction to Computing Seminar September 21, 2015

Problem Solving Acording toGeorge Polya

1. Understand the problem (and the audience)

• Are you building a chair?

• Need directions to a location?

• Making popcorn?

• Trying to solve a puzzle?

2. Devise a plan

• Is this similar to something else?

• Who is the audience for the solution?

• What are the required steps (need gruesome detail)?

Page 12: CS 100 Introduction to Computing Seminar September 21, 2015

Problem Solving According to George Polya

3. Carry out the plan (implement)

• Does it work?

• Is each step correct? Necessary?

4. Is the solution accurate? (Correct?)

• Will it always lead to a solution?

Page 13: CS 100 Introduction to Computing Seminar September 21, 2015

Let's Talk About Algorithms

• An algorithm is an ordered set of unambiguous, atomic, executable steps, defining a terminating process.

– [1] an ordered set?

– [2] unambiguous?

– [3] atomic?

– [4] executable steps?

– [5] defining a terminating process?

Page 14: CS 100 Introduction to Computing Seminar September 21, 2015

Why Are Algorithms Important?

• Easier to understand what is to be accomplished

• Easier to find errors and fix them

• Algorithms are independent of H/W and S/W

• Algorithms guide our "program development" because they act as a detailed guide or blueprint or GPS guided roadmap

http://userpages.wittenberg.edu/bshelburne/Comp150/Algorithms.htm

Page 15: CS 100 Introduction to Computing Seminar September 21, 2015

Let's Develop Some Algorithms

Page 16: CS 100 Introduction to Computing Seminar September 21, 2015

Pseudocode

• Pseudocode:http://www.minich.com/education/wyo/stylesheets/

pseudocode.htm

http://www.wiley.com/college/busin/icmis/oakman/outline/chap05/slides/pseudo.htm

http://www.unf.edu/~broggio/cop2221/2221pseu.htm

http://userpages.wittenberg.edu/bshelburne/Comp150/Algorithms.htm