Wikijunior:Programming for Kids/Knowing Your Problem

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Wikijunior:Programming for Kids
What is Programming? Knowing Your Problem Designing Your Solution

The first step to successful programming is getting to know your problem. As a Chinese saying goes, 'if you know yourself and know your opponent, for every hundred battles you fight, you will win a hundred.'

Identifying Your Problem[edit | edit source]

You cannot just dive into programming without first having a clear picture of what you want to do. To do this, you need a precise definition of your problem. This can be done by asking yourself questions (enquiry) and brainstorming.

Let's say you want to make a piece of software to create simple vector graphics. You may want to ask yourself questions like these:

  • What kind of graphics will the software create?
  • In which format(s) (EPS, WMF, SWF, SVG...) will the graphics be?
  • If the graphics will follow a certain standard, what kind of templates should I provide to the user?
  • At what kind of users am I aiming?

When you are answering these questions, you should look at the problem from the end user's angle. You are programming for your end user, so you should understand her needs. Here are some sample answers for the above questions:

  • It will create 3-D graphics for various solids in mathematics.
  • They will be stored in the SVG format as it is an open and XML-based format, but also allow conversion from AI, CRD and other non-open file formats.
  • I will provide the most common solids, such as spheres, Platonic solids, prisms and pyramids.
  • I am aiming at people with little experience with computers.

Your problem is thus:

  • I want to create a piece of software which generates 3-D vector graphics for mathematical solids as SVGs. The software will be a WYSIWYG image editor as I am aiming at non-technical people.

Analysing Your Problem[edit | edit source]

Once you know where you're heading, you need to take another look at the problem. In computer programing, problem analysis means identifying the inputs, outputs and processes of your program. Using Tetris as an example, let's construct an Input-Process-Output Chart (IPO chart):

Inputs Processes Output
  • Direction in which bricks move
  • Direction in which bricks rotate
  • Whether the bricks should fall faster
  • Identify the button pushed by the player
  • Rotate or move the brick accordingly
  • Brick at the bottom of the screen

What's Next?[edit | edit source]

Having identified and analysed our problem, we need to go to the next stage of problem-solving: designing our solution.