Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 111 – Oct. 20 Most essential skill in IT: problem solving using the computer –Telling the machine exactly what we want it to do. –Also: making sure.

Similar presentations


Presentation on theme: "CS 111 – Oct. 20 Most essential skill in IT: problem solving using the computer –Telling the machine exactly what we want it to do. –Also: making sure."— Presentation transcript:

1 CS 111 – Oct. 20 Most essential skill in IT: problem solving using the computer –Telling the machine exactly what we want it to do. –Also: making sure result of software is packaged in a way that ordinary people will understand. Problem solving procedure What does a solution look like? Learn by example, and generalize. Commitment: –Please read carefully sections 5.1 and 5.2

2 Why software? Want computational power –To have direct control of machine –Sometimes, existing software is not sufficient, doesn’t give what you want –Programs can be useful or fun for people to use (e.g. game, converting data to image, …) Need to use a computer language –E.g. Javascript, PHP, Python, C++, etc. –Machine independent –Many common calculations are pre-defined, such as sorting, opening files, surfing the Web, creating a form button, etc.

3 Program One specimen of software is called a computer program Small or large, purpose is to solve 1 problem. Works like a recipe –List of necessary ingredients –List of instructions for CPU to obey. A simple program normally has 3 phases. –Input –Calculations –Output

4 Recipes Cooking may be a good analogy, because it solves the problem “I’m hungry” What do we see in recipes? Here’s one: –Brown the beef 15 min. Drain grease. –Dice carrot, celery, onion (aka mirepoix) –Cut up and boil 6 potatoes until soft. –Mash potatoes –Add flour, spices, sauce, mirepoix to beef. –Put meat mixture into casserole; top with potatoes. –Bake in oven at 400 for 30 minutes.

5 Recipes (2) A computer program has some of the same elements as a recipe. In recipes, we see: –Ingredients (the “nouns” of the problem) –Steps to perform (the “verbs”) –In some steps, we continue/wait for something –Sometimes we check things Are potatoes fully mashed? Should I add more _____ to the mixture?

6 Recipes inside recipes But we don’t eat the same stuff every day. Once we know a few recipes, we can put together a menu for choices. if (have all ingredients), make Shepherd’s pie. if (no potatoes), just make soup instead. if (no veggies), make hamburger. if (no beef), make pasta. When you view a whole menu as a program, then “making soup” becomes a sub-program. –A large program is composed of several parts. –In industry, sometimes each part is implemented by different people, like a kitchen having many chefs.

7 Problem-solving 1.Understand problem; inputs and outputs 2.Write solution in English “pseudo-code” 3.Write code in a programming language 4.Compile 5.Run and test When program works, can refine or generalize.


Download ppt "CS 111 – Oct. 20 Most essential skill in IT: problem solving using the computer –Telling the machine exactly what we want it to do. –Also: making sure."

Similar presentations


Ads by Google