Foundations Of Programming

Shalom

Sani Yusuf

  • Founder Of Haibrid
  • Co-Organiser Of Ionic-UK
  • Author & Trainer
  • Recently Traveled The World
  • Big Fan Of Avatar Movie

@saniyusuf

What We Will Cover Today

  • General Intro To Programming
  • Why Do We Need Programming Languages
    • List Of Programming Languages 
  • Why Javascript
  • Primitive Data Types
  • Variables
  • Operators

What Is Programming?

Programming Is Our Way Issuing Instructions To A Computer Using A Language We Understand

SANI YUSUF

Wait What Does That Even Mean?

Let Me Explain

Your Computer Understands Only Binary

Binary Looks Like This?

Writing Binary Is Hard Or Just Not Practical.

Except If You Are These Guys.

Quick Comparison

01010000 01110010 01101111 01100111 01110010 01100001 01101101 01101101 01101001 01101110 01100111

PROGRAMMING

These 2 Are The Same

Now Imagine What The Code For More Complex Things Would Look Like? 

Solution?

Programming Languages

Programmer

Programming Language Code

Binary

Computer

Why Programming ​Languages?

  • Give us a human readable friendly way of communicating with computers
  • Save us a lot of time since we can spend less time writing code 

Programming Languages

English

French

Arabic

French

Java

JavaScript

Python

C

Just Like How We Have Different Spoken Languages With Different Writing Systems,  The Same Applies For Programming Languages

JavaScript

Why Should You Be Learning JavaScript As Your First Language?

Why Learn JavaScript

  • It is the most widely used Language today
  • It is the language of the Web
  • It is relatively easier than a lot of other languages
  • High Job prospects
    • Mobile App Dev
    • Web Dev
    • Backend Dev
    • IOT
  • Can run on any machine out there today

Let's Learn JavaScript

Variable

A Variable Is A Name Or A Placeholder For A Value

  • A variable is similar to a House Number 
  • Each House Number represents one house and one house alone
  • 2 houses cannot have the same Numbers
  • But 2 houses can have the same number as long as they are on different streets 

More On Variables

Primitive Data Types

Primitives

Primitive Data Types Are Data Types That Are Built Into A Language By Default. They Are Building Blocks

  • Number
  • String
  • Boolean
  • Array
  • Object

Number

    
    let bankBalance = 10000;    //This Is A Number
    let salary = 10000;         //This Is Another Number
    let pi = 3.14;              //This Has Decimals
 

  

String


    let myName = "Sani Yusuf";  //This Is Text Or A String
    let myCountry = "Nigeria";  //This Is Text Or A String

String Are How You Enter Text Or Words. You Must Wrap Your Text Inside " " To Tell JavaScript This Is A String.

 

It's Like How You Always Use A Capital Letter To Start A New Paragraph In English.

Boolean


    let isSaniRich = false;     //This Is Boolean And Can Be True Or False
    let isArsenalGreat = true;  //This Is Boolean And Can Be True Or False
Booleans Are Used To Check & Compare values By Checking Their Truthness & Falseness

Array


    let daysOfTheWeek = ["Monday", "Tuesday", "Wednesday"];
    
    daysOfTheWeek[0];        //This Is "Monday"
    daysOfTheWeek[1];        //This Is "Tuesday"
Arrays Are Index Based And Have A Starting Index Of 0.

Object


    let birthCertificate = {
        name: "Sani Yusuf",
        favoriteClub: "Arsenal",
        country: "Nigeria",
        hasAlotOfMoney: "false",
        bankBalance: 10000
    };
    
    birthCertificate.name;        //This Is "Sani Yusuf"
    daysOfTheWeek["name"];        //This Is Also "Sani Yusuf"
Objects Are Very Powerful And Have Some Array Like Properties

Setting Variables

    
    let bankBalance = 10000;    //This Is A Number
    let salary = 10000;         //This Is Another Number

    let myName = "Sani Yusuf";  //This Is Text Or A String
    let myCountry = "Nigeria";  //This Is Text Or A String

    let isSaniRich = false;     //This Is Boolean And Can Be True Or False
    let isArsenalGreat = true;  //This Is Boolean And Can Be True Or False
    
    let aVariableName = "This Is A Variable Value";
    let avariablename = "This Is A Different Varable But Harder To Read";
  • The "let" keyword is used to set a variable
  • Variable Names Are Case Sensitive

Operators

  • +    //Addition Operator

  • -    //Subtraction Operator

  • *    //Multiplication Operator

  • /   //Division Operator

  • %  //Modulus 

Addition Operator (+)

    
    let bankBalance = 10000;    //This Is A Number
    let salary = 10000;         //This Is Another Number
    let result = salary + bankBalance ;   //This will be 10000 + 10000 = 20000

    let myName = "Sani Yusuf";  //This Is Text Or A String
    let myCountry = "Nigeria";  //This Is Text Or A String
    let result2 = myName + myCountry;    //This Is "Sani YusufNigeria"

  

Used To Perform Addition Operations.

Works For Strings & Numbers Alike

Subtraction Operator (-)

    
    let bankBalance = 10000;    //This Is A Number
    let salary = 10000;         //This Is Another Number
    let result = salary - bankBalance ;   //This will be 10000 + 10000 = 0

    let myName = "Sani Yusuf";  //This Is Text Or A String
    let myCountry = "Nigeria";  //This Is Text Or A String

    //This Will Silently Give And Error NaN (Means Not A Number)
    let result2 = myName + myCountry;    

   

Used To Perform Subtraction Operations. Doesn't Work For Strings

Multiplication Operator (*)

    
    let bankBalance = 10000;    //This Is A Number
    let salary = 10000;         //This Is Another Number

    //This will be 10000 * 10000 = 100000000
    let result = salary * bankBalance ;   

 

Used To Perform Multiplication Operations. Doesn't Work For Strings

Division Operator (/)

    
    let bankBalance = 10000;    //This Is A Number
    let salary = 10000;         //This Is Another Number

    //This will be 10000 / 10000 = 1
    let result = salary / bankBalance ;   
  

Used To Perform Division Operations. Doesn't Work For Strings

Modulus Operator (%)

    
    let bankBalance = 10000;    //This Is A Number
    let salary = 10000;         //This Is Another Number

    //This will be 10000 / 10000 = 1 And No Remainder So 0 Is the Answer
    let result = salary % bankBalance ;   
  
    let bankBalance2 = 10;    //This Is A Number
    let salary2 = 9;         //This Is Another Number

    //This will be 10 / 9 = 1 With 1 As A Remainder 1 Is the Answer
    let result2 = salary2 % bankBalance2 ;   


    let bankBalance3 = 10;    //This Is A Number
    let salary3 = 7;         //This Is Another Number

    //This will be 10 / 9 = 1 With 3 As A Remainder 3 Is the Answer
    let result3 = salary3 % bankBalance3 ;   
  

Modulus Is Used To Get The Remainder From A Division Operation. Doesn't Work For Strings

End Of Foundations

Next Time?

Go In-depth Into Basic Syntax And Operations

Thank You And Tweet Questions

Hausa For Any Questions?

Foundations Of Programming: Episode 01

By Sani Yusuf

Foundations Of Programming: Episode 01

  • 2,121