Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

Introduction to Computer Programming

This document provides an introduction to computer programming, explaining what programming is, the role of developers, and the importance of programming languages. It covers the process of writing code, transforming it into binary, and the various applications of programming across different fields such as web development, mobile app development, game development, data science, and more. The document emphasizes the significance of learning to code and its potential to solve real-world problems.

Uploaded by

dedand418
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Introduction to Computer Programming

This document provides an introduction to computer programming, explaining what programming is, the role of developers, and the importance of programming languages. It covers the process of writing code, transforming it into binary, and the various applications of programming across different fields such as web development, mobile app development, game development, data science, and more. The document emphasizes the significance of learning to code and its potential to solve real-world problems.

Uploaded by

dedand418
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Introduction to computer Programming

🔹 What is Programming
Every time you turn on your smartphone, laptop,
tablet, smart TV, or any other electronic device, you
are running code that was planned, developed, and
written by developers. This code creates the final and
interactive result that you can see on your screen.
So, programming is the process of writing code to
solve a particular problem or to implement a
particular task.
Programming is what allows your computer to run the
programs you use every day and your smartphone to
run the apps that you love. It is an essential part of
our world as we know it. Whenever you check your
calendar, attend virtual conferences, browse the web,
or edit a document, you are using code that has been
written by developers.

"And what is code?" Code is a sequence of


instructions that a programmer writes to tell a device
(like a computer) what to do. The device cannot know
by itself how to handle a particular situation or how to
perform a task. So developers are in charge of
analyzing the situation and writing explicit
instructions to implement what is needed.

To do this, they follow a particular syntax (a set of


rules for writing the code).

A developer (or programmer) is the person who


analyzes a problem and implements a solution in
code.
Sounds amazing, right? It's very powerful
and you can be part this wonderful world too by
learning how to code. Let's see how.

Lecturer: Hon. Mbii Kavindu Email: Honkavindu@gmail.com Phone: +254722294481


Introduction to computer Programming
As a developer, you would start by designing the
layout of the app, how it will work, its different
screens and functionality, and all the small details
that will make your app an awesome tool for users
around the world.

Only after you have everything carefully planned out,


you can start to write your code. To do that, you will
need to choose a programming language to work
with. Let's see what a programming language is and
why they are super important.
🔸 Programing Languages
A programming language is a language that
computers can understand.
We cannot just write English words in our program
like this:

"Computer, solve this task!"


and hope that our computer can understand what we
mean. We need to follow certain rules to write the
instructions.

Every programming language has its own set of rules


that determine if a line of code is valid or not.
Because of this, the code you write in one
programming language will be slightly different from
others. Some programming languages are more
complex than others but most of them share core
concepts and functionality. If you learn how to code in
one programming language, you will likely be able to
learn another one faster.

Lecturer: Hon. Mbii Kavindu Email: Honkavindu@gmail.com Phone: +254722294481


Introduction to computer Programming
Before you can start writing awesome programs and
apps, you need to learn the basic rules of the
programming language you chose for the task.

a program is a set of instructions written in a


programming language for the computer to execute.
We usually write the code for our program in one or
multiple files.
For example, this is a line of code in Python (a very
popular programming language) that shows the
message "Hello, World!":
print("Hello, World!")
But if we write the same line of code in JavaScript (a
programming language mainly used for web
development), we will get an error because it will not
be valid.

To do something very similar in JavaScript, we would


write this line of code instead:

console.log("Hello, World!");
Visually, they look very different, right? This is
because Python and JavaScript have a different
syntax and a different set of built-in functions.
built-in functions are basically tasks that are
already defined in the programming language. This
lets us use them directly in our code by writing their
names and by specifying the values they need.
In our examples, print() is a built-in function in Python
while console.log() is a function that we can use in
JavaScript to see the message in the console (an
interactive tool) if we run our code in the browser.
Examples of programming languages include Python,
JavaScript, TypeScript, Java, C, C#, C++, PHP, Go,
Swift, SQL, and R. There are many programming

Lecturer: Hon. Mbii Kavindu Email: Honkavindu@gmail.com Phone: +254722294481


Introduction to computer Programming
languages and most of them can be used for many
different purposes.

These were the most popular programming languages


on the Stack Overflow Developer Survey 2022:

There are many other programming languages


(hundreds or even thousands!) but usually, you will
learn and work with some of the most popular ones.
Some of them have broader applications like Python
and JavaScript while others (like R) have more specific
(and even scientific) purposes.

Lecturer: Hon. Mbii Kavindu Email: Honkavindu@gmail.com Phone: +254722294481


Introduction to computer Programming
This sounds very interesting, right? And we are only
starting to talk about programming languages. There
is a lot to learn about them and I promise you that if
you dive deeper into programming, your time and
effort will be totally worth it.

🔹 Programming and Binary Numbers


When you think about programming, perhaps the first
thing that comes to your mind is something like the
below image, right? A sequence of 0s and 1s on your
computer.
Programming is indeed related to binary numbers
( 0 and 1) but in an indirect way. Developers do not
actually write their code using zeros and ones.
We usually write programs in a high-level
programming language, a programming language
with a syntax that recognizes specific words (called
keywords), symbols, and values of different data
types.

Basically, we write code in a way that humans can


understand binary

For example, these are the keywords that we can use


in Python:

False class from or


None continue global pass
True def if raise
and del import return
as elif in try
assert else is while
async except lambda with
await finally nonlocal yield
break for not
List of Python keywords.

Lecturer: Hon. Mbii Kavindu Email: Honkavindu@gmail.com Phone: +254722294481


Introduction to computer Programming
Every programming language has its own set of
keywords (words written in English). These keywords
are part of the syntax and core functionality of the
programming language.

But keywords are just common words in English,


almost like the ones that we would find in a book.

That leads us to two very important questions:

 How does the computer understand and interpret


what we are trying to say?
 Where does the binary number system come into
play here?
The computer does not understand these words,
symbols, or values directly.
When a program runs, the code that we write in a
high-level programming language that humans can
understand is automatically transformed into binary
code that the computer can understand.

Lecturer: Hon. Mbii Kavindu Email: Honkavindu@gmail.com Phone: +254722294481


Introduction to computer Programming

Process of transforming a program into binary code.


This transformation of source code that humans can
understand into binary code that the computer can
understand is called compilation.
A compiler is a Computer software that translates
(compiles) source code written in a high-level
language (e.g., C++) into a set of machine-language
instructions that can be understood by a digital
computer’s CPU.

Britannica also mentions that:The term compiler was


coined by American computer scientist Grace Hopper,
who designed one of the first compilers in the early
1950s.

Some programming languages can be classified


as compiled programming languages while others
can be classified as interpreted programming

Lecturer: Hon. Mbii Kavindu Email: Honkavindu@gmail.com Phone: +254722294481


Introduction to computer Programming
languages based on how to they are transformed into
machine-language instructions.
However, they all have to go through a process that
converts them into instructions that the computer can
understand.

🔸Real-World Applications of Programming

Programming has many different applications in many


different industries. This is truly amazing because you
can apply your knowledge in virtually any industry
that you are interested in.From engineering to
farming, from game development to physics, the
possibilities are endless if you learn how to code.

Let's see some of them below.

Front-End Web Development

If you learn how to code, you can use your


programming skills to design and develop websites
and online platforms. Front-End Web Developers
create the parts of the websites that users can see
and interact with directly.

Front-End Web Developers use HTML and CSS to


create the structure of the website (these are markup
languages, which are used to present information)
and they write JavaScript code to add functionality
and interactivity.

Back-End Web Development


More complex and dynamic web applications that
work with user data also require a server. This is a
computer program that receives requests and sends

Lecturer: Hon. Mbii Kavindu Email: Honkavindu@gmail.com Phone: +254722294481


Introduction to computer Programming
appropriate responses. They also need a database, a
collection of values stored in a structured way.
Back-End Web Developers oversee developing the
code for these servers. They decide how to handle the
different requests, how to send appropriate
resources, how to store the information, and basically
how to make everything that runs behind the scenes
work smoothly and efficiently.

Full-stack Web Developers are in charge of both


Front-End and Back-End Web Development. They
have specialized knowledge on both areas.
All the complex platforms that you use every day, like
social media platforms, online shopping platforms,
and educational platforms, use servers and back-end
web development to power their amazing
functionality.

Python is an example of a powerful programming


language used for this purpose. This is one of the
most popular programming languages out there, and
its popularity continues to rise every year. This is
partly because it is simple and easy to learn and yet
powerful and versatile enough to be used in real-
world applications.

JavaScript can also be used for back-end web


development thanks to Node.js. Other programming
languages used to develop web servers are PHP,
Ruby, C#, and Java.

Mobile App Development


Mobile apps have become part of our everyday lives.
I'm sure that you could not imagine life without them.
Mobile apps help us with our daily tasks, they

Lecturer: Hon. Mbii Kavindu Email: Honkavindu@gmail.com Phone: +254722294481


Introduction to computer Programming
entertain us, they solve a problem, and they help us
to achieve our goals. They are always there for us.

Developers focused on mobile app development are


in charge of planning, designing, and developing the
user interface and functionality of these apps. They
identify a gap in the existing apps and they try to
create a working product to make people's lives
better. Regardless of the field you choose, your goal
as a developer should always be making people's
lives better. Apps are not just apps, they have the
potential to change our lives. You should always
remember this when you are planning your projects.
Your code can make someone's life better and that is
a very important responsibility.

Mobile app developers use programming languages


like JavaScript, Java, Swift, Kotlin, and Dart.
Frameworks like Flutter and React Native are super
helpful to build cross-platform mobile apps (that is,
apps that run smoothly on multiple different
operating systems like Android and iOS).
According to Flutter's official documentation:
Flutter is an open source framework by Google for
building beautiful, natively compiled, multi-platform
applications from a single codebase.
Game Development
Being a game developer means having the
opportunity of bringing joy and entertainment to
players around the world. Game developers envision,
design, plan, and implement the functionality of a
game. They also need to find or create assets such as
characters, obstacles, backgrounds, music, sound
effects, and more. Imagine creating an awesome and

Lecturer: Hon. Mbii Kavindu Email: Honkavindu@gmail.com Phone: +254722294481


Introduction to computer Programming
engaging game that users around the world will love.
That is what I personally love about programming.
You only need your computer, your knowledge, and
some basic tools to create something amazing.

Popular programming languages used for game


development include JavaScript, C++, Python, and
C#.

Data Science
Programming is also essential for a field called Data
Science. If you are interested in answering questions
through data and statistics, this field might be exactly
what you are looking for and having programming
skills will help you to achieve your goals.
Effective data scientists are able to identify relevant
questions, collect data from a multitude of different
data sources, organize the information, translate
results into solutions, and communicate their findings
in a way that positively affects business decisions.
There are many powerful programming languages for
analyzing and visualizing data, but perhaps one of the
most frequently used ones for this purpose is Python.

This is an example of the type of data visualizations


that you can create with Python. They are very helpful
to analyze data visually and you can customize them
to your fit needs.

Lecturer: Hon. Mbii Kavindu Email: Honkavindu@gmail.com Phone: +254722294481


Introduction to computer Programming

Sample data visualizations from the Matplotlib and Seaborn galleries


Engineering
Engineering is another field where programming can
help you to succeed. Being able to write your own
computer programs can make your work much more
efficient. There are many tools created specifically for
engineers. For example, the R programming language
is specialized in statistical applications and Python is
very popular in this field too.

Another great tool for programming in engineering


is MATLAB. According to its official website:
MATLAB is a programming and numeric computing
platform used by millions of engineers and scientists
to analyze data, develop algorithms, and create
models.
Really, the possibilities are endless.

Medicine and Pharmacology

Lecturer: Hon. Mbii Kavindu Email: Honkavindu@gmail.com Phone: +254722294481


Introduction to computer Programming
Medicine and pharmacology are constantly evolving
by finding new treatments and procedures. Let's see
how you can apply your programming skills in these
fields.

Specialized developers are in charge of developing


and writing the code that powers and controls the
devices and machines that are used by modern
medicine. Medical records are also stored and tracked
by specialized systems created by developers.

Programming and computer science can also be


applied to develop new drugs in the field of
pharmacology. Artificial intelligence, which can help
compute the combinations of compounds that would
be better for a particular drug, can reduce trial-and-
error time and ideally quicken the process of
designing new medicines.

Education
Every time a student opens an educational app,
browses an educational platform, writes on a digital
whiteboard, or attends a class through an online
meeting platform, programming is making that
possible. As a programmer or as a teacher who knows
how to code, you can create the next great app that
will enhance the learning experience of students
around the world.

The important thing is to create it with students in


mind if your goal is to make something amazing that
will create long-lasting memories. If you envision it,
then you can create it with code.

Lecturer: Hon. Mbii Kavindu Email: Honkavindu@gmail.com Phone: +254722294481


Introduction to computer Programming
Teachers can also teach their students how to code to
develop their problem-solving skills and to teach
them important skills for their future. Scratch is a
great programming language to teach the basics of
programming. It is particularly focused on teaching
children how to code in an interactive way.

Machine Learning, Artificial Intelligence, and Robotics


Some of the most amazing fields that are directly
related to programming are Machine Learning,
Artificial Intelligence, and Robotics. Let's see why.

Artificial Intelligence is defined by Britannica as:


The project of developing systems endowed with the
intellectual processes characteristic of humans, such
as the ability to reason, discover meaning, generalize,
or learn from past experience.
Machine learning is a branch or a subset of the field
of Artificial Intelligence in which systems can learn on
their own based on data. The goal of this learning
process is to predict the expected output. These
models continuously learn how to "think" and how to
analyze situations based on their previous training.
The most commonly used programming languages in
these fields are Python, C, C#, C++, and MATLAB.

Artificial intelligence and Machine Learning have


amazing applications in various industries, such as:

 Image and object detection.


 Making predictions based on patterns.
 Text recognition.
 Recommendation engines (like when an online
shopping platform shows you products that you

Lecturer: Hon. Mbii Kavindu Email: Honkavindu@gmail.com Phone: +254722294481


Introduction to computer Programming
may like or when YouTube shows you videos that
you may like).
 Spam detection for emails.
 Fraud detection.
 Social media features like personalized feeds.
 Many more... there are literally millions of
applications in virtually every industry.
Robotics
Programming is also very important for robotics. Yes,
robots are programmed too! Robotics is the Design,
construction, and use of machines (robots) to perform
tasks done traditionally by human beings.

Robots are just like computers. They do not know


what to do until you tell them what to do by writing
instructions in your programs. If you learn how to
code, you can program robots and industrial
machinery found in manufacturing facilities.

Other Applications
There are many other fascinating applications of
programming in almost every field. The possibilities
are endless. I hope that this section will give you a
notion of why learning how to code is so important for
your present and for your future. It will be a valuable
skill to have in any field you choose.

🔹 Basic Programming Concepts


These are some basic programming concepts that
you should know:

 Variable: a variable is a name that we assign to


a value in a computer program. When we define

Lecturer: Hon. Mbii Kavindu Email: Honkavindu@gmail.com Phone: +254722294481


Introduction to computer Programming
a variable, we assign a value to a name and we
allocate a space in memory to store that value.
The value of a variable can be updated during the
program.
 Constant: a constant is similar to a variable. It
stores a value but it cannot be modified. Once
you assign a value to a constant, you cannot
change it during the entire program.
 Conditional: a conditional is a programming
structure that lets developers choose what the
computer should do based on a condition. If the
condition is True, something will happen but if
the condition is False, something different can
happen.
 Loop: a loop is a programming structure that let
us run a code block (a sequence of instructions)
multiple times. They are super helpful to avoid
code repetition and to implement more complex
functionality.
 Function: a function helps us to avoid code
repetition and to reuse our code. It is like a code
block to which we assign a name but it also has
some special characteristics. We can write the
name of the function to run that sequence of
instructions without writing them again.
Functions can communicate with main programs
and main programs can communicate with
functions through parameters, arguments,
and return statements.
 Class: a class is used as a blueprint to define the
characteristics and functionality of a type of
object. Just like we have objects in our real world,
we can represent objects in our programs.

Lecturer: Hon. Mbii Kavindu Email: Honkavindu@gmail.com Phone: +254722294481


Introduction to computer Programming
 Bug: a bug is an error in the logic or
implementation of a program that results in an
unexpected or incorrect output.
 Debugging: debugging is the process of finding
and fixing bugs in a program.
 IDE: this acronym stands for Integrated
Development Environment. It is a software
development environment that has the most
helpful tools that you will need to write computer
programs such as a file editor, an explorer, a
terminal, and helpful menu options. a commonly
used and free IDE is Visual Studio Code, created
by Microsoft.

🔸 Types of Programming Languages


Programming languages can be classified based on
different criteria. If you want to learn how to code, it's
important for you to learn these basic classifications:

Complexity
 High-level programming languages: they are
designed to be understood by humans and they
have to be converted into machine code before
the computer can understand them. They are the
programming languages that we commonly use.
For example: JavaScript, Python, Java, C#, C++,
and Kotlin.
 Low-level programming languages: they are
more difficult to understand because they are not
designed for humans. They are designed to be
understood and processed efficiently by
machines.
Conversion into Machine Code

Lecturer: Hon. Mbii Kavindu Email: Honkavindu@gmail.com Phone: +254722294481


Introduction to computer Programming
 Compiled programming languages: programs
written with this type of programming language
are converted directly into machine code by a
compiler. Examples include C, C++, Haskell, and
Go.
 Interpreted programming
languages: programs written with this type of
programming language rely on another program
called the interpreter, which is in charge of
running the code line by line. Examples include
Python, JavaScript, PHP, and Ruby.
Most programming languages can have both
compiled and interpreted implementations – the
language itself is not necessarily compiled or
interpreted. However, for simplicity’s sake, they’re
typically referred to as such.
There are other types of programming languages
based on different criteria, such as:

 Procedural programming languages


 Functional programming languages
 Object-oriented programming languages
 Scripting languages
 Logic programming languages
And the list of types of programming languages
continues. This is very interesting because you can
analyze the characteristics of a programming
language to help you choose the right one for your
project.

Open Source Code

Lecturer: Hon. Mbii Kavindu Email: Honkavindu@gmail.com Phone: +254722294481


Introduction to computer Programming
When you have gained enough skills and confidence
in your knowledge, you can practice by contributing
to open source projects and join developer
communities. Open source software is defined
by Opensource.com as: Software with source code
that anyone can inspect, modify, and enhance.

GitHub is an online platform for hosting projects with


version control. There, you can find many open
source project that you can contribute to and practice
your skills. Many open source projects welcome first-
time contributions and contributions from all skill
levels. These are great opportunities to practice your
skills and to contribute to real-world projects.
Working on a team is a great experience. I totally
recommend it once you feel comfortable enough with
your skills and knowledge.

Lecturer: Hon. Mbii Kavindu Email: Honkavindu@gmail.com Phone: +254722294481

You might also like