Sunday, January 15, 2017

Programming Basics

Introduction to Computer Programming

Program. A program is a set of sequential instructions for a computer CPU (Central Processing Unit) to perform. It can be written in machine language using its switches, binary, octal, hexadecimal, assembly, a programming language, or any language the CPU will understand.

Here is an example of a program I will call "Cooking a Pot of Rice".

COOKING A POT OF RICE PROGRAM
Line 1. Fill pot with raw rice grains.
Line 2. Fill pot with water until it is on top of the rice.
Line 3. Measure height of rice in pot.
Line 4. Fill pot with water until it reaches half the height of the rice in pot.
Line 5. Cook rice at medium heat.
Line 6. Cook rice at low heat when water is boiling.
Line 7. Turn off heat when water is gone and all rice grains are soft and moist.
Line 8. Serve hot and steamy.

This cooking program is an actual program that can be abstracted into a machine. Let's call this device a Smart Rice Cooker machine.

Now, all that is needed to create this machine is a mechanical engineer to make the machine, an electrical/electronics engineer to create the wires of the machine, and a software engineer to program the wires of the machine.

The software engineer needs to write a program or lots of programs to make everything work.

Variable. Variable is a place to store your data.

Here are some examples on how to use a variable and the type of data you can place in a variable in various programming languages.

C: unsigned variable = 0;
C#: int variable = 1;
C++: char variable = 'A';
Java: double variable = Math.PI;
JavaScript: var variable = '<p>John Sindayen</p>';
PHP: variable = 2017;
Python: variable = "Celebrate 2017!"
Visual Basic: Dim variable As Float = 0.00

Branching. Branching is an alternative to sequential programming. Here is an example of a branching program.

If she loves you, love her.
Else
   If she does not love you, do not love her.
   Else
      If she will love you this month, wait for her to love you.
      Else
         If she will love you next month, wait for her to love you.
         Else find another girl to give your love to.

Repetition. Repetition is another alternative to sequential programming.

Here is an example of repetition programming.

   While she loves you and you love her, love her.

Function. Function is another alternative to sequential programming.

Here is an example of a function programming. First the function is define, and then it is called in the program.

Celebrate 2017 Function
   Eat food merrily.
   Drink coffee merrily.
   Go to school merily.
   Go to work merrily.
   Sleep merrily.
While it is 2017, call Celebrate 2017 Function.

HOW TO LEARN HOW TO PROGRAM

There are many ways to learn to program, just like there are many ways to learn anything. Learning to program is much like learning how to speak in a foreign language like German or French or Spanish. Among the many ways of learning a new language are the following:

1. Read a book.
2. Watch a video.
3. Go to a class.
4. Hire a tutor or teacher.
5. Read the internet.
6. Something you can think of.

Everyone has their own learning style, but not everyone knows their learning style. A tutor or teacher may know how to tutor or teach using one learning style but may not know how to tutor or teach in another learning style.

Knowing your own learning style and having a tutor or teacher who knows how to tutor or teach in your learning style will save you time and effort in learning a new language. But the most important thing of all is for the student to be motivated to learn because the student is the one who will need to absorb all that new knowledge.

There are actually many learning styles. There's the audio style, video style, audio and video style, and other kinds of style which have their own names. The names I have mentioned are only simplified names of some learning styles. To learn more about learning styles, all you have to do is do some research in the internet or the library.

And if anyone should want to get tutoring or some teaching on some programming languages like the ones I have already mention above, and including HTML and CSS, I will recommend myself as your tutor or teacher.

Hope you enjoy this blog,

John Sindayen

No comments:

Post a Comment