Skip to main content

Computer Programming: steps to set up program

Computer programming is explaining a solution to a problem.

On a human level, we look at a problem and identify what we have and what we want. Then we figure out how to get from one to the other.

Programming a computer to solve a problem always requires defining data to represent the things in your problem; this is called modeling. It also requires explaining unambiguously what process to follow in order to solve the problem. This process of explaining is where different paradigms of programming come in:

  • Evaluation and substitution. These are the basic algebra skills that programs are built on, and that programmers mentally fall back on when trying to figure out why a program isn't behaving as expected.
  • Modeling. Information is complex; solving problems with the computer (or with math) always somehow involves defining and using data to represent information from the problem.
  • Managing complexity: Breaking problems and solutions down into chunks that can be understood easily. Abstraction  is the main tool for this.
  • Communication. In at least two ways, this is important: (1) Determining what your clients want, so you are solving the right problems. (2) Organizing and documenting your work so that you (or the next programmer to touch it) will be able to understand it, months or years later.
  • Patience and perseveration. When things aren't working right, there's usually something you haven't noticed. Learning what that something is often requires mentally retracing your steps, and manually re-running code on different inputs, until you see what you've been missing. This may take a while.
  • Discipline. Writing tests and specifying what work must be done are both decidedly unsexy tasks, but they both make your work easier and give you confidence that you've done your work correctly.

  • Steps involved in Computer Programming -

    • Definition of the problem (involves definition of the input/output data associated with the problem, what sort of input shall be provided and what would be the expected output)
    • Planning of the solution (developing flow charts / algorithms to solve the problem)
    • Coding the program (Expressing the solution through instructions, written in a programming language)
    • Testing the program (Translation of the source program into executable form and debugging, which involves locating and correcting errors)
    • Documentation (It is a written detailed description of the programming cycle and specific facts about the program. Typical program documentation materials include the origin and nature of the problem, a brief narrative description of the program, logic tools such as flowcharts, algorithms, data-record descriptions, program listings, and testing results. Comments in the program itself are also considered an essential part of documentation.)


STEPS IN WRITING A PROGRAM

1. Understand the specific reason to write a program So, before we embark on our programming journey, we should understand what is the reason behind writing a program. Is it to calculate the area of a rectangle, or convert fahrenheit to celsius, or place a rocket at a particular orbit, or predict the weather for a particular day. Understand clearly the reason for writing the program. There should not be any ambiguity at all.

2. Know what are the inputs I have already told you that, every program takes some input, processes the input and produces some output. Understand what the inputs are for the program you are writing. For example, if a program is written to calculate the area of a rectangle, length and breadth would be the input. If it is a program inside a robotic vacuum cleaner, it could be the input given from the sensors about the presence of some dirt in the vicinity. So, depending on how complex the program is, the inputs also could differ.

3. Identify the process The process is used to convert the input to output in a program. Some times, the process could be very simple, as simple as just using a formula to calculate the answer. For example, we write a program to calculate the area of a rectangle. Multiplying length and breadth would give me the area of the rectangle, and that’s all is the process. But, if I want to write a computer program, which has to play Jeopardy, against a human opponent, then the process would not be that simple. So, depending on the need of the question, the process to convert input data to output information would differ. When you decide to write a program, be clear on what is the very very clear about that. Crystal clear!!!.

4. Know what is the output Last but not the least, is, you should know what is the output of your program. The output data which is generated or calculated or predicted needs to be presented to the user in a very user friendly manner, which is clear and makes sense. So, it is never about getting the correct output, it is always about presenting it well to the user.

5. Example So, let us take a simple example and try to identify the input, process and output for the same. For example, if the question is to write a program to find the area of a rectangle.

Input – Length and breadth

Process – Area = length X breadth

Output – Print Area

May be another example is to calculate the simple interest using a program

Input – Principal, rate, period

Process – (Principal X rate X period)/100

Output – Print Principal


So, I think all of you have would have got some idea of programming and how to identify input, process and output before starting to writing any program.

Comments

Popular posts from this blog

Reduce depression & anxiety by using happiness.

Anxiety - Happiness - Depression  Anxiety and depression are two of the most typical issues on this planet right now.  Anyone can really feel anxious or depressed, relying on the circumstances in his/her life. A single destructive occasion may cause you to really feel more anxious or depressed. But there’s excellent news! Many delicate to reasonable instances might be improved or prevented if you happen to take a number of simple steps to assist your self. These instruments may help you to be joyful, too. It’s a matter of studying to suppose in additional strategic and optimistic methods. The Power of Optimism Why ought to anybody wish to be more optimistic? Optimism enhances self-confidence and instills a way of self-control whereas serving to us to resist depression. Optimists deal with adversity more successfully than pessimists, and see themselves able of energy, whereas pessimists see themselves as powerless, or helpless victims. Study after study reveals the energy of ...

STRESS , ANXIETY MANAGEMENT DURING lockdown

As the events surrounding the coronavirus (COVID-19) outbreak unfold, it’s understandable that you might begin to feel increasing stress. Information is rapidly changing and can be confusing, overwhelming and even scary. You may experience fear and spikes in anxiety. But even if you’re managing your anxiety levels well, there’s still so much more to deal with. Whether it’s dealing with at-risk family members or patients, a roller coaster economy, trying to juggle work, keeping kids occupied or homeschooling while schools are closed, or simply adjusting to a new, unfamiliar situation, stress can easily pile up and negatively impact you — both physically and mentally. 5 steps for managing your stress: 1)Exercise regularly:  While gyms are closed and social distancing guidelines are in place, it’s still possible to get in aerobic exercise, like walking, running, hiking or playing with your kids/pets, all can help release endorphins (natural substances that ...

What are the advantages of artificial intelligence?

  Artificial Intelligence is a field that is seeing rapid development and has an impact on our day to day life. Before looking into its advantages, first let’s understand what an AI is? Artificial Intelligence Artificial Intelligence  in simple terms, is nothing but the simulation of human intelligence done by machines that are programmed by us. The machines need to learn how to reason and do some self-correction as needed along the way. Advantages of Artificial Intelligence: Using AI for a task has improved our life drastically. Let’s look at some of its advantages: 1) Reduction in Human Error The phrase “ human error ” was born because humans make mistakes from time to time. Computers, however, do not make these mistakes if they are programmed properly. With Artificial intelligence, the decisions are taken from the previously gathered information applying a certain set of algorithms. So errors are reduced and the chance of reaching accuracy with a greater degree of precision...