COMP302: Programming Languages and Paradigms
Prof. (Sec 01) Francisco Ferreira (Sec 02)
School of Computer Science Mc
Copyright By PowCoder代写 加微信 powcoder
Week 1-1 , Fall 2017
COMP 302: Overview
Prerequisite Evaluation
Late days Office
Office hours
TA’s Website
Thorough introduction to the foundations and paradigms of programming languages.
COMP 250 or COMP 203 • Five homeworks (25%)
• Midterm (10 %) • Final (65%)
You have two late days for homeworks
Prof. B. Pientka’s office is in Mc . 107N. Prof. F. Ferreira’s office hours are in Trottier 3110 Prof. B. Pientka: Tue, Thu 11:30am – 12:30pm
Thu 4:00pm – 5:30pm Prof. F. Ferreira: Tue: 3:00pm – 5:00pm
See My Courses
On MyCourses
Prof. B. Pientka COMP302: Programming Languages and Paradigms 2 / 26
Short Bio:
– Studied CS at the Technical University Darmstadt
(Germany) and at the University of Edinburgh
– Visiting Researcher at Cornell University
– PhD in Computer Science at CMU
– Professor at McGill since 2003
Fun: Everying to do with food (cooking, growing veg- etables, etc.); Reading books (mysteries,biographies); Swimming, biking, hiking
Short Bio: Francisco Ferreira
– Ugrad. degree in Computer Science in Argentina – MSc from Universit ́e de Montr ́eal
– PhD Student in Computer Science at McGill
– Worked in the telecom and gaming industries.
Fun: I love photography, travelling and being a nerd. I like biking and Italian food.
Prof. B. Pientka
COMP302: Programming Languages and Paradigms 3 / 26
Programming Languages we use (or have used)
• Programming languages we use (or have used)
Agda – Beluga – C – Haskell – Java – Latex – Lisp – Modula-2 – Ocaml – Pascal – Perl – PHP – Prolog – Python – Ruby – Scheme – SML – SQL – Twelf …
Prof. B. Pientka COMP302: Programming Languages and Paradigms 4 / 26
Programming Languages we use (or have used)
• Programming languages we use (or have used)
Agda – Beluga – C – Haskell – Java – Latex – Lisp – Modula-2 – Ocaml – Pascal – Perl – PHP – Prolog – Python – Ruby – Scheme – SML – SQL – Twelf …
• Research we do: Foundations of Programming Languages, Logic, Verification, Automated Reasoning, Logical frameworks, Type Theory
Prof. B. Pientka COMP302: Programming Languages and Paradigms 4 / 26
Teaching Assistants
Short Bio: (Msc. Student)
Work Programming Lang., Compilers
Fun Loves to dance, and occassionally to climb down
the sides of 20-storey building
About Functional Programming:
“ Pattern matching is so powerful and elegant! […] it’s hard for me to return to languages with- out pattern-matching capabilities.”
Short Bio: (U3 Honours Soft. Eng.) Work Cyber security (mostly in mobile apps)
Fun Enjoys working, reading and drinking coffee; has
a cat named Pixel
What is the coolest thing in Functional Programming?
“Higher-order functions; relatively simple once
mastered yet very powerful and they make you
look awesome! ”
Prof. B. Pientka
COMP302: Programming Languages and Paradigms 5 / 26
Teaching Assistants
Short Bio: (Msc. in CS)
Work Applying reinforcement learning to the develop-
ment of an artificial pancreas
Fun run, climb, knit, and consume podcasts.
About Functional Programming:
“The Curry is really neat!”
Short Bio: (MSc. in CS)
Work Natural Language Processing, machine learning Fun Explore Montreal with friends, food, discover-
ing restaurants, ice cream shops, cafes and parks around the city.
What is the coolest thing in Functional Programming?
“How much it can achieve with so few lines of code. I remember some questions on assign- ments in COMP 302 that were not at all trivial,
yet could be answered with a single line of code.”
Prof. B. Pientka
COMP302: Programming Languages and Paradigms 6 / 26
Teaching Assistants
Short Bio:
Work MSc. in CS
Fun Coaching the McGill division 2 league of legends
About Functional Programming:
“Higher order functions are super cool!”
Short Bio:
Work (U3) student majoring in Computer Science and
minoring in Communications
Fun Travel and explore new places to eat and shop;
Intern at Microsoft (Vancouver)
What is the coolest thing in Functional Programming?
“The lack of side effects when your code works, you know exactly why it works and how it will behave. ”
Prof. B. Pientka
COMP302: Programming Languages and Paradigms 7 / 26
Teaching Assistants
Short Bio:
Work U4, Mathematics & Computer Science.
Fun listening to and making music; speaks the con-
structed language Lojban.
About Functional Programming:
“The coolest thing about functional program- ming is how easy it is to design and implement new languages.”
Short Bio: Leila Fabing
Work Biology and Computer Science Joint Major Fun Food; cooking, hosting avid dinner party hosting;
the Malaysian and Singaporean Students Assoc.
What is the coolest thing in Functional Programming?
“I loved how svelte and yet powerful functional programming is, it really changes the way you conceive and process your code. ”
Prof. B. Pientka
COMP302: Programming Languages and Paradigms 8 / 26
Does it matter in which Section I am enrolled in?
Prof. B. Pientka COMP302: Programming Languages and Paradigms 9 / 26
Does it matter in which Section I am enrolled in? – NO
• Same material and slides
• Same homeworks
• Same exams
• Come to each of us for questions!
• Choose the office hours and lecture times that work best for your
Prof. B. Pientka COMP302: Programming Languages and Paradigms 10 / 26
The four main goals of COMP 302
Prof. B. Pientka COMP302: Programming Languages and Paradigms 11 / 26
The four main goals of COMP 302
1. Provide a thorough introduction to fundamental concepts in programming languages
Higher-order functions, State-full vs state-free computation, Modelling objects and closures, Exceptions to defer control, Continuations to defer control, Polymorphism, Partial evaluation, Lazy programming, Modules, . . .
Prof. B. Pientka COMP302: Programming Languages and Paradigms 11 / 26
The four main goals of COMP 302
1. Provide a thorough introduction to fundamental concepts in programming languages
Higher-order functions, State-full vs state-free computation, Modelling objects and closures, Exceptions to defer control, Continuations to defer control, Polymorphism, Partial evaluation, Lazy programming, Modules, . . .
2. Show different ways to reason about programs
Type checking, Induction, Operational semantics, QuickCheck, . . .
Prof. B. Pientka COMP302: Programming Languages and Paradigms 11 / 26
The four main goals of COMP 302
1. Provide a thorough introduction to fundamental concepts in programming languages
Higher-order functions, State-full vs state-free computation, Modelling objects and closures, Exceptions to defer control, Continuations to defer control, Polymorphism, Partial evaluation, Lazy programming, Modules, . . .
2. Show different ways to reason about programs
Type checking, Induction, Operational semantics, QuickCheck, . . .
3. Introduce fundamental principles in programming language design Grammars and parsing, Operational semantics and interpreters, Type checking, polymorphism, and subtyping
Prof. B. Pientka COMP302: Programming Languages and Paradigms 11 / 26
The four main goals of COMP 302
1. Provide a thorough introduction to fundamental concepts in programming languages
Higher-order functions, State-full vs state-free computation, Modelling objects and closures, Exceptions to defer control, Continuations to defer control, Polymorphism, Partial evaluation, Lazy programming, Modules, . . .
2. Show different ways to reason about programs
Type checking, Induction, Operational semantics, QuickCheck, . . .
3. Introduce fundamental principles in programming language design Grammars and parsing, Operational semantics and interpreters, Type checking, polymorphism, and subtyping
4. Expose students to a different way of thinking about problems It’s like going to the gym; it’s good for you!
Prof. B. Pientka COMP302: Programming Languages and Paradigms 11 / 26
How we achieve these goals
Prof. B. Pientka COMP302: Programming Languages and Paradigms 12 / 26
How we achieve these goals
This course: functional programming in OCaml
• Equal playing field
• Allows us to explain and model object-oriented and imperative programming
• Isolates concepts such as state-full vs state-free, modules and functions, etc.
• Statically typed language enforces disciplined programming also demonstrates that types are important maintenance tool
• Easy to reason about runtime behavior and cost
Prof. B. Pientka COMP302: Programming Languages and Paradigms 12 / 26
Guiding Principle #1
“A language that doesn’t affect the way you think about programming, is not worth knowing.“ – A. Perlis
Prof. B. Pientka COMP302: Programming Languages and Paradigms 13 / 26
Guiding Principle #2
”Simple, elegant solutions are more effective, but they are harder to find than complex ones, and they require more time, which we too often believe to be unaffordable.” – N. . B. Pientka COMP302: Programming Languages and Paradigms 14 / 26
Why do I need to know this?
• Science and craft of programming
Prof. B. Pientka COMP302: Programming Languages and Paradigms 15 / 26
Why do I need to know this?
• Science and craft of programming
• Skills you learn will help you become a better programmer
more productive, code is easier to maintain and read, etc.
Prof. B. Pientka COMP302: Programming Languages and Paradigms 15 / 26
Why do I need to know this?
• Science and craft of programming
• Skills you learn will help you become a better programmer
more productive, code is easier to maintain and read, etc. • Needed in some upper level courses
Prof. B. Pientka COMP302: Programming Languages and Paradigms 15 / 26
Why do I need to know this?
• Science and craft of programming
• Skills you learn will help you become a better programmer
more productive, code is easier to maintain and read, etc. • Needed in some upper level courses
• It is cool stuff! And it is fun!
Prof. B. Pientka COMP302: Programming Languages and Paradigms 15 / 26
Why do I need to know this?
• Science and craft of programming
• Skills you learn will help you become a better programmer
more productive, code is easier to maintain and read, etc.
• Needed in some upper level courses
• It is cool stuff! And it is fun!
• You might even get a job!
Financial and banking sector; for example Capital Facebook (Facebook Messenger is 50% OCaml)
Prof. B. Pientka COMP302: Programming Languages and Paradigms 15 / 26
General words of wisdom
What does a good student do?
Prof. B. Pientka COMP302: Programming Languages and Paradigms 16 / 26
General words of wisdom
What does a good student do?
Prof. B. Pientka COMP302: Programming Languages and Paradigms 16 / 26
General words of wisdom
What does a good professor do?
Prof. B. Pientka COMP302: Programming Languages and Paradigms 17 / 26
Collaboration policy and academic integrity
• All work submitted must represent your own efforts. • Assignments may be done in groups of 2.
– Honors pledge :
”We certify that both partners contributed equally to the work
submitted here and that it represents solely our own efforts.”
– List both team members with their name and student ID at the top of each file submitted.
– Splitting the problem set in equal parts where one team member solves part A and the other independently solves part B is not allowed.
• Copying solutions completely or partially is not allowed.
• Allowing others to copy your solutions is not acceptable. You are responsible of protecting your work. Make sure your files and directories are not public!
Prof. B. Pientka COMP302: Programming Languages and Paradigms 18 / 26
Collaboration and academic integrity
Let’s practice.
Prof. B. Pientka COMP302: Programming Languages and Paradigms 19 / 26
Scenario 1
Alice and Bob agreed to be in one team and have started to work already on question 1 of the homework. After COMP 330, Matt and Bob have coffee together and start talking about question 2 of the COMP 302 homework.
They start sketching the idea on paper. Matt wants to see if their ideas work. He takes out his laptop and types up the solution. It works! He sends the solution to Bob via email and they happily split. A week later, Alice and Bob submit the solution to Q2; Matt also submits the same solution.
Prof. B. Pientka COMP302: Programming Languages and Paradigms 20 / 26
Scenario 1
Alice and Bob agreed to be in one team and have started to work already on question 1 of the homework. After COMP 330, Matt and Bob have coffee together and start talking about question 2 of the COMP 302 homework.
They start sketching the idea on paper. Matt wants to see if their ideas work. He takes out his laptop and types up the solution. It works! He sends the solution to Bob via email and they happily split. A week later, Alice and Bob submit the solution to Q2; Matt also submits the same solution.
Is the behaviour of Alice, Bob, and Matt in line with the copyright and collaboration policy of this course?
Prof. B. Pientka COMP302: Programming Languages and Paradigms 20 / 26
Scenario 2
Alice and Bob agreed to be in one team and have started to work already on question 1 of the homework. Alice talks over skype with Amy and she mentions that she and Bob are really stuck on Q3 of the COMP302 homework. Amy clears up her misunderstanding and gives her a hint. Alice then meets with Bob and explains how to go about solving Q3.
Prof. B. Pientka COMP302: Programming Languages and Paradigms 21 / 26
Scenario 2
Alice and Bob agreed to be in one team and have started to work already on question 1 of the homework. Alice talks over skype with Amy and she mentions that she and Bob are really stuck on Q3 of the COMP302 homework. Amy clears up her misunderstanding and gives her a hint. Alice then meets with Bob and explains how to go about solving Q3.
Is the behaviour of Amy, Alice, and Bob in line with the copyright and collaboration policy of this course?
Prof. B. Pientka COMP302: Programming Languages and Paradigms 21 / 26
Scenario 3
Alice and Bob work together on HW 5 and have decided to use the version control provided by github to better collaborate.
John is really stuck on HW 5 and starts browsing the resources available on the internet. He finds their github directory, copies their work. He changes the names of some of the helper functions, and submits it.
The TAs notice that there are two identical solutions modulo renaming some of the helper functions – but the code is otherwise identical.
Prof. B. Pientka COMP302: Programming Languages and Paradigms 22 / 26
Scenario 3
Alice and Bob work together on HW 5 and have decided to use the version control provided by github to better collaborate.
John is really stuck on HW 5 and starts browsing the resources available on the internet. He finds their github directory, copies their work. He changes the names of some of the helper functions, and submits it.
The TAs notice that there are two identical solutions modulo renaming some of the helper functions – but the code is otherwise identical.
What happens? Who is in violation of the student code of conduct at McGill?
Prof. B. Pientka COMP302: Programming Languages and Paradigms 22 / 26
Last but not least . . .
Some advice . . .
Prof. B. Pientka COMP302: Programming Languages and Paradigms 23 / 26
How to do well in COMP 302?
• Come to class
• Read the notes
• Do the homework • Ask questions
Prof. B. Pientka COMP302: Programming Languages and Paradigms 24 / 26
Talk to us
• If you are worried you will fail, talk to us.
• If you don’t understand the homework problem, talk to us. • If you don’t understand the class material, talk to us.
Post your questions on the discussion board!
Prof. B. Pientka COMP302: Programming Languages and Paradigms 25 / 26
Zeroth Assignment
• Install OCaml on your laptop, if you don’t use the labs
• Check out ocaml.org!
• Check the FAQ on the course website on myCourses.
• Read about some of the use of OCaml in industry. https://ocaml.org/learn/companies.html
Prof. B. Pientka COMP302: Programming Languages and Paradigms 26 / 26
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com