CS 2403 Programming Languages Course Outline ChungTa King

  • Slides: 19
Download presentation
CS 2403 Programming Languages Course Outline Chung-Ta King Department of Computer Science National Tsing

CS 2403 Programming Languages Course Outline Chung-Ta King Department of Computer Science National Tsing Hua University (Slides are adopted from Concepts of Programming Languages, R. W. Sebesta; Modern Programming Languages: A Practical Introduction, A. B. Webber)

On Valentine’s Day t You want to impress your girl friend by baking a

On Valentine’s Day t You want to impress your girl friend by baking a chocolate cake specifically for her. 1

Ask the Chef!!! 2

Ask the Chef!!! 2

Chocolate Cake Receipt t Materials: l l l t 1/2 cup butter 4 ounce

Chocolate Cake Receipt t Materials: l l l t 1/2 cup butter 4 ounce bittersweet chocolate 2 eggs 2 egg yolks 1/4 cup white sugar 2 teaspoons all purpose flour Step: Preheat oven to 450°F. Heat butter and chocolate until chocolate is almost melted. Beat eggs, yolks and sugar until light colored and thick. Mix chocolate and butter, and slowly pour into egg mixture, stirring constantly. Stir in flour until just combined. l Pour batter into molds and bake for 6 to 7 minutes. Invert molds on plates, let sit 15 seconds, and unmold. Serve with whipped cream. l l 4

A Receipt Is Like a Program Receipt: t 阿基師 tells you how to make

A Receipt Is Like a Program Receipt: t 阿基師 tells you how to make a chocolate cake t Has inputs (butter, eggs, chocolate, flour, sugar) & output (chocolate cake) t Define a procedure t Instruct how processors (oven, mixer) process inputs to generate output t Can be expressed in different languages Program: t You tell a computer how to do a computation t Has inputs and outputs Define a procedure (algorithm) t Instruct how processors process inputs to generate outputs t Can be expressed in different languages t 5

Questions t t t t Given two languages, how do they differ in expressing

Questions t t t t Given two languages, how do they differ in expressing the same receipt/algorithm? Which language is better? How to evaluate “goodness” of languages? Why are there so many different languages? What is “programming language” anyway? Why does a programming language have so many different features? How are these features implemented? … Topics of this course 6

A Programming Language Is … t An artificial language designed to express computations or

A Programming Language Is … t An artificial language designed to express computations or algorithms that can be performed by a computer -- Wikipedia l A language is a means of expressing your thoughts to others l In the case of PL, it is a means of expressing your thoughts (algorithms) to a computer l Natural languages such as Chinese and English are not used because they cannot be easily translated into machine language executable by the computer Keywords: expressiveness, implementation 7

Why PL Important? t A language is a framework for problem-solving l It may

Why PL Important? t A language is a framework for problem-solving l It may facilitate or hinder your thoughts and, thus, the abilities to solve problems l It may help you make fewer mistakes l Example: tense and gender, e. g. How to choose PL? “He was doing great!” in English l Example: a C language that supports only static and global variables no malloc() n How to implement hash table? linked list? (Ref. : John Mitchell, http: //www. stanford. edu/class/cs 242) 8

Important to Know PL by Trend (TIOBE Programming Community) 9

Important to Know PL by Trend (TIOBE Programming Community) 9

TIOBE 10

TIOBE 10

Important to Know PL by Trend t t t Increasing use of type-safe languages:

Important to Know PL by Trend t t t Increasing use of type-safe languages: Java, C#, … Scripting languages for web applications with increasing client-side functionality More on expressing algorithms than syntax Runtime environment and virtualization with continuous compilation, analysis, and checking More program analysis abilities: automated error detection and recovery (Ref. : John Mitchell, http: //www. stanford. edu/class/cs 242) 11

Important to Know PL by Tradeoffs Factors influencing programming language t Expressiveness: l Application

Important to Know PL by Tradeoffs Factors influencing programming language t Expressiveness: l Application domains l Programming methods: multiprogramming, interactive systems, … t Implementation: efficiency l Computer architecture, OS, toolchain, library l Every convenience has its cost; must recognize cost of presenting an abstract view of machine n Understand trade-offs in programming language design (Ref. : M. Sirjani, http: //ut. ac. ir/classpages/Programming. Languages) 12

PL as a Course t What is not l Do not teach you a

PL as a Course t What is not l Do not teach you a programming language l Do not teach you how to program t What is l Introduce fundamental concepts of programming languages l Discuss design issues of various language constructs l Examine design/implementation choices for these constructs l Compare design alternatives t Need to be familiar in at least one PL 13

Why Study PL? t To improve your ability to develop effective algorithms and to

Why Study PL? t To improve your ability to develop effective algorithms and to use your language l O-O features, recursion l Call by value, call by reference t t To allow a better choice of PL Increased ability to learn new languages To make it easier to design a new language To understand significance of implementation l E. g. the efficiency of a recursive function 14

Course Information t 教授: 金仲達 l 辦公室: 資電館 443 分機: 42804 l email: king@cs.

Course Information t 教授: 金仲達 l 辦公室: 資電館 443 分機: 42804 l email: king@cs. nthu. edu. tw t 助教: l 陳志中、劉正芝 t 上課時間: l 週一13: 10– 15: 00 l 週四 13: 10– 14: 00 t 上課地點: CSEE 131 t http: //www. cs. nthu. edu. tw/~king/courses/cs 2403. html 15

Textbook t Concepts of Programming Languages, Robert W. Sebesta, 9 th Edition, Addison Wesley,

Textbook t Concepts of Programming Languages, Robert W. Sebesta, 9 th Edition, Addison Wesley, 2009 l Describing Syntax and Semantics l Names, Bindings, and Scopes l Data Types l Expressions and Assignment l Control Structures l Subprograms l Abstract Data Types, Encapsulation l Concurrency l Exception Handling and Event Handling l Functional and Logic Programming Languages 16

Expected Workload t Assignments: l Expect one assignment every two weeks, including programming assignments

Expected Workload t Assignments: l Expect one assignment every two weeks, including programming assignments t Grade breakdown l Assignments l Examinations l Class participation 50% 45% 5% 17

Course Problems t Cannot make examinations l Tell us early and we will schedule

Course Problems t Cannot make examinations l Tell us early and we will schedule makeup t Cannot turn in homework on time l No late homework is accepted t What is cheating? l Study together in groups is encouraged l Work must be your own 18