SlideShare a Scribd company logo
Introduction to
 Programming
  “How to win friends
and influence computers”
Introduction to programming by MUFIX Commnity
Introduction to programming by MUFIX Commnity
A Brief History of Computers
 General purpose minions
   Orders


 Human calculators
 Mechanical calculators
 Electronic calculators

 General purpose machines
   Programs
What Is Programming
Programming is just telling a computer to do
  something,

                      BUT
Computers know very little and have no common
  sense what-so-ever, so your instructions have to
  be broken down to small, simple parts,

                     AND
Computers will do exactly what you tell them.
Introduction to programming by MUFIX Commnity
Basic Programming
Programming at it’s core is about two things:
  defining problems, and solving problems.

These two aspects are tightly integrated
• To solve a problem you first must clearly know
  what it is
• Clearly and completely defining a problem
  gets you a long ways towards a solution
Introduction to programming by MUFIX Commnity
Four Tools To Get Started
Just getting started is often the hardest part of
  the project. Before diving in to the code, do
  the design document. Four tools to help are
  –Action/Event List
  –Flow Chart
  –Data Model
  –Iterative Refinement
Action List
This is a good tool to use in applications that have
  user interaction.
Write down each action the user can take.
Add a bit of detail info to each action
• Circumstances in which the user may take the
  action (1-3 sentences, and/or list)
• What happens when they do the action (1-3
  sentences)
• What other actions this one allows and denies
  (list format)
Flow Charts
Flow charts are a very useful tool to clarify and
  define programming problems
• They delineate key points in your program
• They’re especially good for state-based
  programs, such as web applications

Don’t get too bogged down in details when
 creating a flow chart – stay high level
Data Model
A data model is a detailed description of the
  information that the application will
  manipulate.

Start with a general idea/concept, then break it
  down into smaller parts, and repeat.

Aim for having each part be a string, a number,
  or a list or collection thereof.
Iterative Refinement - the Ur-Program
The process of iterative refinement

2. Say what you want the computer to do

3. If it’s all in terms the computer will understand,
   then stop, you’re done

4. Otherwise, break each part into simpler steps

5. Go to step 2

NOTE: works for small children as well as computers
The Real World
These are important concepts, and when done right
   you end up documenting your code as you go.

                    HOWEVER…
Real-world programming often doesn’t explicitly
   involve these techniques except at high levels in the
   design document. You should definitely use them
   there, and for actual coding keep them in mind as
   fallback strategies if your stuck on a problem.
What Computers Can Do Well
What Computers Can Do Well
Doing the same things over and over
Remembering things
Mathematics, ‘regular’ and true / false
Changing actions based on conditions
Taking in information
Sending out information
What Computers Can Do Well
Doing the same things over and and Subroutines
                        Loops over
Remembering things Variables and Assignment
Mathematics, ‘regular’ and true / falseOperators
Statements
Changing actions based on conditions
                                  Conditionals


and Blocks
Taking in information
Sending out information
                                          Input
                                        Output
Statements, and Blocks
A statement is a basic instruction for the computer

Statements are executed in order, from first to last

One or more statements may be grouped together
 into a block

A block is marked by curly braces
   { and }
Loops
A loop is a special kind of statement that tells a computer
   to repeat a given set of instructions

A for-loop repeats a given number of times
   e.g. say “hi” five times:
   for (1..5) { say “hi” }

A while-loop repeats as long as a certain condition is true
   e.g. go somewhere :
   while (not arrived) { take step }
Subroutines
A subroutine, function or procedure is a block of statements
   that’s been given a name and which is executed when ever
   that name is used. Essentially, it’s a miniature sub-program
   that you can use in your larger program.

Once a function finishes, the execution returns to the place
  from which it was called.

Functions can take parameters, or arguments, which allow
  values to be sent into the block of code

Functions can return values.
Variables
A variable has a name, or identifier, and may have a
  value associated.
Associate a given value with a given variable by making
  an assignment.
Variables can be declared, which creates them without
  any value. Some languages require this.
Variable Names
MUST:
Start with a letter
Contain letters or numbers or underscores

SHOULD:
Be meaningful (often 10+ characters)
Be readable (use _ or mixCase to mark words)
Follow convention (start lower case, i, x, y)
Basic Values
Literal values:
   Numbers
       0, -3, 8.223419783
   Strings (a series of characters)
       “zero”, ”0”, “cheddar cheese”
Expressions:
   One or more values, expressions, or variables combined by operators
                              8.3 * 4.291
                                    2
                        “smoked” . “ “ . “cheddar”
   A variable used in a expression is replaced by its value
                            ingredient_count + 3
Operators
There are all the standard math operators
   + - * / % ()

The string concatenation operator combines two or more strings into
  one
   Depends on the language (often . or +)

There are many other operators too
   Boolean math
   Comparisons
   Specialized

Operators combine values and expressions into larger expressions
Conditionals
A conditional, or branch, statement executes a
  block of other statements based on whether a
  given condition is true or false

Conditions are evaluated using boolean
  operators, as well as comparisons and other
  things that are true or false
General Conditional Statement
if (condition)
   Block executed if condition is true
else if (other condition)
   Block executed if other condition is true
else
   Block executed if all conditions are false
Input and Output
Special statements get data into and out of a
  program.
  Details vary by language


Data can come from:
  keyboard, web page, mouse, file, other


Data can go to:
  screen, file, the internet, other
Comments
Comments are a way to put text in the program
  code which does not get executed. This is very
  useful for leaving notes / descriptions /
  explanations, and for testing.
Comments are usually denoted by
  # or // to comment to the end of the line
  /* to comment out multiple lines
     */
Best Practices
Always make backups of original working code before
  messing with it
Use comments to mark what you change, how, and
  when, and to keep copies of original statements
Test early, test often
Work together – more eyes means fewer bugs
Read the manual – there are great references online
Look at examples
Introduction to programming by MUFIX Commnity
Introduction to programming by MUFIX Commnity
Introduction to programming by MUFIX Commnity
Introduction to programming by MUFIX Commnity
mr.islamelhosary@gmail.com

More Related Content

PPT
Introduction To Programming
PDF
4 coding from algorithms
PPTX
Programing techniques
PPTX
11 Unit 1 Problem Solving Techniques
PPTX
Algorithms
PPSX
Problem solving and design
PPTX
Pseudocode-Flowchart
PPTX
Algorithm and pseudo codes
Introduction To Programming
4 coding from algorithms
Programing techniques
11 Unit 1 Problem Solving Techniques
Algorithms
Problem solving and design
Pseudocode-Flowchart
Algorithm and pseudo codes

What's hot (20)

PPTX
Algorithm - Introduction
PPT
Problem solving using Computer
PPTX
Pseudocode
PPT
Jeremiah Yancy - Objectives for Software design and testing
PPTX
Pseudo code
PPTX
FIT-Unit3 chapter 1 -computer program
PPT
AVB201.2 Microsoft Access VBA Module 2
PDF
Visual Logic Project - 1
PPT
Programming fundamentals lecture 1&2
PPTX
Introduction to problem solving in C
PDF
problem solving and design By ZAK
PPT
AVB201.1 MS Access VBA Module 1
PDF
The Programming Process
PPT
Error Correction Techniques
PPT
2.3 Apply the different types of algorithm to solve problem
PPT
Program design and problem solving techniques
PPTX
Flowcharting and Algorithm
PPT
Csc 130 class 2 problem analysis and flow charts(2)
PDF
Visual Logic User Guide
PPT
Ppt lesson 06
Algorithm - Introduction
Problem solving using Computer
Pseudocode
Jeremiah Yancy - Objectives for Software design and testing
Pseudo code
FIT-Unit3 chapter 1 -computer program
AVB201.2 Microsoft Access VBA Module 2
Visual Logic Project - 1
Programming fundamentals lecture 1&2
Introduction to problem solving in C
problem solving and design By ZAK
AVB201.1 MS Access VBA Module 1
The Programming Process
Error Correction Techniques
2.3 Apply the different types of algorithm to solve problem
Program design and problem solving techniques
Flowcharting and Algorithm
Csc 130 class 2 problem analysis and flow charts(2)
Visual Logic User Guide
Ppt lesson 06
Ad

Viewers also liked (18)

PDF
Branding In a Troubled Economy
PPT
2010 Multi Media Marketing Proposal Hfmus No Pricing
PPTX
Who is Generation Z
DOCX
Customer acquisition and retention project on virgin mobile
PPT
#BrandBlackface
PDF
Garis panduanppg
PPSX
Curriculum
DOCX
A study on progress and investors perception towerds dematerialization of sha...
PPTX
Alvin Ailey Presentation for Kids (PreK)
PDF
EL MÉTODO CIENTÍFICO: JENNER Y LA VACUNA
PDF
Who are Millennials
PDF
Mutual funds is the better investments plan
DOCX
Project on customer satisfaction with special reference to mahindra bolero
DOC
Project on mutual funds as an investment avenue
DOC
A study of job satisfaction and conflict resolution modes in the minda group
DOC
Project report on competancy mapping
DOC
Project on mutual funds is the better investments plan
DOCX
A project report on survey of retailer’s and consumer of soft drinks
Branding In a Troubled Economy
2010 Multi Media Marketing Proposal Hfmus No Pricing
Who is Generation Z
Customer acquisition and retention project on virgin mobile
#BrandBlackface
Garis panduanppg
Curriculum
A study on progress and investors perception towerds dematerialization of sha...
Alvin Ailey Presentation for Kids (PreK)
EL MÉTODO CIENTÍFICO: JENNER Y LA VACUNA
Who are Millennials
Mutual funds is the better investments plan
Project on customer satisfaction with special reference to mahindra bolero
Project on mutual funds as an investment avenue
A study of job satisfaction and conflict resolution modes in the minda group
Project report on competancy mapping
Project on mutual funds is the better investments plan
A project report on survey of retailer’s and consumer of soft drinks
Ad

Similar to Introduction to programming by MUFIX Commnity (20)

PPT
Program logic and design
PPT
Problem Solving Techniques
PPT
Chapter 5( programming) answer
PPSX
Complete C++ programming Language Course
PPTX
C++ Tutorial
PDF
ArduinoWorkshop2.pdf
PPTX
object oriented programming language in c++
PPT
programming.ppt
PPT
Ch1 principles of software development
PPT
Software development slides
PPT
Ppt lesson 06
PPT
Ppt lesson 06
PDF
Programming with C++
PDF
Basics of Programming - A Review Guide
PDF
Programming concepts By ZAK
PPTX
INTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGE
PPTX
classVI_Coding_Teacher_Presentation.pptx
PPTX
classVI_Coding_Teacher_Presentation.pptx
PDF
C Programming Slides for 1st Year Engg students
Program logic and design
Problem Solving Techniques
Chapter 5( programming) answer
Complete C++ programming Language Course
C++ Tutorial
ArduinoWorkshop2.pdf
object oriented programming language in c++
programming.ppt
Ch1 principles of software development
Software development slides
Ppt lesson 06
Ppt lesson 06
Programming with C++
Basics of Programming - A Review Guide
Programming concepts By ZAK
INTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGE
classVI_Coding_Teacher_Presentation.pptx
classVI_Coding_Teacher_Presentation.pptx
C Programming Slides for 1st Year Engg students

Recently uploaded (20)

PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
A Presentation on Artificial Intelligence
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
cuic standard and advanced reporting.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPT
Teaching material agriculture food technology
PDF
Getting Started with Data Integration: FME Form 101
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
Tartificialntelligence_presentation.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
1. Introduction to Computer Programming.pptx
Network Security Unit 5.pdf for BCA BBA.
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Digital-Transformation-Roadmap-for-Companies.pptx
A Presentation on Artificial Intelligence
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
cuic standard and advanced reporting.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Teaching material agriculture food technology
Getting Started with Data Integration: FME Form 101
Dropbox Q2 2025 Financial Results & Investor Presentation
Advanced methodologies resolving dimensionality complications for autism neur...
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Empathic Computing: Creating Shared Understanding
Spectral efficient network and resource selection model in 5G networks
Encapsulation_ Review paper, used for researhc scholars
Assigned Numbers - 2025 - Bluetooth® Document
Tartificialntelligence_presentation.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
1. Introduction to Computer Programming.pptx

Introduction to programming by MUFIX Commnity

  • 1. Introduction to Programming “How to win friends and influence computers”
  • 4. A Brief History of Computers General purpose minions Orders Human calculators Mechanical calculators Electronic calculators General purpose machines Programs
  • 5. What Is Programming Programming is just telling a computer to do something, BUT Computers know very little and have no common sense what-so-ever, so your instructions have to be broken down to small, simple parts, AND Computers will do exactly what you tell them.
  • 7. Basic Programming Programming at it’s core is about two things: defining problems, and solving problems. These two aspects are tightly integrated • To solve a problem you first must clearly know what it is • Clearly and completely defining a problem gets you a long ways towards a solution
  • 9. Four Tools To Get Started Just getting started is often the hardest part of the project. Before diving in to the code, do the design document. Four tools to help are –Action/Event List –Flow Chart –Data Model –Iterative Refinement
  • 10. Action List This is a good tool to use in applications that have user interaction. Write down each action the user can take. Add a bit of detail info to each action • Circumstances in which the user may take the action (1-3 sentences, and/or list) • What happens when they do the action (1-3 sentences) • What other actions this one allows and denies (list format)
  • 11. Flow Charts Flow charts are a very useful tool to clarify and define programming problems • They delineate key points in your program • They’re especially good for state-based programs, such as web applications Don’t get too bogged down in details when creating a flow chart – stay high level
  • 12. Data Model A data model is a detailed description of the information that the application will manipulate. Start with a general idea/concept, then break it down into smaller parts, and repeat. Aim for having each part be a string, a number, or a list or collection thereof.
  • 13. Iterative Refinement - the Ur-Program The process of iterative refinement 2. Say what you want the computer to do 3. If it’s all in terms the computer will understand, then stop, you’re done 4. Otherwise, break each part into simpler steps 5. Go to step 2 NOTE: works for small children as well as computers
  • 14. The Real World These are important concepts, and when done right you end up documenting your code as you go. HOWEVER… Real-world programming often doesn’t explicitly involve these techniques except at high levels in the design document. You should definitely use them there, and for actual coding keep them in mind as fallback strategies if your stuck on a problem.
  • 16. What Computers Can Do Well Doing the same things over and over Remembering things Mathematics, ‘regular’ and true / false Changing actions based on conditions Taking in information Sending out information
  • 17. What Computers Can Do Well Doing the same things over and and Subroutines Loops over Remembering things Variables and Assignment Mathematics, ‘regular’ and true / falseOperators Statements Changing actions based on conditions Conditionals and Blocks Taking in information Sending out information Input Output
  • 18. Statements, and Blocks A statement is a basic instruction for the computer Statements are executed in order, from first to last One or more statements may be grouped together into a block A block is marked by curly braces { and }
  • 19. Loops A loop is a special kind of statement that tells a computer to repeat a given set of instructions A for-loop repeats a given number of times e.g. say “hi” five times: for (1..5) { say “hi” } A while-loop repeats as long as a certain condition is true e.g. go somewhere : while (not arrived) { take step }
  • 20. Subroutines A subroutine, function or procedure is a block of statements that’s been given a name and which is executed when ever that name is used. Essentially, it’s a miniature sub-program that you can use in your larger program. Once a function finishes, the execution returns to the place from which it was called. Functions can take parameters, or arguments, which allow values to be sent into the block of code Functions can return values.
  • 21. Variables A variable has a name, or identifier, and may have a value associated. Associate a given value with a given variable by making an assignment. Variables can be declared, which creates them without any value. Some languages require this.
  • 22. Variable Names MUST: Start with a letter Contain letters or numbers or underscores SHOULD: Be meaningful (often 10+ characters) Be readable (use _ or mixCase to mark words) Follow convention (start lower case, i, x, y)
  • 23. Basic Values Literal values: Numbers 0, -3, 8.223419783 Strings (a series of characters) “zero”, ”0”, “cheddar cheese” Expressions: One or more values, expressions, or variables combined by operators 8.3 * 4.291 2 “smoked” . “ “ . “cheddar” A variable used in a expression is replaced by its value ingredient_count + 3
  • 24. Operators There are all the standard math operators + - * / % () The string concatenation operator combines two or more strings into one Depends on the language (often . or +) There are many other operators too Boolean math Comparisons Specialized Operators combine values and expressions into larger expressions
  • 25. Conditionals A conditional, or branch, statement executes a block of other statements based on whether a given condition is true or false Conditions are evaluated using boolean operators, as well as comparisons and other things that are true or false
  • 26. General Conditional Statement if (condition) Block executed if condition is true else if (other condition) Block executed if other condition is true else Block executed if all conditions are false
  • 27. Input and Output Special statements get data into and out of a program. Details vary by language Data can come from: keyboard, web page, mouse, file, other Data can go to: screen, file, the internet, other
  • 28. Comments Comments are a way to put text in the program code which does not get executed. This is very useful for leaving notes / descriptions / explanations, and for testing. Comments are usually denoted by # or // to comment to the end of the line /* to comment out multiple lines */
  • 29. Best Practices Always make backups of original working code before messing with it Use comments to mark what you change, how, and when, and to keep copies of original statements Test early, test often Work together – more eyes means fewer bugs Read the manual – there are great references online Look at examples