Introduction to programming
Tags: beginners, programming
Published: 2019-12-22 13:33:16

---
title: Introduction to programming
published: true
description: A beginners introduction to programming
tags: beginners, programming
series: FrontEnd Development Zero to Hero
cover_image: https://thepracticaldev.s3.amazonaws.com/i/fqg0tajpxufx3twphn48.jpg
---
> __This is a general overview of programming and is by no means a comprehensive guide to what programming is all about__.

Humans communicate with each other using _natural languages_ like _English_, _Spanish_ or _Arabic_ and communicate with computers using _programming languages_ like _JavaScript_, _Python_ or _Java_.

The __process of communicating with these computers in the language they understand__ is known as _programming_.

Programming is fun and it's solely about one thing &mdash; __problem solving__ but it can be defined as __an art__ or __part of an engineering process__ but, it mostly involves __creating solutions to a set of problems or tasks__.

When starting out with programming, you can ask the following questions<a name="questions"></a>:

* [When should i program?](#what-should-i-program)
* [What is problem solving?](#what-is-problem-solving)
* [How can i program?](#how-can-i-program)
* [What is a programming language?](#what-is-a-programming-language)
    * [What is a compiled language?](#compiled-language)
    * [What is a compiler?](#what-is-a-compiler)
    * [Examples of compiled language](#examples-of-compiled-language)
    * [What is an interpreted language?](#interpreted-language)
    * [What is an interpreter?](#what-is-an-interpreter)
    * [Examples of interpreted language](#examples-of-interpreted-language)
* [What makes up a programming language?](#what-makes-a-programming-language)
* [Which programming language should i learn?](#programming-lang-to-learn)
* [What can go wrong with my code?](#what-can-go-wrong)
* [How can i get better at programming?](#how-can-get-better)

Let's dive in.

<hr>

###__When should I program? <a name="what-should-i-program"></a>__
You'll mostly want to program in two cases:

* When you have an app idea
* To automate a manual task

####__When you have an app idea__
Ideas are everywhere, __they can pop into your head when you least expect them__ and they can keep you up at night.

If it's an idea that really of interest, you should consider writing code to implement it. The relief you'll get when the application is done is __priceless__.

####__To automate a manual task__
Humans (myself included) love to automate most of our manual tasks, the least been sending an email. If you find yourself doing some manual task repeatedly like _emptying your recycle bin_ or _deleting the contents of the temporary folder_ you might as well write a program to automate this stuff.

There is even a book dedicated to this kind of stuff, can you guess the name?

[Automate the boring stuff](https://automatetheboringstuff.com/).

[[Back to questions](#questions)]

###__What is problem-solving? <a name="what-is-problem-solving"></a>__
The moment you __decided to automate a manual task or work on an application__ idea, __you've created a problem for yourself__ and now, you __have to solve it__.

How you go about solving the problem is known as _problem solving_.

__Problem solving is a fun brain exercise__ and it involves the following process:

* Requirement specification
* Problem analysis
* Design and implementation
* Maintenance

####__Requirement specification__
This is the process of __writing what the program should do and how it should it__. You write this down in plain language you can understand.

Technically speaking these are known as __constraints__.

####__Problem analysis__
Now that you are done writing the constraints, you proceed by taking a __birds eye view of the problem__ you are trying to solve (app idea or automating some boring stuff).

What I mean by "birds-eye view" is to __think very carefully about the problem from different perspectives__ by asking yourself the following questions:

* What do you need to solve the problem?
* What is the cost of solving the problem (technical and man power)?
* Who will use the application?
* Are there similar apps that already solve the same problem as yours?
* If the app becomes a success (by releasing to the public) are you willing to commit to it?

Be honest with your answer(s).

####__Design and Implementation__
Congratulations if you get to this stage. The design process __specifies the procedure on solving the problem__ (that's the best explanation I could come up with). This will include the following:

<dl>
  <dt><b>User interface</b></dt>
  <dd>This is the space where the user interact with the machine.</dd>

  <dt><b>User Experience</b></dt>
  <dd>Designing your application by keeping the user (yourself included) in mind.</dd>
  
  <dt><b>Database design</b></dt>
  <dd>If your application will store some form of data, you will need a database. Database design is a topic on its own and <b>involves how the data is stored</b>.</dd>
  
  <dt><b>Algorithm design</b></dt>
  <dd><b>Algorithm is a step by step unambiguous way of solving a problem</b>.
  <b>You can think of an algorithm as a recipe for preparing your favorite dish.</b>
  To the best of your understanding write out the steps the application should take to achieve its tasks in plain language.</dd>
</dl>

The __implementation__ is the part where you __convert the algorithm to code using a programming language__ that fits the domain of the problem you are trying to solve.

####__Maintenance__
At this stage, you've completed the app and you write __code to add new features or fix a bug__.

You can listen to the following podcast about problem-solving.

{% podcast https://dev.to/syntax/how-to-get-better-at-problem-solving %}

[[Back to questions](#questions)]

###__How can i program? <a name="how-can-i-program"></a>__
You can program by writing code in a programming language using a _text editor_ or an integrated development environment (IDE).

[[Back to questions](#questions)]

###__What is a programming language? <a name="what-is-a-programming-language"></a>__
A __Programming language is a tool in the toolkit of a programmer (you)__. A programming language is used to __convert your algorithms to a form that can be executed on a computer__.

Technically speaking a programming language is:

> A programming language is a formal language, which comprises a set of instructions that produce various kinds of output. Programming languages are used in computer programming to implement algorithms. 
&mdash; [Wikipedia](https://en.wikipedia.org/wiki/Programming_language)

Furthermore, programming languages can be classified into two:

* Compiled
* Interpreted

####__Compiled language <a name="compiled-language"></a>__
When you use a compiled language, you write your code in a text editor or IDE and another program called a _compiler_ converts your code to machine-readable format (0'1 and 1's) then produces an executable.

Technically speaking a compiler is defined as <a name="what-is-a-compiler"></a>:

> A compiler is a computer program that translates computer code written in one programming language (the source language) into another language (the target language)
&mdash; [Wikipedia](https://en.wikipedia.org/wiki/Compiler)

Examples of compiled language are <a name="examples-of-compiled-language"></a>:
* C
* C++
* Java

####__Interpreted language <a name="interpreted-language"></a>__
When you use an interpreted language that means there will be __an interpreter in the environment__ to read the actual source code and execute it.

Technically speaking, an interpreter is defined as <a name="what-is-an-interpreter"></a>:

> In computer science, an interpreter is a computer program that directly executes instructions written in a programming or scripting language, without requiring them previously to have been compiled into a machine language program
&mdash; [Wikipedia](https://en.wikipedia.org/wiki/Interpreter_(computing))

Example of interpreted languages are <a name="examples-of-interpreted-language"></a>:

* JavaScript
* Python

###__What makes up a programming language? <a name="what-makes-a-programming-language"></a>__

As of December 2019 __most programming languages__ are made up of the following (and more).

<dl>
  <dt><b>Variables</b></dt>
  <dd>Variables are memory locations that store data.</dd>

  <dt><b>Conditional statements</b></dt>
  <dd>Conditional statements are used to execute certain code based on a condition.</dd>
  
  <dt><b>Functions</b></dt>
  <dd>Functions are a group of reusable code.</dd>
  
  <dt><b>Arrays</b></dt>
  <dd>Arrays are used to store homogeneous or heterogeneous data in an indexed form mostly starting at zero.</dd>
</dl>

The list is __incomplete__ but you'll find them __in most programming languages__.

[[Back to questions](#questions)]

###__Which programming language should i learn? <a name="programming-lang-to-learn"></a>__

__You should learn a programming language when you are about to work on a project that requires the use of the language__.

This is known as __purpose driven learning__.

[[Back to questions](#questions)]

###__What can go wrong with my code? <a name="what-can-go-wrong"></a>__

Lots of things. They can be classified into two:

* Syntax errors
* Logical errors

Both classes of errors can lead to bugs in your code.

The act of finding these bugs is called __debugging__.

[[Back to questions](#questions)]

###__How can i get better at programming? <a name="how-can-get-better"></a>__
One of the ways to get better at programming is by __working on projects that force you to think in a different approach every single time there by increasing your problem solving skills.__

[[Back to questions](#questions)]

<hr>

Up next, we'll start coding in JavaScript starting with variables.