SlideShare uma empresa Scribd logo
1 de 47
Baixar para ler offline
PRINCIPLES OF PROGRAMMING
CP 111
COURSE OUTLINE
● An overview of programming languages
● Basic Concepts
● Names, Bindings, and Scopes
● Data Types
● Expressions and Assignment Statements
● Basic Program Structure and the Integrated Development Environment
● Algorithm Development Using Pseudocode
● Decision structures
● Loop Structures
COURSE ACTIVITIES
● 3 Reading AssignmentS
● 3 TESTS (NOV, DEC & JAN)
● 3 QUIZZES
● Tutorials
● 9 Lecturers
● 1 University Examination
OVERVIEW OF PROGRAMMING
LANGUAGE
What is programming language
● A programming language is a set of rules that provides a way of telling a
computer what operations to perform.
● A programming language is a notational system for describing computation
in a machine-readable and human-readable form.
● A programming language also has words, symbols and rules of grammar.
What is programming language
● Tool for instructing machine
● Means for communicating between programmers
● Vehicle for expressing high level design
● It acts as a tool for experiment
● Controlling computerized devices
Why study programming language ?
There are various reason regarding the study of programming languages
but following are six main reasons
Why study programming language
1. Increased capacity to express ideas.
● The depth at which people can think is heavily influenced by the expressive
power of their language.
● Example use of drawings have helped people express themselves.
Why study programming language
2. Improved background for choosing appropriate languages.
● Many professional programmers have a limited formal education in computer
science, limited to a small number of programming languages.
● They are more likely to use languages with which they are most comfortable
than the most suitable one for a particular job.
● If these programmers were familiar with a wider range of languages and
language constructs, they would be better able to choose the
language with the features that best address the problem.
Why study programming language
3. Increased ability to learn new languages.
● Computer science is considered as a ever growing discipline especially most
software technologies
● programming languages are not yet mature. Therefore, they are still evolving.
● The understanding of programming language design and implementation
makes it easier to learn new languages.
Why study programming language
4. Better understanding of the significance of implementation..
● It is often necessary to learn about language implementation; it can lead to a
better understanding of why the language was designed the way that it was.
● Fixing some bugs requires an understanding of implementation issues.
Why study programming language
5. Better use of languages that are already known.
● Some languages are better for some jobs than others.
(i) FORTRAN and APL for calculations, COBOL and RPG for report generation,
LISP and PROLOG for AI, etc.
● By understanding how features are implemented, you can make more efficient
use of them.
Why study programming language
6. To make it easier to design a new language
● Designing a new language require prior knowledge of previous one to make it
effective, efficient and convenient to users.
● The previous knowledge as well as concepts are usual to design a new
language irrespective of their work domains.
Programming Domains
● Computers have been applied to different areas, from controlling nuclear
power plants to providing video games in mobile phones.
● great diversity in computer use, programming languages with very different
goals have been developed.
Programming Domains
● Scientific Application (1940s and early 1950)
● Business Application (1950)
● Artificial Intelligence (1959)
● System Programming (1960s and 1970s)
● Web Software
Compilation
● A programs can be translated into machine language, which can be executed
directly on the computer
● Programming languages can be implemented by three general methods.
○ Compiler implementation
○ Pure interpretation
○ Hybrid Implementation Systems
Compiler Interpretation
● Very fast program execution, once the translation process is complete
● The language that a compiler translates is called the source language
● The process of compilation and program execution takes place in 4 phases.
○ Lexical Analyzer
○ Syntax Analyzer
○ Intermediate code generator / semantic analyzer
○ Code Generator
Compiler interpretation phases
1. Lexical Analyzer
● Gathers the characters of the source program into lexical units.
● The lexical units of a program are identifiers, special words, operators, and
punctuation symbols.
2. Syntax Analyzer
● Takes the lexical units from the lexical analyzer and uses them to construct
hierarchical structures called parse trees.
Compiler interpretation phases
3. Intermediate code generator & semantic analyzer
● produces a program in a different language, at an intermediate level between
the source program and the final output of the compiler: the machine
language program.
● The semantic analyzer checks for errors, such as type errors, that are difficult,
if not impossible, to detect during syntax analysis.
4. Code Generator
● translates the optimized intermediate code version of the
program into an equivalent machine language program.
The compilation
process
Pure Interpretation
● A programs is interpreted by another program called an interpreter, with no
translation
● It allows easy implementation of many source-level
debugging operations, because all run-time error
messages can refer to source-level units.
Hybrid implementation system
● It translate high-level language programs to an intermediate language
designed to allow easy interpretation.
● This method is faster than pure interpretation because the source language
statements are decoded only once.
● Instead of translating intermediate language code to machine code, it simply
interprets the intermediate code
Hybrid implementation
system
Preprocessors
● is a program that processes a program immediately before the program is
compiled.
● Preprocessor instructions are embedded in programs.
● Preprocessor instructions are commonly used to specify that the code from
another file is to be included.
Levels of Programming language
Types of Programming Language
● First Generation Languages
● Second Generation Languages
● Third Generation Languages
● Fourth Generation Languages
● Fifth Generation Languages
Reading assignment !
In each programming language generation,write its characteristics,
limitations and at least three examples of programming language in that
generation.
Language Categories
Programming languages are often categorized into four bins:
● Imperative Programming (C)
● Object-Oriented Programming (C++)
● Logic/Declarative Programming (Prolog)
● Functional/Applicative Programming (Lisp)
Imperative Programming
Imperative languages are command-driven or statement-oriented languages.
The basic concept is the machine state (the set of all values for all memory
locations).
A program consists if a sequence of statements and the execution of each
statement changes the machine state.
Programs take the form:
Statement1;
statement2;
Object-Oriented Programming
It is based on classes of objects.
An object has variable components and is equipped with certain operations. Only
these operations can access the object’s variable components.
A class is a family of objects with similar variable components and operations.
Eg C++, Java
Logic/Declarative Programming
It is based on a subset of predicate logic. Programs in logic programming
languages are collections of facts and rules.
Sometimes called a Rule-based or declarative languages
It execute checking to see if a particular condition is true and if so, perform the
appropriate actions.
Example
condition1 -> action 1
condition2 -> action 2
PROLOG was the ancestral logic language, and is still the most popular.
Functional/Applicative Programming
An functional programming language looks at the function that the program
represents rather than the state changes as each statement is executed.
The key question is: What function must be applied to our initial machine and our
data to produce the final result?
The ancestral functional language was LISP, ML and HASKELL are modern
functional languages.
it does support variables and assignment.
Statements take the form: function n(function1, function2, … (data)) … )
Special Programming Languages
Scripting Languages
◦ JavaScript and VBScript
◦ Php and ASP
◦ Perl and Python
Command Languages
◦ sh, csh, bash
Text processing Languages
◦ LaTex, PostScript
What determines a good language?
Readability
The quality of a language that enables a programmer to understand and
comprehend the nature of a computation easily and accurately.
Simplicity:
● Multiplicity features - that is, having more than one way to accomplish a
particular operation. (count = count + 1, count += 1, count++, ++count)
● Operator overloading- a single operator symbol has more than one meaning.
Orthogonality:
The quality of a language that features provided have as few restrictions as
possible and be combinable in any meaningful way
Readability
Data Types:
The presence of adequate facilities for defining data types and data structures in a
language is another significant aid to readability. Eg timeOut = 1 does not make
sense as timeOut = true for a boolean case.
Syntax Design:
Special words. If and endif, loop and endloop
Writability
A measure of how easily a language can be used to create programs for a chosen
problem domain.
Simplicity:
If a language has a large number of different constructs, some programmers
might not be familiar with all of them
Orthogonality:
A smaller number of primitive constructs and a consistent set of
rules for combining them (that is, orthogonality) is much better
than simply having a large number of primitives.
Writability
Support for Abstraction: the ability to define and then use complicated structures
or operations in ways that allow many of the details to be ignored.
Expressivity: it means that there are very powerful operators that allow a great
deal of computation to be accomplished eg. Loops (for and while), increments
(count++ easier than Count= Count + 1)
Reliability
A program is said to be reliable if it performs to its specifications under all
conditions
Type Checking:
Simply testing for type errors in a given program, either by the compiler or during
program execution.
● run-time type checking is expensive, compile-time type checking is more
desirable.
● failure to type check, at either compile time or run time, has led to countless
program errors eg C in variable mis-match.
Reliability
Exception Handling: The ability of a program to intercept run-time errors (as well
as other unusual conditions detectable by the program), take corrective measures,
and then continue is an obvious aid to reliability
Eg. C++, Java, Ada, C# but practically nonexistent in many widely used languages,
including C and Fortran.
Aliasing: having two or more distinct names that can be used to
access the same memory cell. Eg two pointer pointing to one cell.
Reliability
Readability and Writability:
● Programs that are difficult to read are difficult both to write and to modify.
● The easier a program is to write, the more likely it is to be correct.
Cost
● The cost of training programmers to use the language (simplicity and
orthogonality)
● The cost of writing programs in the language (writability)
● The cost of compiling programs
● The cost of executing programs (run time type checking prohibits fast code
execution)
● The cost of the language implementation system
A language whose implementation system is either expensive or runs only on
expensive hardware will have a much smaller chance of becoming widely
used.
● The cost of maintaining programs
Language evaluation criteria & the characteristics that affect them
Programming Environment
● It refers to the environment in which programs are created, designed and
tested.
● It consist of a set of support tools and command language for invoking them.
Questions?

Mais conteúdo relacionado

Mais procurados

Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languages
Varun Garg
 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer Programming
Prof. Erwin Globio
 

Mais procurados (20)

Intro to programming and how to start that career
Intro to programming and how to start that careerIntro to programming and how to start that career
Intro to programming and how to start that career
 
Theory of programming
Theory of programmingTheory of programming
Theory of programming
 
Programming languages and concepts by vivek parihar
Programming languages and concepts by vivek pariharProgramming languages and concepts by vivek parihar
Programming languages and concepts by vivek parihar
 
Chapter 1 - An Introduction to Programming
Chapter 1 - An Introduction to ProgrammingChapter 1 - An Introduction to Programming
Chapter 1 - An Introduction to Programming
 
Introduction to Programming Languages
Introduction to Programming LanguagesIntroduction to Programming Languages
Introduction to Programming Languages
 
Data structure and algorithm
Data structure and algorithmData structure and algorithm
Data structure and algorithm
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Programming Fundamentals lecture 2
Programming Fundamentals lecture 2Programming Fundamentals lecture 2
Programming Fundamentals lecture 2
 
Programming Fundamental Presentation
Programming Fundamental PresentationProgramming Fundamental Presentation
Programming Fundamental Presentation
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
 
Introduction to Programming and QBasic Tutorial
Introduction to Programming and QBasic TutorialIntroduction to Programming and QBasic Tutorial
Introduction to Programming and QBasic Tutorial
 
Algorithm and Programming (Introduction of Algorithms)
Algorithm and Programming (Introduction of Algorithms)Algorithm and Programming (Introduction of Algorithms)
Algorithm and Programming (Introduction of Algorithms)
 
CLTL python course: Object Oriented Programming (1/3)
CLTL python course: Object Oriented Programming (1/3)CLTL python course: Object Oriented Programming (1/3)
CLTL python course: Object Oriented Programming (1/3)
 
Programming Fundamentals lecture 1
Programming Fundamentals lecture 1Programming Fundamentals lecture 1
Programming Fundamentals lecture 1
 
Capturing System Behaviour
Capturing System BehaviourCapturing System Behaviour
Capturing System Behaviour
 
Computer
ComputerComputer
Computer
 
Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languages
 
Paradigms
ParadigmsParadigms
Paradigms
 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer Programming
 

Semelhante a Computer programing 111 lecture 1

Computer programming
Computer programmingComputer programming
Computer programming
Suneel Dogra
 

Semelhante a Computer programing 111 lecture 1 (20)

programming.pptx
programming.pptxprogramming.pptx
programming.pptx
 
sege.pdf
sege.pdfsege.pdf
sege.pdf
 
Introduction to computer programming
Introduction to computer programming Introduction to computer programming
Introduction to computer programming
 
English de lenguaje de programacion
English de lenguaje de programacionEnglish de lenguaje de programacion
English de lenguaje de programacion
 
Introduction Programming Languages
Introduction Programming LanguagesIntroduction Programming Languages
Introduction Programming Languages
 
Presentation-1.pptx
Presentation-1.pptxPresentation-1.pptx
Presentation-1.pptx
 
Lec21&22.pptx programing language and there study
Lec21&22.pptx programing language and there studyLec21&22.pptx programing language and there study
Lec21&22.pptx programing language and there study
 
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
 
Introduction To Computer Programming
Introduction To Computer ProgrammingIntroduction To Computer Programming
Introduction To Computer Programming
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Computer programming programming_langugages
Computer programming programming_langugagesComputer programming programming_langugages
Computer programming programming_langugages
 
Generation of Computer language by arya dutta (1).pptx
Generation of Computer language by arya dutta (1).pptxGeneration of Computer language by arya dutta (1).pptx
Generation of Computer language by arya dutta (1).pptx
 
Unit 1_Evaluation Criteria_session 3.pptx
Unit 1_Evaluation Criteria_session 3.pptxUnit 1_Evaluation Criteria_session 3.pptx
Unit 1_Evaluation Criteria_session 3.pptx
 
introduction to programming languages
introduction to programming languagesintroduction to programming languages
introduction to programming languages
 
1. reason why study spl
1. reason why study spl1. reason why study spl
1. reason why study spl
 
Programming
ProgrammingProgramming
Programming
 
Ppl 13 july2019
Ppl 13 july2019Ppl 13 july2019
Ppl 13 july2019
 
Programming language
Programming languageProgramming language
Programming language
 
PPL_Unit01 for the insem study first year.pptx
PPL_Unit01 for the insem study first year.pptxPPL_Unit01 for the insem study first year.pptx
PPL_Unit01 for the insem study first year.pptx
 
Computer programming
Computer programmingComputer programming
Computer programming
 

Mais de ITNet (20)

lecture 8 b main memory
lecture 8 b main memorylecture 8 b main memory
lecture 8 b main memory
 
lecture 9.pptx
lecture 9.pptxlecture 9.pptx
lecture 9.pptx
 
lecture 10.pptx
lecture 10.pptxlecture 10.pptx
lecture 10.pptx
 
lecture 11.pptx
lecture 11.pptxlecture 11.pptx
lecture 11.pptx
 
lecture 12.pptx
lecture 12.pptxlecture 12.pptx
lecture 12.pptx
 
lecture 13.pptx
lecture 13.pptxlecture 13.pptx
lecture 13.pptx
 
lecture 15.pptx
lecture 15.pptxlecture 15.pptx
lecture 15.pptx
 
kandegeeee.pdf
kandegeeee.pdfkandegeeee.pdf
kandegeeee.pdf
 
Ia 124 1621324160 ia_124_lecture_02
Ia 124 1621324160 ia_124_lecture_02Ia 124 1621324160 ia_124_lecture_02
Ia 124 1621324160 ia_124_lecture_02
 
Ia 124 1621324143 ia_124_lecture_01
Ia 124 1621324143 ia_124_lecture_01Ia 124 1621324143 ia_124_lecture_01
Ia 124 1621324143 ia_124_lecture_01
 
Cp 121 lecture 01
Cp 121 lecture 01Cp 121 lecture 01
Cp 121 lecture 01
 
Cp 111 5 week
Cp 111 5 weekCp 111 5 week
Cp 111 5 week
 
Teofilo kisanji university mbeya (TEKU) ambassador 2020
Teofilo kisanji university mbeya (TEKU) ambassador 2020Teofilo kisanji university mbeya (TEKU) ambassador 2020
Teofilo kisanji university mbeya (TEKU) ambassador 2020
 
Tn 110 lecture 8
Tn 110 lecture 8Tn 110 lecture 8
Tn 110 lecture 8
 
Tn 110 lecture 2 logic
Tn 110 lecture 2 logicTn 110 lecture 2 logic
Tn 110 lecture 2 logic
 
Tn 110 lecture 1 logic
Tn 110 lecture 1 logicTn 110 lecture 1 logic
Tn 110 lecture 1 logic
 
internet
internetinternet
internet
 
Im 111 lecture 1
Im 111   lecture 1Im 111   lecture 1
Im 111 lecture 1
 
development study perspective full
development study perspective fulldevelopment study perspective full
development study perspective full
 
Gender issues in developement
Gender issues in developementGender issues in developement
Gender issues in developement
 

Último

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 

Último (20)

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 

Computer programing 111 lecture 1

  • 2. COURSE OUTLINE ● An overview of programming languages ● Basic Concepts ● Names, Bindings, and Scopes ● Data Types ● Expressions and Assignment Statements ● Basic Program Structure and the Integrated Development Environment ● Algorithm Development Using Pseudocode ● Decision structures ● Loop Structures
  • 3. COURSE ACTIVITIES ● 3 Reading AssignmentS ● 3 TESTS (NOV, DEC & JAN) ● 3 QUIZZES ● Tutorials ● 9 Lecturers ● 1 University Examination
  • 5. What is programming language ● A programming language is a set of rules that provides a way of telling a computer what operations to perform. ● A programming language is a notational system for describing computation in a machine-readable and human-readable form. ● A programming language also has words, symbols and rules of grammar.
  • 6. What is programming language ● Tool for instructing machine ● Means for communicating between programmers ● Vehicle for expressing high level design ● It acts as a tool for experiment ● Controlling computerized devices
  • 7. Why study programming language ? There are various reason regarding the study of programming languages but following are six main reasons
  • 8. Why study programming language 1. Increased capacity to express ideas. ● The depth at which people can think is heavily influenced by the expressive power of their language. ● Example use of drawings have helped people express themselves.
  • 9. Why study programming language 2. Improved background for choosing appropriate languages. ● Many professional programmers have a limited formal education in computer science, limited to a small number of programming languages. ● They are more likely to use languages with which they are most comfortable than the most suitable one for a particular job. ● If these programmers were familiar with a wider range of languages and language constructs, they would be better able to choose the language with the features that best address the problem.
  • 10. Why study programming language 3. Increased ability to learn new languages. ● Computer science is considered as a ever growing discipline especially most software technologies ● programming languages are not yet mature. Therefore, they are still evolving. ● The understanding of programming language design and implementation makes it easier to learn new languages.
  • 11. Why study programming language 4. Better understanding of the significance of implementation.. ● It is often necessary to learn about language implementation; it can lead to a better understanding of why the language was designed the way that it was. ● Fixing some bugs requires an understanding of implementation issues.
  • 12. Why study programming language 5. Better use of languages that are already known. ● Some languages are better for some jobs than others. (i) FORTRAN and APL for calculations, COBOL and RPG for report generation, LISP and PROLOG for AI, etc. ● By understanding how features are implemented, you can make more efficient use of them.
  • 13. Why study programming language 6. To make it easier to design a new language ● Designing a new language require prior knowledge of previous one to make it effective, efficient and convenient to users. ● The previous knowledge as well as concepts are usual to design a new language irrespective of their work domains.
  • 14. Programming Domains ● Computers have been applied to different areas, from controlling nuclear power plants to providing video games in mobile phones. ● great diversity in computer use, programming languages with very different goals have been developed.
  • 15. Programming Domains ● Scientific Application (1940s and early 1950) ● Business Application (1950) ● Artificial Intelligence (1959) ● System Programming (1960s and 1970s) ● Web Software
  • 16. Compilation ● A programs can be translated into machine language, which can be executed directly on the computer ● Programming languages can be implemented by three general methods. ○ Compiler implementation ○ Pure interpretation ○ Hybrid Implementation Systems
  • 17.
  • 18. Compiler Interpretation ● Very fast program execution, once the translation process is complete ● The language that a compiler translates is called the source language ● The process of compilation and program execution takes place in 4 phases. ○ Lexical Analyzer ○ Syntax Analyzer ○ Intermediate code generator / semantic analyzer ○ Code Generator
  • 19. Compiler interpretation phases 1. Lexical Analyzer ● Gathers the characters of the source program into lexical units. ● The lexical units of a program are identifiers, special words, operators, and punctuation symbols. 2. Syntax Analyzer ● Takes the lexical units from the lexical analyzer and uses them to construct hierarchical structures called parse trees.
  • 20. Compiler interpretation phases 3. Intermediate code generator & semantic analyzer ● produces a program in a different language, at an intermediate level between the source program and the final output of the compiler: the machine language program. ● The semantic analyzer checks for errors, such as type errors, that are difficult, if not impossible, to detect during syntax analysis. 4. Code Generator ● translates the optimized intermediate code version of the program into an equivalent machine language program.
  • 22. Pure Interpretation ● A programs is interpreted by another program called an interpreter, with no translation ● It allows easy implementation of many source-level debugging operations, because all run-time error messages can refer to source-level units.
  • 23. Hybrid implementation system ● It translate high-level language programs to an intermediate language designed to allow easy interpretation. ● This method is faster than pure interpretation because the source language statements are decoded only once. ● Instead of translating intermediate language code to machine code, it simply interprets the intermediate code
  • 25. Preprocessors ● is a program that processes a program immediately before the program is compiled. ● Preprocessor instructions are embedded in programs. ● Preprocessor instructions are commonly used to specify that the code from another file is to be included.
  • 27. Types of Programming Language ● First Generation Languages ● Second Generation Languages ● Third Generation Languages ● Fourth Generation Languages ● Fifth Generation Languages
  • 28. Reading assignment ! In each programming language generation,write its characteristics, limitations and at least three examples of programming language in that generation.
  • 29.
  • 30. Language Categories Programming languages are often categorized into four bins: ● Imperative Programming (C) ● Object-Oriented Programming (C++) ● Logic/Declarative Programming (Prolog) ● Functional/Applicative Programming (Lisp)
  • 31. Imperative Programming Imperative languages are command-driven or statement-oriented languages. The basic concept is the machine state (the set of all values for all memory locations). A program consists if a sequence of statements and the execution of each statement changes the machine state. Programs take the form: Statement1; statement2;
  • 32. Object-Oriented Programming It is based on classes of objects. An object has variable components and is equipped with certain operations. Only these operations can access the object’s variable components. A class is a family of objects with similar variable components and operations. Eg C++, Java
  • 33. Logic/Declarative Programming It is based on a subset of predicate logic. Programs in logic programming languages are collections of facts and rules. Sometimes called a Rule-based or declarative languages It execute checking to see if a particular condition is true and if so, perform the appropriate actions. Example condition1 -> action 1 condition2 -> action 2 PROLOG was the ancestral logic language, and is still the most popular.
  • 34. Functional/Applicative Programming An functional programming language looks at the function that the program represents rather than the state changes as each statement is executed. The key question is: What function must be applied to our initial machine and our data to produce the final result? The ancestral functional language was LISP, ML and HASKELL are modern functional languages. it does support variables and assignment. Statements take the form: function n(function1, function2, … (data)) … )
  • 35. Special Programming Languages Scripting Languages ◦ JavaScript and VBScript ◦ Php and ASP ◦ Perl and Python Command Languages ◦ sh, csh, bash Text processing Languages ◦ LaTex, PostScript
  • 36. What determines a good language?
  • 37. Readability The quality of a language that enables a programmer to understand and comprehend the nature of a computation easily and accurately. Simplicity: ● Multiplicity features - that is, having more than one way to accomplish a particular operation. (count = count + 1, count += 1, count++, ++count) ● Operator overloading- a single operator symbol has more than one meaning. Orthogonality: The quality of a language that features provided have as few restrictions as possible and be combinable in any meaningful way
  • 38. Readability Data Types: The presence of adequate facilities for defining data types and data structures in a language is another significant aid to readability. Eg timeOut = 1 does not make sense as timeOut = true for a boolean case. Syntax Design: Special words. If and endif, loop and endloop
  • 39. Writability A measure of how easily a language can be used to create programs for a chosen problem domain. Simplicity: If a language has a large number of different constructs, some programmers might not be familiar with all of them Orthogonality: A smaller number of primitive constructs and a consistent set of rules for combining them (that is, orthogonality) is much better than simply having a large number of primitives.
  • 40. Writability Support for Abstraction: the ability to define and then use complicated structures or operations in ways that allow many of the details to be ignored. Expressivity: it means that there are very powerful operators that allow a great deal of computation to be accomplished eg. Loops (for and while), increments (count++ easier than Count= Count + 1)
  • 41. Reliability A program is said to be reliable if it performs to its specifications under all conditions Type Checking: Simply testing for type errors in a given program, either by the compiler or during program execution. ● run-time type checking is expensive, compile-time type checking is more desirable. ● failure to type check, at either compile time or run time, has led to countless program errors eg C in variable mis-match.
  • 42. Reliability Exception Handling: The ability of a program to intercept run-time errors (as well as other unusual conditions detectable by the program), take corrective measures, and then continue is an obvious aid to reliability Eg. C++, Java, Ada, C# but practically nonexistent in many widely used languages, including C and Fortran. Aliasing: having two or more distinct names that can be used to access the same memory cell. Eg two pointer pointing to one cell.
  • 43. Reliability Readability and Writability: ● Programs that are difficult to read are difficult both to write and to modify. ● The easier a program is to write, the more likely it is to be correct.
  • 44. Cost ● The cost of training programmers to use the language (simplicity and orthogonality) ● The cost of writing programs in the language (writability) ● The cost of compiling programs ● The cost of executing programs (run time type checking prohibits fast code execution) ● The cost of the language implementation system A language whose implementation system is either expensive or runs only on expensive hardware will have a much smaller chance of becoming widely used. ● The cost of maintaining programs
  • 45. Language evaluation criteria & the characteristics that affect them
  • 46. Programming Environment ● It refers to the environment in which programs are created, designed and tested. ● It consist of a set of support tools and command language for invoking them.