Org Why FP Comp C# Comp F# Run JS Introduction – Part R Radu Nicolescu Department of Computer Science University of Auckland 16 July 2018 1 / 32
Org Why FP Comp C# Comp F# Run JS 1 Organisation and Contents 2 Why FP? 3 Compiling and running C# 4 Compiling and running F# 5 Running JS 2 / 32
Org Why FP Comp C# Comp F# Run JS Outline 1 Organisation and Contents 2 Why FP? 3 Compiling and running C# 4 Compiling and running F# 5 Running JS 3 / 32
Org Why FP Comp C# Comp F# Run JS People • Part R • Lecturer: Radu r.nicolescu@ • Tutor: James jcoo092@ • Part M • Lecturer: Mano s.manoharan@ • Tutor: Mano s.manoharan@ • Canvas pages and announcements are official communication from teaching staff • Questions: we are happy to take verbal questions (e.g. after lectures, tutorials, or any time when we are free) • Piazza is mostly for students discussion 4 / 32
Org Why FP Comp C# Comp F# Run JS Course materials • All course materials in part R – lectures, assignments, links, ... – are also available in one single location: https://www.cs.auckland.ac.nz/courses/ compsci335s2c/lectures/radu/ • Of course, these are also linked from Canvas / Modules: • slides are for online study only • handouts are recommended for printing • samples are mandatory 5 / 32
Org Why FP Comp C# Comp F# Run JS Organisation • Three lectures per week: handouts, slides, samples, additional readings – requires homework • Three tutorials per week, repeating the same topics: highly recommended – immediately after the lectures • Assignments: 20% of total course marks, 10% for each part • Test: 20% of total course marks – likely MCQ • Exam: 60% of total course marks – likely MCQ • Office hours: by appointment or immediately after the teaching? 6 / 32
Org Why FP Comp C# Comp F# Run JS Contents – two parts • Part R (weeks 1–2, 7–10): Introduction to functional programming (FP) and its applications to REST services, data XML and SQL • We emphasize fundamental concepts • Concepts illustrated in languages such as: C#, Node/JS, F# – synchronous features mostly • Time permitting: async/await concepts, currently in C#, F#; expected in JS – out of the callback hell • Part M (weeks 3–6, 11–12): Web clients, Web application performance, Web application security, ... 7 / 32
Org Why FP Comp C# Comp F# Run JS Contents – two parts • Part R (weeks 1–2, 7–10): Introduction to functional programming (FP) and its applications to REST services, data XML and SQL • We emphasize fundamental concepts • Concepts illustrated in languages such as: C#, Node/JS, F# – synchronous features mostly • Time permitting: async/await concepts, currently in C#, F#; expected in JS – out of the callback hell • Part M (weeks 3–6, 11–12): Web clients, Web application performance, Web application security, ... 7 / 32
Org Why FP Comp C# Comp F# Run JS Outline 1 Organisation and Contents 2 Why FP? 3 Compiling and running C# 4 Compiling and running F# 5 Running JS 8 / 32
Org Why FP Comp C# Comp F# Run JS Why functional programming? • Functional programming (FP) is a programming style (paradigm) which often: • naturally leads to more concise and bug-free programs • enables a better separation of concerns • allows a uniform integration of data from heterogeneous sources (e.g. objects, SQL, XML, REST/ODATA) • provides better support for concurrency (parallel programming) • will make you a better programmer • In fact, FP permeates all current languages and frameworks – you already use it, without its concepts • Concepts flow (how to future proof): FP (F#, Haskell) ⇒ OOP (C#) ⇒ JS, Java, C++ 9 / 32
Org Why FP Comp C# Comp F# Run JS Why functional programming? • Functional programming (FP) is a programming style (paradigm) which often: • naturally leads to more concise and bug-free programs • enables a better separation of concerns • allows a uniform integration of data from heterogeneous sources (e.g. objects, SQL, XML, REST/ODATA) • provides better support for concurrency (parallel programming) • will make you a better programmer • In fact, FP permeates all current languages and frameworks – you already use it, without its concepts • Concepts flow (how to future proof): FP (F#, Haskell) ⇒ OOP (C#) ⇒ JS, Java, C++ 9 / 32
Org Why FP Comp C# Comp F# Run JS Why functional programming? • Tzu-li and Tzu-ssu were boasting about the size of their latest programs. • “Two-hundred thousand lines,” said Tzu-li, “not counting comments!” • Tzu-ssu responded, “Pssh, mine is almost a million lines already.” • Master Yuan-Ma said, “My best program has five hundred lines.” • Hearing this, Tzu-li and Tzu-ssu were enlightened. Master Yuan-Ma: The Book of Programming (Marijn Haverbeke: Eloquent Javascript) 10 / 32
Org Why FP Comp C# Comp F# Run JS Why functional programming? • Tzu-li and Tzu-ssu were boasting about the size of their latest programs. • “Two-hundred thousand lines,” said Tzu-li, “not counting comments!” • Tzu-ssu responded, “Pssh, mine is almost a million lines already.” • Master Yuan-Ma said, “My best program has five hundred lines.” • Hearing this, Tzu-li and Tzu-ssu were enlightened. Master Yuan-Ma: The Book of Programming (Marijn Haverbeke: Eloquent Javascript) 10 / 32
Org Why FP Comp C# Comp F# Run JS Why functional programming? • There are two ways of constructing a software design: • One way is to make it so simple that there are obviously no deficiencies, • And the other way is to make it so complicated that there are no obvious deficiencies. C.A.R. Hoare, 1980 ACM Turing Award Lecture (Marijn Haverbeke: Eloquent Javascript) 11 / 32
Org Why FP Comp C# Comp F# Run JS Why functional programming? • There are two ways of constructing a software design: • One way is to make it so simple that there are obviously no deficiencies, • And the other way is to make it so complicated that there are no obvious deficiencies. C.A.R. Hoare, 1980 ACM Turing Award Lecture (Marijn Haverbeke: Eloquent Javascript) 11 / 32
Org Why FP Comp C# Comp F# Run JS What about object-oriented programming? • The problem with object-oriented languages is they’ve got all this implicit environment that they carry around with them. • You wanted a banana but what you got was a gorilla holding the banana and the entire jungle. Joe Armstrong, interviewed in Coders at Work (Marijn Haverbeke: Eloquent Javascript) 12 / 32
Org Why FP Comp C# Comp F# Run JS Why C#, F#, JS? • C# and most modern imperative/OO languages (C++, Java) are becoming multi-paradigm languages • In this direction, C#, .NET and related tools are years ahead of other imperative languages • We also look at F#’s basics, which is a few years ahead of C# • We further use F# in a grad course (734), to study advanced functional topics, including modern parallel programming • JS: at its inception, JS was a functional language (based on LISP/Scheme!), but disguised in C/Java like syntax • Long time was misused (abused) in imperative style • Recently, renewed focus on sound OOP (TypeScript) and FP • SQL: SQL SELECT is a functional element! 13 / 32
Org Why FP Comp C# Comp F# Run JS Why C#, F#, JS? • C# and most modern imperative/OO languages (C++, Java) are becoming multi-paradigm languages • In this direction, C#, .NET and related tools are years ahead of other imperative languages • We also look at F#’s basics, which is a few years ahead of C# • We further use F# in a grad course (734), to study advanced functional topics, including modern parallel programming • JS: at its inception, JS was a functional language (based on LISP/Scheme!), but disguised in C/Java like syntax • Long time was misused (abused) in imperative style • Recently, renewed focus on sound OOP (TypeScript) and FP • SQL: SQL SELECT is a functional element! 13 / 32
Org Why FP Comp C# Comp F# Run JS Why C#, F#, JS? • C# and most modern imperative/OO languages (C++, Java) are becoming multi-paradigm languages • In this direction, C#, .NET and related tools are years ahead of other imperative languages • We also look at F#’s basics, which is a few years ahead of C# • We further use F# in a grad course (734), to study advanced functional topics, including modern parallel programming • JS: at its inception, JS was a functional language (based on LISP/Scheme!), but disguised in C/Java like syntax • Long time was misused (abused) in imperative style • Recently, renewed focus on sound OOP (TypeScript) and FP • SQL: SQL SELECT is a functional element! 13 / 32
Org Why FP Comp C# Comp F# Run JS Why C#, F#, JS? • C# and most modern imperative/OO languages (C++, Java) are becoming multi-paradigm languages • In this direction, C#, .NET and related tools are years ahead of other imperative languages • We also look at F#’s basics, which is a few years ahead of C# • We further use F# in a grad course (734), to study advanced functional topics, including modern parallel programming • JS: at its inception, JS was a functional language (based on LISP/Scheme!), but disguised in C/Java like syntax • Long time was misused (abused) in imperative style • Recently, renewed focus on sound OOP (TypeScript) and FP • SQL: SQL SELECT is a functional element! 13 / 32
Recommend
More recommend