Introduction to Programming by hcj

VIEWS: 20 PAGES: 2

									Introduction to Programming Written by yung_tw Ready for some fun? Ok.. so let's get started. First of all, what is the meaning of the word programming? Well.. the word programming comes from the verb "to make a program". Ok.. so basically is the action of making programs. Now, let's get to what a program is. In general terms, a program is a set of instructions to execute certain things in certain order. Take for example when you program your cd-player, you want to play only certain songs in some certain order. So in general terms a program is just a set of instructions to be executed to come with a result you wanted. In computer terms, making a program or "coding" a program means much the same, it's setting a set of instructions to the computer in a language that it will understand for it to execute what you need the computer to perform for you. Okay, now that we know what the idea of programming is, how do we get started? First, what we need is to know which programming language we will use. A programming language is a vocabulary or a set of grammatical rules used to instruct the computer to perform certain tasks. Some of the most common programming languages can be the following: BASIC, C, C++, Cobol, Java, Fortran, Pascal, Visual Basic, Perl, PowerBuilder, between others. Each of the programming languages have their unique set of instructions or syntax for organizing program instructions. The programming languages are so called high-level, these can be compared to human language or human understandable language, on the other hand, there‟s the so called machine programming or object code, which can be compared to machine language (each type of CPU has it‟s own machine language). An example of a language close to machine languages could be assembly. Languages are subdivided in four generations: First generation: machine language Second generation: assembly language Third generation: high-level languages like, C, C++, Java, Pascal Fourth generation: this is a new category that responds to graphical or visual programming languages such as Visual Basic, Delphi, Power Builder. Regardless on the language that you will use, you eventually will have to convert the code you just wrote into machine language so that the computer will know what you want to do. So basically there are two ways of doing this: - You can compile the program. A compiler is a program used to translate source code that you have written into object code (machine language), it takes the whole source code and convert it, organizing all the instructions. This is the most common used. - You can interpret the program. A interpreter differs from a compiler in a very simple way, an interpreter directly executes its source language, without first translating it into an object language. Some Lisp or APL implementations could be considered to be pure interpreters. But many languages' implementation consist of both compiler and interpreter. A lot of people ask the question: “so now, which language should I use?”. Well, I really hadn‟t the answer to that, all I can say is, some programming languages are more complex, others are simpler, some were made for certain types of purposes, some are faster, some give you some additional options for you to work with. So it really depends much on you, that‟s why it is very important for you to experience with a whole lot of programming languages and decide which one you will stay with.

Once you have all this in mind, it‟s time to start getting at the code. It is recommended that before starting to get at the code we first work on the algorithm of the program you want to make. So what is an algorithm? It is a formula or a sequence of steps that must be followed, to be able to solve a particular problem. Basically, is the way you are gonna solve what you are planning to do as the program. Take for example: A very simple example could be when you want to call someone by phone, here‟s the algorithm: 1. Pick up the phone 2. Wait for dial tone 3. Dial the number 4. Wait for the person to answer 5. Talk to the person 6. Hang up So as you can see, an algorithm is as simple as that, it‟s setting up a sequence of step to reach a result that was wanted. Normally algorithms are expressed in charts called flow charts. These are used to represent the sequence of the executions of each sentence of code. Following I will give the example of the program hello world in a flow chart and pascal source code:

Begin

Display on screen the words Hello World

End

Program first_program; Uses Crt; Begin Writeln(„Hello World‟); Readkey; End. Until here, our first issue of programming, on our next update or issue we will be expanding our knowledge on flow charts and be talking about data structures used on programming. Thank you for reading this. And remember.. RTFM! If you have any comments please feel free on droping them to yung@smart-dev.com Thanks.


								
To top