DEV Community

Cover image for Introduction to fundamentals of programming
Naftali Murgor
Naftali Murgor

Posted on

Introduction to fundamentals of programming


In this blog article, we are going to touch on basics of programming. This will be featured in Modern JavaScript Primer. You may preorder the book at Modern JavaScript Primer for beginners . An early preview of the book will be released on 7/01/2022.

Let's jump into the basics. In the book, we shall cover the following topics as part of the basics:

  1. Introduction to Data types and basic data structures
  2. controls structures
  3. Loops
  4. Functions
  5. Program construction basics

Variables and constants

Variables are values referred to by a label that may change within the program execution. Introducing a variable in your program is known as variable declaration. Creating a variable and assigning an initial value is known as variable declaration and initialization.

let output // declaration, this will will hold value 'undefined'
let input = 0.16 // declare and initialize with 0.16
Enter fullscreen mode Exit fullscreen mode

Variables change within the program execution and may be reassigned to new values as the program exectes.


Programs are executed sequentially, line by line (except for mutlithreading) from the first line to the last line or when the program finds a return keyword. Termination of the function/program terminates and returns a value to the calling function which may return or continue exectuting.


Constants are like variables with exception that once declared, they can never be reassigned to hold new values. They represent entities that will never change during the program execution.


It's good practice to use constants with meaningful names than magic constants as they become hard to read as program grows in complexity.
It's common to give constant name in upperase seperated by an _ underscore, to show that they are constants.

const VAT_RATE = 0.16
const POINT_OF_VIEW = 45 // camera point of view
const ASPECT_RATIO = 2.0 // aspect ratio
Enter fullscreen mode Exit fullscreen mode

These examples use modern JavaScript for demo. In other languages (statically typed languages), one has to provide a type for the variable. For instance in C++:

String catName = "Nancy";
Enter fullscreen mode Exit fullscreen mode


Programming majorly involves manipulating data, storing the data, sending the data over the HTTP or displaying them nicely to a user assuming web/Frontend or mobile development.

  1. Use meaningful and descriptive names.
  2. use named constants instead of magic constants.

Merry Christmas 🎄🎄🎄

Discussion (5)

lukeshiru profile image
Luke Shiru

If you read the terms:

Users must make a good-faith effort to share content that is on-topic, of high-quality, and is not designed primarily for the purposes of promotion or creating backlinks.
Posts must contain substantial content — they may not merely reference an external link that contains the full post.

If you only want to promote your book, you can do it using the listings option in DEV.


naftalimurgor profile image
Naftali Murgor Author

Thanks for the insight. I never knew the listing feature existed.

naftalimurgor profile image
Naftali Murgor Author

This post was originally published at

naftalimurgor profile image
Naftali Murgor Author

Thanks for preordering the book! Thanks everyone

naftalimurgor profile image
Info Comment hidden by post author - thread only accessible via permalink
Naftali Murgor Author

Can't say more. Thanks everyone

Some comments have been hidden by the post's author - find out more