Introduction to coding

Every young person is excited about coding.

well, coding is just a fancy term for a set of instructions written in a high level or low level computer language for computers to execute.

While the computer langauge is important to computers, called the syntax, the the how (order and manner) called the symantics is equally important.

Therefore to fully understand how to code it is important to have a basic foundation of how computers work.

Objectives

1. to understand the basic concept of coding

2. to understand algorithms

3. to understand flow charts

4. to understand psuedocode

 

TOPICS:

1. basic concept of coding

2. algorithms

3. flow charts

4. psuedocode

5. to understand a basic code programming language: PYTHON

Methodology

Using the hanson Approach, students will be shown examples of simple machine codes written in high level and low level langauges as implementations of algorithms which can be expressed as flowcharts and psuedocode and finally implemented in a specific programming language: PYTHON

Students will be required to take a handson approach using a laptop with a Visual Studio installed to be able to practicalize lessons.

Students will write a simple code that solves a problem 

COURSE MATERIAL

1. to understand the basic concept of coding

Because computer do not understand natural languages, instructions and data has to be encoded i.e written in a machine langauage. This process is called coding. However, machine language also called binary made up of Os and 1s is difficult to write and understand.

therefore, high level langauges that are closer to english can be used to write codes that are later translated to computer machine language. 

Examples such as Java and C are high level langauges which convert code written to bytecode and converted to assembly langauge that can then be run on a machine.

The programmer therefore, is only concerned with high level langauge instructions while the assembly converts the code to machine langauge.

 

Concept of algorithms

An algorithm is simply a step by step way of solving a problem. it is a fundamental concept to computer science. an approach that allows a problem to be broken down into its constitutent parts and solved one after the other.

e.g. An algorithm for fyring eggs might include the following:

1. take the eggs from the crate

2. wash the eggs

3. break the eggs using a spoon or knife into two

4. pour the egg yolk and white into a bowl

5. pour salt 

6. mix

7. pour oil in a pan.

8. put the pan on fire and heat

9. pour the egg into the pan of oil

10. and stirr

11. Remove the egg and put on a plate

12. Fried Eggs is served.

If we look above, the algorithm, gives us the process or instrcutions on how to carry out the activity or solve the problem.

Different algorithms are used to solve different computational problems  and some of these are best suited for their specific problems.

Computional problems, include, search, traversal, sort, etc and different algorithms have been developed to solve these problems.

 

3. to understand flow charts

Going forward with our test algorith,  we can design a visual representation of the problem solving process or the instructions using a standard format called Flow charts. These are visual representations that allow us to see the process of the solution.

 

4. to understand psuedocode

Another way of representing the algorithm or solution to the problem or the set of instructions is using a psuedo-code meainig, fake c- code. this kind of code is not fake but is generic way of wrtting the code close to real human language yet easily implemented in any progrmaming language. this means that somebody who is skilled in a specific language will be able to easily write the algorithm in his specifi langauge from looking at the psuedod code.

here is an example

BEAT the eggs for 20-25 secconds in a bowl

heat a frying pan over a media low heat

Melt some butter in the frying pan

Put Eggs on Pan

WHILE eggs not okay

stir eggs while cooking

End While

IF any Ingredients

Add other Ingridients

End IF

Serve the Scrambled Eggs

ASSESSEMENT

 

1. Explain the concept of code

2. diffentiate between a flow chart and algorithm

3. Write a simple pseudo code for travelling from your class to your home.