You are on page 1of 6

How to Write a Program: Coding, Testing & Debugging

Instructor: Paul Zandbergen Cite this lesson

Creating a software program involves writing code, testing code and xing any parts of the code that are
wrong, or debugging. Analyze the process of writing a program and discover how code editor software can
make that process easier. Updated: 12/31/2022

Steps to Writing a Program


The general steps for writing a program include the following:
Understand the problem you are trying to solve
Design a solution
Draw a ow chart
Write pseudo-code
Write code
Test and debug
Test with real-world users
Release program
Iterate the steps for the next version

This lesson will look more closely at writing code in programming language. Once code has
been written, it has to be tested and debugged to make sure it works as intended.

Practice Quiz Course Info

Writing Code
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
t g Code
Computer code is essentially a list of instructions that can be run by a certain program. Code
is written in plain text, so that the compiler can read it. Compilers see formatting characters as
syntax errors. A unique le extension is given to the document to indicate the nature of the
code. For example, a le created using Python is saved with a .py extension, like
'myprogram.py.' However, the actual content of the le is still just plain text.

Because most code is in plain text, you can write code using a basic word processor or text
editor. However, it is much more e ective to use a software application that is speci cally
designed for coding in a particular language. For example, when you write a document in
plain English, you would use word processor software, which can assist you with things such
as formatting, spelling and grammar. Similarly, a code editor provides tools such as syntax
checking. Syntax is to code what spelling and grammar are to writing English.

A code editor is also called an integrated development environment, or IDE. An IDE is a


software application for formatting your code, checking syntax, as well as running and testing
your code. Some IDEs can work with multiple programming languages, while some are very
speci c for only one language.

Here is an example of what a typical IDE looks like:

Example of IDE

This may look overwhelming, but you can think of this as a specialized word processor for
programmers to write code.

Syntax
One very useful aspect of IDE is known as syntax highlighting. This means elements of the
code are shown in di erent colors based on what they are. Let's look at a very simple
example. Here is the original code in plain text:

Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Original code in plain text

Now let's look at the code in an IDE:

Same code in IDE

The colors make it easier to recognize the various elements of the code. For example, in the
sample code, the elements 'for,' 'in,' and 'print' are keywords that hold special meaning.

Syntax highlighting makes it easier to read code. However, it does not change the actual
meaning of the code, and it is only for human readers.

An IDE includes tools for syntax checking, which is similar to checking grammar and spelling. If
code contains syntax errors, the program will simply not execute. An IDE identi es exactly
where the syntax errors are.

Most IDEs also have some form of autocompletion system built in. You may be familiar with
this if you do any text messaging on a smartphone. As you start typing, the program will
determine what it is you are trying to type. For example, if you type 'pr,' the IDE will suggest

'print.' Autocompletion in an IDE will typically provide a list of options to choose from, not just
the most likely option. This saves on typing and also reduces typos. Autocompletion in a
coding environment is also referred to as intelligent code completion.

Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Online Compilers
If you work for an organization, you will most likely use an IDE. However, there are online
compilers that provide an easy way to develop and test your code. Whether you are a student
or a professional, these tools can be accessed with ease and used to test, desk-check or to
collaborate with others on projects. Many times the code can even be exported for importing
into an IDE.

Online compilers come in several avors and for many programming languages. One popular
tool is the repl.it suite. For example, the Java 11 compiler is available from Replit.com:

https://replit.com/~.

Under the Create options, click Java.

Click the Create Repl button:

https://repl.it/new/java10. Following is an example of the compiler and its output.

Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Online compilers also use syntax highlighting and code completion.

Testing
Once you have written your code and checked for any syntax errors, you are ready to start
testing. A program that is free of syntax errors will execute. However, this does not mean it
actually works.


To unlock this lesson you must be a Study.com Member. Create your account

How to Write a Program: Coding, Testing & Debugging


Related Study Materials

Create an account to start this course today


Used by over 30 million students worldwide

Create an account
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com

You might also like