Programming Paradigms
Overview of the course
• Course overview
Copyright By PowCoder代写 加微信 powcoder
• Introduction to programming paradigms
• Review: The object-oriented paradigm in Java
• Imperative and concurrent programming paradigm: Go.
• Logic paradigm: Prolog.
• Functional paradigm: Scheme.
Acknowledgement
• The slides posted through the term are based of the slides offered by:
–Prof. –Prof. Jochen Lang
Prof: Email:
Programming Paradigms
Course Overview
Key Questions
Why study programming paradigms? Who are we? Who are you?
What are we doing?
How will we be doing it?
References
https://uottawa.brightspace.com
https://www.uottawa.ca/vice-president-academic/academic-integrity 5
Why study programming paradigms?
What is CSI2120 about?
Learning different programing paradigm Learning different styles of coding
Learning new programming languages
Writing code efficiently.
Choose the best paradigm/combined paradigms for a specific program.
Who are we? → Staff
Prof: Office: STE 0110C
Office Hours: Monday, 1:00 – 2:00 pm (tentative)or by appointment (Always check BrightSpace for changes)
Who are we? → Staff Check BrightSpace
Teaching Assistants
•Will organize Lab sessions
•Will organize /tutorial sessions
•Will have office hour as needed
•Will be the first helper for your questions
Who are you?
Second year students
Assumes solid foundation in programming fundamentals,
including:
Data Structures
Object oriented programming (Java), recursion and lists.
How will we do it?
Course Delivery
Lectures will include
slides (with some blank sections for discussions) some notes made on virtual whiteboard
Questions are welcome!
Key Point: Slides are not meant to be used by themselves
must supplement with readings from the course text and notes taken in class
How will we do it?
Course syllabus
Course Description
Learning objectives
Attendance
Textbooks/References Grading Scheme
Course Policies
How will we do it?
uOttawa Values
Honesty, trust, fairness, respect and responsibility
see https://www.uottawa.ca/vice-president-academic/academic-
Avoid Cheating
Do your own work.
If you have an error it is OK to check on web what error means.
Tu 4:00 – 5:20PM Th 2:30 – 3:50PM
Adobe Connect
Th 4:00 – 5:20PM
4 live sessions 12 recorded
M 8:30 – 9:50 AM (3)
Th 10:00 – 11:20 AM (2)
TH 11:30 AM- 12:50 PM
Course components
3 hours lectures weekly 1.5 lab hours weekly
1.5 Tutorial weekly
No Labs and Tutorial in the first week of classes.
Labs and Tutorials starts on the second week (Starting Monday Jan 17th)
Course components
1.5 lab hours weekly(live via Teams/Zoom)
2% bonus
Need to upload your work to BrightSpace 1% for 50% uploads
2% for 75% uploads
Upload your file by Saturday 11:30 pm
Course components
1.5 Tutorial hours weekly(asynchronous, recoding tutorial will be posted)
4 live sessions
References
Allen B. Tucker and . Noonan, Programming Languages: Principles and Paradigms, McGraw Hill, 2nd ed., 2007.
and , Programming Languages: Principles and Paradigms, Springer, 2010. available on-line from the library.
Online references
• Prolog Programming
• R. , The Scheme Programming Language , (4th
ed.), MIT Press.
• The Go Programming Language
• SWI Prolog
• The Racket language
• MIT Scheme • Go
Evaluation – Grade Breakdown
A maximum of 100 marks will be available. The division is as follows:
Online quizzes
Assignment
Comprehensive/Project assignment
Final Exam (F)
and a 2% bonus for participation in the labs
To pass the course you must get at least 50% in the final of exams.
Midterm exam
No Midterm
Online quizzes
9 quizzes (3 per language) score 0.0 (no submission)
0.5 (for effort)
or 1.0 (if an [almost] correct answer is submitted).
Online through BrightSpace Class time/ extended time
Assignments
The comprehensive assignment :
• One algorithm (4 languages (Java, Go, Prolog and Scheme) 32%)
3 regular assignments, one per language : • (Go, Prolog and scheme) 24%
Assignment are uploaded through Brightspace. Email submissions are not acceptable .
Late submission is accepted for Penalty. Late submission is accepted for two day with penalty (1 % minus each late hour.)
Assignments
Success factors
Attending classes Relationship of Attendance vs. Grades
Ref: Prof.
Success factors
Note-Taking
Ref: Prof.
Introduction to Programming Paradigms
• What is programming? • What is Paradigms?
• Examples of paradigms
Paradigms and Programming
Paradigm:
“a theory or a group of ideas about how something should be
done, made, or thought about” (Merriam-Webster).
Programming paradigms are a way to classify programming languages based on their features. Languages can be classified into multiple paradigms.
Paradigms and Programming
Computer Programming:
“Computer programming … is a process that leads from an original formulation of a computing problem to executable computer programs.” (Wikipedia).
More Comprehensive View of Programming
Programming
“… involves activities such as analysis, developing understanding, generating algorithms, verification of requirements of algorithms including their correctness and resources consumption, and implementation (commonly referred to as coding) of algorithms in a target programming language.” (Wikipedia).
Programming Language
A Programming Language
“is a formal language that specifies a set of instructions that can be used to produce various kinds of output. Programming languages generally consist of instructions for a computer. Programming languages can be used to create programs that implement specific algorithms.” (Wikipedia).
Programmer (Software Engineer)
A Programmer,
computer programmer, developer, coder, or software engineer is a person who writes computer software. ” (Wikipedia, accessed Jan, 2018).
Source: US Army
Language Implementing the
There is no single best paradigm for all applications.
Problems can be solved based on one or the other paradigm.
Many Paradigms exist:
object-oriented programming,
logic programming,
functional programming,
imperative programming,
scripting or dynamic programming,
declarative programming,
aspect-oriented programming,
concurrent programming, and others …
Familiar Programming Paradigms
Imperative paradigm
views program as a sequence of commands which change the
state of the program
Prominent example language: C
Familiar Programming Paradigms
Object-oriented paradigm
Solution is described by a set of classes providing
encapsulation.
Class relationships include inheritance and message passing. Polymorphism
Prominent example language: Java
Logic Programming Paradigm
Describes the facts and rules about a problem and the desired program outcome and not the individual steps of the solution.
Logic programming paradigm
views programs as a set of constraints,
requires programs to produce different (or even all) solutions, and considers programs non-deterministic
Prominent example language covered in this course Prolog
Functional Programming Paradigm
Functional programming is inspired by mathematical functions as a mapping from an input domain to an output range.
Functional paradigm
compose different functions to achieve a solution uses often recursive solutions
functions without side effects
Prominent example language covered in this course: Scheme
Functional (Applicative) Programming
The following definitions can be found on language list site:
“Functional Language: In the narrow sense, a functional language is one that operates by use of higher-order functions, building operators that manipulate functions directly without ever appearing to manipulate data.”
“Applicative Language: A language that operates by application of functions to values, with no side effects. A functional language in the broad sense.”
Concurrent Programming
Concurrent computing is a form of computing in which several computations are
executed concurrently—during overlapping time periods—instead of sequentially, with one completing before the next starts.
• Go—for system programming, with a concurrent programming model based on CSP
Concurrent Programming
Concurrency vs. Parallelism
Shared variable Race condition Deadlocks
int f ( int X )
{if(X< 0)return-1;else if(X==0)return 0;else
return X+f(X-1);
f( X, -1 ) :- X < 0,
f(!.0, 0 ) :-
f(!.X, F ) :- X1 is X - 1, f( X1, F1 ), F is X + F1.
• the neck :- symbol,
• the cut ! symbol,
• the is predicate in arithmetic,
• capital letters in variable names, • dots terminate clauses.
(define f (lambda (X)
(cond ((< X 0) -1) ((=X0) 0)
(else (+ X (f (- X 1)))) )))
Why study different paradigms?
Understanding programming at the abstract level will lead to a better overall understanding of programming
Different problems, different challenges benefit from different approaches
Knowing many languages helps to learn new languages
To be able to chose the best paradigm and language for a new task
Influential Programming
(until 1990, according to )
1957 FORTRAN 1958 ALGOL 1960 LISP 1960 COBOL 1962 APL
1962 SIMULA 1964 BASIC 1964 PL/I 1966 ISWIM 1970 Prolog 1972 C
1975 Pascal 1975 Scheme
1980 dBASE II 1983 Smalltalk-80 1983 Ada
1983 Parlog
1984 Standard ML 1986 C++
1986 CLP(R)
1986 Eiffel
1988 Mathematica
1988 Oberon 1989 HTML 1990 Haskell 1990 Python 1993 R
1994 Delphi 1995 Javascript 1995 Ruby 1995 Java 2000 C#
2014 Swift 2011 Kotlin
Alphabetical High-level Language Overview
ADA: created at for the American DoD, supports concurrency, synchronous message passing
Algol: close to mathematical notation, machine-independent description of algorithms
ANSI C: standardized C increasing portability and prototyping
APL: K. Iverson, mathematical programming (matrices, vectors) but difficult to read
B: K. Thompson, simple compilation, original language for UNIX
BASIC: J. Kemeny, T. Kurtz, Simple language, made programming widely accessible to engineering
C: B.W. Kernigham, D.M. Ritchie, system programming, non-restrictive language, close to machine instructions
C++: B. Stroustrup, object-oriented C, hybrid language, abstract data types, templates.
Alphabetical High-level Language Overview
C#:hybridbetweenC++andJava,usedforMicrosoftplatform.Net
COBOL:COmmonBusiness-OrientedLanguage(createdbyGraceHopper),business,finance,
management; verbose to ease general understanding.
COMMONLISP:LISPdialectthatunifiesthedifferentLISPdialects,tentativestandard.
CPL:NorthAmericanequivalentofAlgol,butclosertomachineinstructions.
Eiffel:B.Meyer,object-orientedlanguage,createdtosupport“designbycontract”
FORTRAN:createdbyJ.BackusfortheIBM704,effectivecoding.
Go:CreatedbyRobertGriesemer,RobPike,andKenThompsonatGoogle.Compiledand statically typed language with garbage collection and concurrent programming features.
Java:designedasa“better”C++withcloseradherencetoOOparadigm;createdbyJ.Gosling at Sun.
JavaScript:
LISP:J.McCarthy,artificialintelligence,theoremproving,(emacs);basedonasingledata structure, lists.
Alphabetical High-level Language Overview
Miranda: D. Turner: first commercial purely functional language, lazy evaluation.
ML: R. Milner, strongly typed, functional language with inference
Pascal: functional, originally created by N. Wirth for teaching.
PL/I: IBM and Share 3by3, universal language, originally developed for mainframe computers.
Prolog: Created by with , mainly expert systems, artificial intelligence and data bases, now ISO standard.
Python: Created by Guido van Rossum (1991), interpreted, dynamic type system and automatic memory management. Multiple programming paradigms.
R: For statistical data analysis with graphics. Simple, effective and extensible programming language.
Scheme: MIT, LISP dialect, originally created for teaching.
Simula: K. Nygaard, O.J. Dahl, simulation, introduced the notion of a class.
SmallTalk: A. Kay, first object-oriented language, objects, message passing. Designed for graphical environments (windows).
Swift: Apple’s successor to Objective-C. Multi-paradigm.
Conclusion
Analyze new programming paradigms Learn new languages
Get an overview of other paradigms.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com