Coding Basics 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 79

CS

BASICS 2
Meziane Dahou
Goals
● What is coding ?
● What is algorithm ?
● A program components .
● Types of programming languages .
● How programs work ?
● Coding fields .
● Work as programmers .
Programming
Programming is the process of creating
software, applications, and websites using
programming languages. These languages
allow developers to communicate with
computers and machines, telling them
what to do and how to do it.
Program
It is a set of instructions or commands that perform a
specific task that is operated by computer machine
Example
● Computer game .
● Calculator .
● Program reading credit card of the ATM .
● Program of controlling the Air conditioner .
Programming language

It is a set of universally agreed upon vocabulary or phrases


that are used in writing programs.
Examples
● Python .
● Java .
● C++ .
● Scala .
Algorithmes
Algorithm
It is a set of abstract commands arranged in a logical order
in order to solve a specific problem.
Examples
● Search algorithm .
● Sort algorithm .
● Compression algorithm .

The relationship between the algorithm, the
program and the programming language?

A program is a specific, logical arrangement of a set of


commands (algorithm) using a specific programming
language.
Programming is used in a wide range of industries, from finance to
healthcare, and it is an essential skill for modern-day professionals.
Why programming is important for everyone ?

Automation Innovation

Problem solving Digital transformation


Why programming is important for you ?

Fulfilling career. With the


It is a critical skill in
demand for
today's digital age.
programmers increasing

A fun and rewarding


Express your creativity
hobby
Programming community
Programming community

Millions of open source


Get the support
projects

Stay up-to-date on
Network and
the latest
opportunities
technologies
Coding community from 2021
What is a
programming language ?

It’s a set of words , and rules (a


formal language) that used to
communicate with a machine by
writing instructions which are
the program itself .
Program components
Program components
. Variables ●
. Instructions ●
. Inputs ●
. Outputs ●
. Arithmetic ●
. Conditions ●
. Loops ●
. Comments ●
Program
components
Program
Inputs les Output
Variab tions
Instruc
s

Functio
ns Comments

c C o n d itions
et i
Arithm
Loop
s
Algorithm
Program
components
Program

Inputs Outputs

Loo
Algorithm ps
Variable
It is an address stored in memory and is linked to a specific
name and contains a specific value that may be simple
(number, letter, text) or complex.

example :
a=12
The variable a holds the number 12.
Variable
We use a variable and perform several operations on it,
with or without the need to know the value it holds
Example
a<=12
b<=1
c<=a+b
Here we have combined the values of variables a and b into
variable c, meaning the value of c is currently 13.
Instructions
It is a command that is presented to the processor to perform a
specific operation, whether mathematical or logical...

Example :
print(“Hello world”);

This is an instruction to write to the screen


Instructions
Example :
a=1+2;
This is an instruction to perform a mathematical
operation (addition) and put the result in the
variable a.
The program's instructions are applied in the order
Instruction by instruction.
Inputs
The sources of information provided for the program
include:
● Keyboard .
● External file .
● Database .
● Another program
Outputs
This is the way to output the program results:
. Screen ●
. External file ●
.Printer ●
.Database ●
. Speaker ●
Example

Calculator program:
● Inputs : buttons (digital or mechanical ) .
● Outputs : screen .
Example

Program to give your photo after 10 years using artificial


intelligence:
● Inputs: Image (external file).
● Outputs: Image on the screen.
Arithmetic
● Instructions contain arithmetic operations (+,-,*,/).
● Priorities work the same as maths priorities.

Example :
sum=(Note_Maths+Note_Physic)/2+Note_bac*2;
moy=sum/3;
print(moy);
Conditions

During programming, you may encounter situations where


you have to do one thing in a certain case and do another
thing in another case.
Conditions

Condition

False True

Instructions A Instructions B
Conditions

For example: We want a program that calculates


the division of two numbers, and if the
denominator is zero, it will be written to us on the
screen. It is not possible to divide by zero.
Loops

It is the repetition of performing a certain number


of instructions until a certain condition is reached.
Loops
The benefit of the loops lies in:
● Avoid repeating code, which leads to high code size.
● In case that we want to run a certain number of instructions and
we do not know when the condition will be met to stop them.
● Organization and readability.
Comments
Comments are adding sentences and explanations to your code to
make it easier to read the code later.
Example :

if (a==0): //Test in case the a is equal to zero



How programs work ?
CPU
Source code

Monitor

RAM
What is a good program ?

A good algorithm Less time

Less resources Maintainable


Example

Program 1 : Program 2 :
- 50 line . - 100 line .

- Code run in 1 us . - Code run in 1 ms .

- Consumes 10 MB of - Consumes 100 MB of

memory memory

Good program Bad program


You can’t find the perfect
algorithm for the least time
consumption and least
resources
Types of programming
languages
1- Machine language
The lowest-level programming language that a
computer can understand. It consists of a series of
binary code instructions that are executed directly
by the computer's CPU (central processing unit).
10101001010101001010010101001010101001010100101010010
101010100101010100101010111101010
2- Assembly
It’s also a low language where you communicate
directly with the CPU by micro-instructions and require
more technical and hardware knowledge and skills .
● OS development .
● Drivers development .
● Embedded systems .
● Reverse engineering .
3- High level languages
High-level languages are more abstract and easier to
read and write where you deal more with the operating
system .
● Procedural (C , Pascal , Fortran , BASIC ) .
● Oriented object ( java , python , kotlin )
Used for software development , AI and machine
learning , game dev , data analysis .
Python , C , Java ,
Kotlin ,Javascript, High level language
Fortran …

x86 , ARM ,MIPS… Low level (Assembly)

001101010101 Machine language


001010100101
Best practices in programming
1-Organisation
● Code conventions .
● Meaningful comments .
● Meaningful variable names .
● Keep it simple .
● Use convenient code architecture.
● Write modular and reusable code .
● Use version control (Git) .
2-Documentation

● Use comments to explain .


● Write clear names .
● Use documentation generators .
● Document external libraries .
● Keep it up to date .
3-Tests

● Automation tests .
● Ui tests .
● Functional tests .
● Debugging .
4-Performance

● Avoid unnecessary loops .


● Reduce memory usage .
● Optimise database queries .
● Keep up to date .
Coding fields
● Development : web , mobile , desktop , server side …
● Cyber security .
● Hardware .
● Data field : Data science , Data analysis , Big data , data mining .
● Artificial intelligence and machine learning.
● Network and telecommunication .
Work as programmer
Freelance
A company employee
Work in open source projects
Programming your own project

‫اﻟﻌﻤﻞ ﻛﻤﱪﻣﺞ‬
3B $ offered by
facebook in 2013
$50 billion in
October 2020
1B $ selt to
facebook in 2012

$120 billion in 2020


Biggest cab company
with 0 cabs

$100 billion in 2020


Made by a college
student

1 Trillion dollars
CS
Fields
Artificial
intelligence

AI focuses on creating
intelligent agents or systems
that can mimic human
cognitive functions, such as
learning, problem-solving, and
decision-making.
Software
development

Software development involves


designing, coding, testing, and
maintaining software
applications and systems. It
covers a wide range of
programming languages and
development methodologies.
Cyber
Security

Cybersecurity focuses on
protecting computer systems,
networks, and data from
unauthorized access, attacks,
and breaches. It includes threat
analysis, encryption, network
security, and ethical hacking.
Data
Science

Data science involves


extracting meaningful insights
from large and complex
datasets. It combines statistics,
machine learning, and domain
knowledge to analyze and
interpret data.
Computer
graphics
Computer graphics focuses on
creating and manipulating
visual content using
computers. It encompasses 2D
and 3D graphics, animation,
rendering, and virtual reality
(VR) (used in video games
,animation studios,
architectural visualization,
medical imaging, and VR/AR )
Database
Management
Database management
involves designing,
maintaining, and optimizing
databases to store and retrieve
data efficiently. It includes
traditional databases and big
data technologies.
Network and
Telecommunication
Network professionals are
responsible for designing,
implementing, and maintaining
communication systems that
allow data and information to
be transmitted over networks.
This field encompasses various
aspects, including network
architecture, protocols,
security, and wireless
communications.
Robotics
Robotics involves designing,
building, and programming
robots for various tasks and
environments. It combines
elements of mechanical
engineering, electronics, and
computer science , Robotics is
used in manufacturing,
healthcare (surgical robots),
space exploration, and
autonomous drones.
Embedded Systems
Engineering
Embedded systems are used in
various industries, including
automotive (for engine control
units and infotainment systems),
medical devices (for monitoring
and control), consumer
electronics (smartphones, smart
TVs), aerospace (flight control
systems), and IoT devices (smart
home appliances, sensors).
Bioinformatics
Bioinformatics involves the
development and application of
computational techniques and
tools to process, analyze, and
manage biological data. This
field plays a crucial role in
genomics, proteomics, structural
biology, and other areas of life
sciences. Bioinformaticians use
algorithms, data mining,
machine learning, and statistical
methods to extract meaningful
insights from biological datasets.
Information System
Information Systems
professionals are responsible for
planning, designing,
implementing, and maintaining
technology solutions that
support an organization's
information management needs.
They work to ensure that
information is collected, stored,
processed, and disseminated
efficiently and securely.
Quantum
Computing
Quantum computing explores
the use of quantum-mechanical
phenomena to perform
computation. It has the potential
to solve complex problems much
faster than classical computers ,
Quantum computing may
revolutionize fields like
cryptography, optimization, drug
discovery, and materials science.
Cloud
engineering
Cloud engineering involves the
creation and operation of cloud
infrastructure and services. Cloud
engineers design scalable,
reliable, and secure cloud
architectures that can support a
wide range of applications and
workloads. they use technologies
like virtualization,
containerization, and automation
to deploy and manage cloud
resources.
Can the AI replace programmers ?
IT’S ALL
ABOUT
CONSISTENCY

THANK YOU

You might also like