Introduction to programming

Habdul Hazeez - Dec 22 '19 - - Dev Community

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 — 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:

Let's dive in.


When should I program?

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.

[Back to questions]

What is problem-solving?

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:

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

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.

play pause Syntax - Tasty Web Development Treats

[Back to questions]

How can i program?

You can program by writing code in a programming language using a text editor or an integrated development environment (IDE).

[Back to questions]

What is a programming language?

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.
Wikipedia

Furthermore, programming languages can be classified into two:

  • Compiled
  • Interpreted

Compiled language

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 compiler is a computer program that translates computer code written in one programming language (the source language) into another language (the target language)
Wikipedia

Examples of compiled language are :

  • C
  • C++
  • Java

Interpreted language

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 :

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
Wikipedia

Example of interpreted languages are :

  • JavaScript
  • Python

What makes up a programming language?

As of December 2019 most programming languages are made up of the following (and more).

Variables
Variables are memory locations that store data.
Conditional statements
Conditional statements are used to execute certain code based on a condition.
Functions
Functions are a group of reusable code.
Arrays
Arrays are used to store homogeneous or heterogeneous data in an indexed form mostly starting at zero.

The list is incomplete but you'll find them in most programming languages.

[Back to questions]

Which programming language should i learn?

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]

What can go wrong with my code?

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]

How can i get better at programming?

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]


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

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .