SlideShare una empresa de Scribd logo
1 de 34
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer ProgrammingProf. Erwin Globio
 
Basic Programming Concept
Basic Programming ConceptBasic Programming Concept
Basic Programming ConceptCma Mohd
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programmingNeeru Mittal
 
Intro To Programming Concepts
Intro To Programming ConceptsIntro To Programming Concepts
Intro To Programming ConceptsJussi Pohjolainen
 
Programming Fundamentals lecture 2
Programming Fundamentals lecture 2Programming Fundamentals lecture 2
Programming Fundamentals lecture 2REHAN IJAZ
 
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 Conceptsimtiazalijoono
 
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 & LanguagesGaditek
 
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
 

La actualidad más candente (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.
 

Destacado (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 a Introduction To Programming (2009 2010)

Introduction To Programming
Introduction To ProgrammingIntroduction To Programming
Introduction To Programmingcwarren
 
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 CourseVivek chan
 
C++ Tutorial
C++ TutorialC++ Tutorial
C++ Tutorialfreema48
 
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 ZAKTabsheer Hasan
 
classVI_Coding_Teacher_Presentation.pptx
classVI_Coding_Teacher_Presentation.pptxclassVI_Coding_Teacher_Presentation.pptx
classVI_Coding_Teacher_Presentation.pptxssusere336f4
 
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 LANGUAGERathnaM16
 
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 1guest38bf
 

Similar a 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
 
classVI_Coding_Teacher_Presentation.pptx
classVI_Coding_Teacher_Presentation.pptxclassVI_Coding_Teacher_Presentation.pptx
classVI_Coding_Teacher_Presentation.pptx
 
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
 
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
 
My final requirement
My final requirementMy final requirement
My final requirement
 

Más de 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
 

Último

BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...Nguyen Thanh Tu Collection
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
Sulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesSulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesVijayaLaxmi84
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
Unit :1 Basics of Professional Intelligence
Unit :1 Basics of Professional IntelligenceUnit :1 Basics of Professional Intelligence
Unit :1 Basics of Professional IntelligenceDr Vijay Vishwakarma
 
DiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdfDiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdfChristalin Nelson
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxMadhavi Dharankar
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17Celine George
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEPART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEMISSRITIMABIOLOGYEXP
 
6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroom6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroomSamsung Business USA
 
The role of Geography in climate education: science and active citizenship
The role of Geography in climate education: science and active citizenshipThe role of Geography in climate education: science and active citizenship
The role of Geography in climate education: science and active citizenshipKarl Donert
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
The Emergence of Legislative Behavior in the Colombian Congress
The Emergence of Legislative Behavior in the Colombian CongressThe Emergence of Legislative Behavior in the Colombian Congress
The Emergence of Legislative Behavior in the Colombian CongressMaria Paula Aroca
 
How to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command LineHow to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command LineCeline George
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 

Último (20)

BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
Sulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesSulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their uses
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
Unit :1 Basics of Professional Intelligence
Unit :1 Basics of Professional IntelligenceUnit :1 Basics of Professional Intelligence
Unit :1 Basics of Professional Intelligence
 
DiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdfDiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdf
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptx
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEPART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
 
6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroom6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroom
 
The role of Geography in climate education: science and active citizenship
The role of Geography in climate education: science and active citizenshipThe role of Geography in climate education: science and active citizenship
The role of Geography in climate education: science and active citizenship
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
Spearman's correlation,Formula,Advantages,
Spearman's correlation,Formula,Advantages,Spearman's correlation,Formula,Advantages,
Spearman's correlation,Formula,Advantages,
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
The Emergence of Legislative Behavior in the Colombian Congress
The Emergence of Legislative Behavior in the Colombian CongressThe Emergence of Legislative Behavior in the Colombian Congress
The Emergence of Legislative Behavior in the Colombian Congress
 
How to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command LineHow to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command Line
 
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 

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.