SlideShare a Scribd company logo
Introduction to
 Programming
  “How to win friends
and influence computers”
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.
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
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
mr.islamelhosary@gmail.com

More Related Content

What's hot

Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer ProgrammingProf. Erwin Globio
 
Basic programming
Basic programmingBasic programming
Basic programming
Nicole Danielle Mallari
 
Basic Programming Concept
Basic Programming ConceptBasic Programming Concept
Basic Programming Concept
Cma Mohd
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
Neeru Mittal
 
Intro To Programming Concepts
Intro To Programming ConceptsIntro To Programming Concepts
Intro To Programming ConceptsJussi Pohjolainen
 
Graphical programming
Graphical programmingGraphical programming
Graphical programming
Bilal Maqbool ツ
 
Programming Fundamentals lecture 2
Programming Fundamentals lecture 2Programming Fundamentals lecture 2
Programming Fundamentals lecture 2
REHAN IJAZ
 
Lec 1 intro
Lec 1 introLec 1 intro
Lec 1 intro
lankasenanayake
 
Chapter 5( programming) answer
Chapter 5( programming) answerChapter 5( programming) answer
Chapter 5( programming) answersmkengkilili2011
 
Programming Fundamentals and Programming Languages Concepts
Programming Fundamentals and Programming Languages ConceptsProgramming Fundamentals and Programming Languages Concepts
Programming Fundamentals and Programming Languages Concepts
imtiazalijoono
 
Ic lecture8
Ic lecture8 Ic lecture8
Ic lecture8
AttaullahRahimoon
 
Interpreter
InterpreterInterpreter
Interpreter
IGZ Software house
 
C programming
C programmingC programming
C programming
Jigarthacker
 
Algorithm and pseudo codes
Algorithm and pseudo codesAlgorithm and pseudo codes
Algorithm and pseudo codeshermiraguilar
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
Gaditek
 
Computer programming all chapters
Computer programming all chaptersComputer programming all chapters
Computer programming all chaptersIbrahim Elewah
 
Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.
Md Hossen
 

What's hot (20)

Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer Programming
 
The Programming Process
The Programming ProcessThe Programming Process
The Programming Process
 
Basic programming
Basic programmingBasic programming
Basic programming
 
Basic Programming Concept
Basic Programming ConceptBasic Programming Concept
Basic Programming Concept
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
 
Intro To Programming Concepts
Intro To Programming ConceptsIntro To Programming Concepts
Intro To Programming Concepts
 
Graphical programming
Graphical programmingGraphical programming
Graphical programming
 
Project
ProjectProject
Project
 
Programming Fundamentals lecture 2
Programming Fundamentals lecture 2Programming Fundamentals lecture 2
Programming Fundamentals lecture 2
 
Lec 1 intro
Lec 1 introLec 1 intro
Lec 1 intro
 
Chapter 5( programming) answer
Chapter 5( programming) answerChapter 5( programming) answer
Chapter 5( programming) answer
 
Programming Fundamentals and Programming Languages Concepts
Programming Fundamentals and Programming Languages ConceptsProgramming Fundamentals and Programming Languages Concepts
Programming Fundamentals and Programming Languages Concepts
 
Ic lecture8
Ic lecture8 Ic lecture8
Ic lecture8
 
Interpreter
InterpreterInterpreter
Interpreter
 
C programming
C programmingC programming
C programming
 
Algorithm and pseudo codes
Algorithm and pseudo codesAlgorithm and pseudo codes
Algorithm and pseudo codes
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Computer programming all chapters
Computer programming all chaptersComputer programming all chapters
Computer programming all chapters
 
Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.
 

Viewers also liked

Msp
MspMsp
Javafx Overview 90minutes
Javafx Overview 90minutesJavafx Overview 90minutes
Javafx Overview 90minutes
SiliconExpert Technologies
 
Windows 7
Windows 7Windows 7
Javanowandfuture Chihuahua
Javanowandfuture ChihuahuaJavanowandfuture Chihuahua
Javanowandfuture Chihuahua
SiliconExpert Technologies
 
Develop Your Skills With Osum
Develop Your Skills With OsumDevelop Your Skills With Osum
Develop Your Skills With Osum
SiliconExpert Technologies
 
I Phone Session Mufix
I Phone Session MufixI Phone Session Mufix
I Phone Session Mufix
SiliconExpert Technologies
 
Javafx Overview 90minutes
Javafx Overview 90minutesJavafx Overview 90minutes
Javafx Overview 90minutes
SiliconExpert Technologies
 
Javafx Overview 90minutes
Javafx Overview 90minutesJavafx Overview 90minutes
Javafx Overview 90minutes
SiliconExpert Technologies
 
Linux Presentation
Linux PresentationLinux Presentation
Linux Presentation
SiliconExpert Technologies
 
Networks Basics
Networks BasicsNetworks Basics

Viewers also liked (17)

Msp
MspMsp
Msp
 
Javafx Overview 90minutes
Javafx Overview 90minutesJavafx Overview 90minutes
Javafx Overview 90minutes
 
Google Summer of Code
Google Summer of CodeGoogle Summer of Code
Google Summer of Code
 
How To Get Your First Job
How To Get Your First  JobHow To Get Your First  Job
How To Get Your First Job
 
Windows 7
Windows 7Windows 7
Windows 7
 
Javanowandfuture Chihuahua
Javanowandfuture ChihuahuaJavanowandfuture Chihuahua
Javanowandfuture Chihuahua
 
Develop Your Skills With Osum
Develop Your Skills With OsumDevelop Your Skills With Osum
Develop Your Skills With Osum
 
I Phone Session Mufix
I Phone Session MufixI Phone Session Mufix
I Phone Session Mufix
 
Javafx Overview 90minutes
Javafx Overview 90minutesJavafx Overview 90minutes
Javafx Overview 90minutes
 
Javafx Overview 90minutes
Javafx Overview 90minutesJavafx Overview 90minutes
Javafx Overview 90minutes
 
Linux Presentation
Linux PresentationLinux Presentation
Linux Presentation
 
Game Programming By J2me
Game Programming By J2meGame Programming By J2me
Game Programming By J2me
 
Linux Administration
Linux AdministrationLinux Administration
Linux Administration
 
Web Fundamental
Web FundamentalWeb Fundamental
Web Fundamental
 
Mufix Network Programming Lecture
Mufix Network Programming LectureMufix Network Programming Lecture
Mufix Network Programming Lecture
 
Networks Basics
Networks BasicsNetworks Basics
Networks Basics
 
Joomla Presentations
Joomla PresentationsJoomla Presentations
Joomla Presentations
 

Similar to Introduction To Programming (2009 2010)

Introduction To Programming
Introduction To ProgrammingIntroduction To Programming
Introduction To Programming
cwarren
 
Program logic and design
Program logic and designProgram logic and design
Program logic and designChaffey College
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving TechniquesAshesh R
 
Complete C++ programming Language Course
Complete C++ programming Language CourseComplete C++ programming Language Course
Complete C++ programming Language Course
Vivek chan
 
C++ Tutorial
C++ TutorialC++ Tutorial
C++ Tutorial
freema48
 
ArduinoWorkshop2.pdf
ArduinoWorkshop2.pdfArduinoWorkshop2.pdf
ArduinoWorkshop2.pdf
PedramKashiani
 
Ch1 principles of software development
Ch1 principles of software developmentCh1 principles of software development
Ch1 principles of software developmentHattori Sidek
 
Software development slides
Software development slidesSoftware development slides
Software development slidesiarthur
 
Programming with C++
Programming with C++Programming with C++
Programming with C++
ssuser802d47
 
Basics of Programming - A Review Guide
Basics of Programming - A Review GuideBasics of Programming - A Review Guide
Basics of Programming - A Review GuideBenjamin Kissinger
 
Programming concepts By ZAK
Programming concepts By ZAKProgramming concepts By ZAK
Programming concepts By ZAK
Tabsheer Hasan
 
INTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGE
INTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGEINTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGE
INTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGE
RathnaM16
 
classVI_Coding_Teacher_Presentation.pptx
classVI_Coding_Teacher_Presentation.pptxclassVI_Coding_Teacher_Presentation.pptx
classVI_Coding_Teacher_Presentation.pptx
MaaReddySanjiv
 
classVI_Coding_Teacher_Presentation.pptx
classVI_Coding_Teacher_Presentation.pptxclassVI_Coding_Teacher_Presentation.pptx
classVI_Coding_Teacher_Presentation.pptx
ssusere336f4
 
AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1
guest38bf
 

Similar to Introduction To Programming (2009 2010) (20)

Introduction To Programming
Introduction To ProgrammingIntroduction To Programming
Introduction To Programming
 
Program logic and design
Program logic and designProgram logic and design
Program logic and design
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving Techniques
 
Complete C++ programming Language Course
Complete C++ programming Language CourseComplete C++ programming Language Course
Complete C++ programming Language Course
 
C++ Tutorial
C++ TutorialC++ Tutorial
C++ Tutorial
 
ArduinoWorkshop2.pdf
ArduinoWorkshop2.pdfArduinoWorkshop2.pdf
ArduinoWorkshop2.pdf
 
programming.ppt
programming.pptprogramming.ppt
programming.ppt
 
Ch1 principles of software development
Ch1 principles of software developmentCh1 principles of software development
Ch1 principles of software development
 
Beekman5 std ppt_13
Beekman5 std ppt_13Beekman5 std ppt_13
Beekman5 std ppt_13
 
Software development slides
Software development slidesSoftware development slides
Software development slides
 
Ppt lesson 06
Ppt lesson 06Ppt lesson 06
Ppt lesson 06
 
Ppt lesson 06
Ppt lesson 06Ppt lesson 06
Ppt lesson 06
 
Ppt lesson 06
Ppt lesson 06Ppt lesson 06
Ppt lesson 06
 
Programming with C++
Programming with C++Programming with C++
Programming with C++
 
Basics of Programming - A Review Guide
Basics of Programming - A Review GuideBasics of Programming - A Review Guide
Basics of Programming - A Review Guide
 
Programming concepts By ZAK
Programming concepts By ZAKProgramming concepts By ZAK
Programming concepts By ZAK
 
INTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGE
INTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGEINTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGE
INTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGE
 
classVI_Coding_Teacher_Presentation.pptx
classVI_Coding_Teacher_Presentation.pptxclassVI_Coding_Teacher_Presentation.pptx
classVI_Coding_Teacher_Presentation.pptx
 
classVI_Coding_Teacher_Presentation.pptx
classVI_Coding_Teacher_Presentation.pptxclassVI_Coding_Teacher_Presentation.pptx
classVI_Coding_Teacher_Presentation.pptx
 
AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1
 

More from SiliconExpert Technologies

Fedora Fs Menoufiya Release 10
Fedora Fs Menoufiya Release 10Fedora Fs Menoufiya Release 10
Fedora Fs Menoufiya Release 10
SiliconExpert Technologies
 
Database Session
Database SessionDatabase Session
Database Session
SiliconExpert Technologies
 
Linux
LinuxLinux
Web Fundamentals
Web FundamentalsWeb Fundamentals
Web Fundamentals
SiliconExpert Technologies
 
ugmented Reality BY Dr.Hatem Mohammed
ugmented Reality BY Dr.Hatem Mohammedugmented Reality BY Dr.Hatem Mohammed
ugmented Reality BY Dr.Hatem Mohammed
SiliconExpert Technologies
 

More from SiliconExpert Technologies (13)

Joining Osum Community And ..
Joining Osum Community And ..Joining Osum Community And ..
Joining Osum Community And ..
 
Sfd Post Event Report
Sfd Post Event ReportSfd Post Event Report
Sfd Post Event Report
 
Linux
LinuxLinux
Linux
 
Web Intro
Web IntroWeb Intro
Web Intro
 
Desktop Intro
Desktop IntroDesktop Intro
Desktop Intro
 
Fedora Fs Menoufiya Release 10
Fedora Fs Menoufiya Release 10Fedora Fs Menoufiya Release 10
Fedora Fs Menoufiya Release 10
 
Database Session
Database SessionDatabase Session
Database Session
 
Eclipse Vs Netbeans
Eclipse Vs NetbeansEclipse Vs Netbeans
Eclipse Vs Netbeans
 
Introduction to Programming
Introduction to ProgrammingIntroduction to Programming
Introduction to Programming
 
Linux
LinuxLinux
Linux
 
How To Write A Cv That Talks For You
How To Write A Cv That Talks For YouHow To Write A Cv That Talks For You
How To Write A Cv That Talks For You
 
Web Fundamentals
Web FundamentalsWeb Fundamentals
Web Fundamentals
 
ugmented Reality BY Dr.Hatem Mohammed
ugmented Reality BY Dr.Hatem Mohammedugmented Reality BY Dr.Hatem Mohammed
ugmented Reality BY Dr.Hatem Mohammed
 

Recently uploaded

The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 

Recently uploaded (20)

The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 

Introduction To Programming (2009 2010)

  • 1. Introduction to Programming “How to win friends and influence computers”
  • 2.
  • 3.
  • 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.
  • 6.
  • 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
  • 8.
  • 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
  • 30.
  • 31.
  • 32.
  • 33.