How to Write Computer Code
Computer languages are used to instruct computers to perform tasks that computers are ideal for, such a complex mathematics and processing large amounts of information. Computers speak in a language called "machine language." Higher level computer languages are close to English and are translated to machine language through computer programs called compilers. Computer code consists of statements put together by a high level language, often known as "source code." There are many different languages and programming paradigms used to achieve different tasks with a computer.
Things You'll Need
- Operating system
- Compiler for selected program
- Debugger for selected programming language
Identify the type of task that you would like to achieve with your computer. An example of this would be creating a web page, talking to another computer, or writing a game.
Research the type of application you wish to write and what the best programming languages are for that application. An example of this is a web services application. A good programming language for that is C# (C sharp).
Research books to find the best book(s) on the language you have chosen. Keep in mind that some books are written for the seasoned professional and others are for beginners. Choose the book(s) that best fits your needs.
Learn the language. Read the book(s) and perform the examples as you go through the lessons. These skills build upon one another, so always do the examples in each chapter. As you do the examples, you will be writing source code, which you will be running through a compiler. You will then be able to run/execute to see if you have mastered each task. If your task is not successful, go back through the steps in the book and review your work according to the instructions.
When applicable (some languages do not require it, like Ruby), your source code will be translated to machine language through a compiler. In many applications, you will be required to run your source code through a compiler.
Start early and utilize a debugger while learning the computer language so that as you progress to more complex programs and encounter defects in your code, you will be well versed in using the debugging tool to help you solve any problems that arise.
Practice, practice, practice. Just like any language, computer or otherwise, the more you read and write your chosen language, the better you will become.
Tips & Warnings
- The computer programming paradigm is dictated by the language and how it is applied. An example is the C language, which uses a procedural programming paradigm. C# uses an object oriented programming paradigm.
- Computer programming takes time to learn and everyone learns at their own pace. Take your time and practice.