quinta-feira, 21 de março de 2013

The Basics of Programming

Introduction to Programming - Module 1

2. The Basics/ Theory......


You might want to skip this if you have no interest in theory whatsoever. I believe this is a good way to develop a programmer's mindset.

   Life Cycle of Programming


1st 
Define the objective

2nd
Plan Solution

3rd
Implementation

4th
Test and Debug

5th
Documentation

6th
Maintenance



There is no need to follow this routine, however it is good practice.

Let's consider an actual scenario.


1st

Program that keeps asking for numbers until user enters 43 and then closes.

2nd

program asks for number
program recieves number
if the number is different than 43, repeat previous process.
if number is equal to 43 end the program.

3rd

This is where you'd do the actual codding, in this case there are several ways to go about this in pascal. You'll learn to code this in the future.

4th

Here you'd test and correct any bugs that you find in your program.

5th

if you are selling a program it is good that another programmer can understand it so he can alter it,  this is why it is good to document your work.

6th

Some products require maintenance.

Algorithm

You probably seen a few in your life. These are sequences or sets of actions, this is what you do in the second step of the life cycle previously discussed. Just think of a recipe to bake a cake.
  1. Get the Ingredients
  2. Mix the Ingredients
  3. Bake

That's a very short and vague algorithm due to my lack of knowledge related to baking.

Program

A program is a set of instructions destined to be processed by an electronic system.

Ways to go about programming.

Top-Down

In this method you have a problem and you decompose this problem into smaller ones.

Example:

Bake a chocolate cake.

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Get the ingredients
Mix the ingredients
Bake

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Add Butter
Add Chocolate

etc.etc..etc................

The point is you are decomposing the problem, and making it's description more and more complex.

Bottom-Up

In this method you have small problems and you mix them them to create a whole, basically the opposite of Top-Down, just think of the process in reverse.





0 comentários

Posts a comment

 
© Doc's Workshop
Designed by Blog Thiết Kế
Back to top