Login
Password

Forgot your password?

How To Start Programming A Computer

By Edited Nov 13, 2013 0 0

Learn how to program a computer
No matter what type of computer programming you want to learn, you have to start somewhere. A great way to begin is to concentrate on the basic computer operations and develop your programming knowledge to fit. This means that you have to think about input to the computer, computer processing and output. There are many, many programming languages, but they all must handle these three fundamentals. Unfortunately, the languages handle these differently, use different words to describe the specific operations and have different operational requirements. As a beginner, these differences can be confusing. In order to reduce confusion, and increase learning ability, a programming student should follow a simple approach at first, the use of "pseudocode".

Pseudocode Defined
Pseudocode is a fictitious representation of a typical computer programming language. Statements are entered using English words. The desired operations are represented in the pseudocode. Depending on the developer, the results may be relatively similar to an established language, but they don't have to be. The purpose is to declare program steps in a method which primarily conveys the ultimate purpose. Given the results, a programmer familiar with a programming language should be able to perform a direct translation from the pseudocode to a working computer program.

Algorithm Process
An algorithm is a set of steps that are followed to build an end product. A recipe is a good real life example. To bake a cake, follow the recipe algorithm. The steps of the process are outlined in sufficient detail to make a cake. Note that the recipe doesn't specify everything in the finest detail. For example, when two cups of flour are called for, the recipe does not require that a particular type of measuring cup be used. Instead, it is important to accomplish the step. The actual measuring cup is the choice of the baker. A computer algorithm is similar. Consider the following step:

"Display the date"

This tells the programmer to make a program perform the operation. Depending on the needs of the program, this might be all that is required. The programmer would perform the step and meet the requirement of the algorithm. Using pseudocode, the programmer might take the algorithm step and establish a series of component steps. Here is an example:

"Determine the current date"
"Set up a display field"
"Load the display field with the current date"
"Write the display field to the computer screen"

These progressive enhancements have conveyed more process information than the earlier algorithm step. None are actually usable by a computer, though. Each needs to be converted to even more detailed steps before they can be executed by a computer. The process is very helpful, however. Here is a famous programming algorithm that has long been used as an exercise for beginner computer programmers:

"Write the words "Hello world" on the computer screen"

This is a very concept, one that every programming language, (and programmer), should be able to do. The concept is very elementary but the implementation is vastly different depending on the operating environment. The best selling book "The C Programming Language", described the process on the UNIX system. The actual code to perform "Hello world" in the book was simple in "C". In that language, the "printf" statement is used to display text on a computer screen. The actual display is written as follows in that language:

printf("Hello world ");

This is an example of an actual statement that can be understood by a computer programming language. Consider the following:

Algorithm: Display a hello world message

Pseudocode: print("hello world")

C Language: printf("Hello world ");
BASIC Language: print "Hello world"
PHP Language: echo "Hello world"

The point is that the final result should work in a real programming language. The early steps of determining program requirements can use an algorithmic approach, pseudocode development or a combination of the two. The end result should be the same. Given the same algorithm, (or pseudocode), a C programmer and a BASIC programmer should finish with working programs to accomplish the task. Because the languages are different, the results will be different. Surprisingly, two C programmers given the same algorithm may write different programs as well. That is because there are various options available in the programming language. While the "printf" statement displays output on a computer screen, there are other statements available to do the same thing. Some may be easier, some harder than "printf", but they all result in the same text display. This is similar to the recipe example. Whether a plastic or glass measuring cup is used for flour, the cake should turn out the same.

Beginners should try to develop simple programs using algorithms and pseudocode, paying attention to the computer fundamentals of input, processing and output. Here is a valid example:

Get the order details
Calculate the cost of the order
Print a recipt

A computer can easily perform these steps. There are millions of computer applications that accept order details, calculate totals and print receipts. There is no computer that can perform these steps directly, though. The steps are too vague. Here is a progression of the steps into a more detailed algorithm:

Get the item number
Get the quantity
Calculate the order cost, quantity times unit price
Add sales tax
Compute final total
Print a receipt showing item number, description, quantity, unit cost, total cost and tax due

It is obvious that this algorithm is better than the earlier example, but it is still not an actual program. A programmer, however, might be able to take this and develop a working program. Since the algorithm is still vague, the programmer is likely to come up with a solution that is different that what the designer envisioned. Further elaboration may both improve the accuracy of the resultant program and speed up the development process.

As a computer programming beginner, you can concentrate on specifying what to do, not how to do it. Using algorithms and pseudocode, requirements can be developed that can be easily translated into actual computer code. This is true regardless of the target computer language. Most programming languages are based on English so develop your algorithms in that language.


Advertisement
Advertisement

Comments

Add a new comment - No HTML
You must be logged in and verified to post a comment. Please log in or sign up to comment.

Explore InfoBarrel

Auto Business & Money Entertainment Environment Health History Home & Garden InfoBarrel University Lifestyle Sports Technology Travel & Places
© Copyright 2008 - 2016 by Hinzie Media Inc. Terms of Service Privacy Policy XML Sitemap

Follow IB Technology