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

What is Cyber Security? Definition, career , jobs, advantages of Cyber Security.

Cyber security ......!   We depend on technology heavily, which also translates to a rise in online hackers. The bigger the corporation is, the higher the risk of cyber attacks. This is when cybersecurity comes into the picture. What is cybersecurity:                  Cybersecurity is the condition of being guarded against criminal and illegal activities that comprise of activities related to computer, information technology, and virtual reality. It also means the measures taken to acquire this condition. One must know the risks, threats, and consequences of cyber attacks. Who are the attackers:                   The attacker could be an external source like a hacker who gets into the system and steals files. The imposter could even be someone from the company itself, like an employee who has an access to confidential information. How are the attacks carried out:         ...

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...

What is Metaphysics ?... Special about metaphysics...

Metaphysics is the study of Reality.   What is Metaphysics - Part 1: A study of Mind by Mind. It is an abstract and speculative study that includes Mankind and Life itself. It is as old as Mankind and many discoveries have been made by the Great Thinkers of the past. First of all, we all live forever because we are Immortal and Eternal Spiritual Beings! The death of our physical body is not the end of our existence since we context exist in a different mode. What we have learned in our physical existence becomes an aspect of our Mind and it becomes available to us in the future. In other words, nothing is ever lost and all our experiences become the source of Knowledge and Wisdom in our future endeavors. Secondly, each Lifetime or existence is a self-chosen affair and we select Lifetimes according to our needs. As Spiritual Beings we live more than one lifetime and, in each Lifetimes, we gather Knowledge. We are all Children of the Universe or God and the Wisdom gained in the pas...