1 / 28

CS2104 Programming Languages Concepts

2. 1. Course Instructor. Name: Alireza AzimiRoom:Email: Info@alirezaazimi.com. 3. 2. Lecture and Tutorial Time/Venue. wednesdays1400-1700: Lecture @ SR1Thursdays1100-1400: Lecture @ SR11400-1700 : Lecture @ SR1To Settle: Are we able to move the Saturday slot, to Friday @ TR6? (TR6 = soc1-3-20).

Leo
Download Presentation

CS2104 Programming Languages Concepts

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. 1 CS2104 Programming Languages Concepts Course Administration

    2. 2 1. Course Instructor Name: Alireza Azimi Room: Email: Info@alirezaazimi.com

    3. 3 2. Lecture and Tutorial Time/Venue wednesdays 1400-1700 : Lecture @ SR1 Thursdays 1100-1400 : Lecture @ SR1 1400-1700 : Lecture @ SR1 To Settle: Are we able to move the Saturday slot, to Friday @ TR6? (TR6 = soc1-3-20)

    4. 4 3. Textbook Recommended Text: R. W. Sebesta, Concepts of Programming Languages, 6th Edition, Addison Wesley (2004). Other texts worth consulting: Pratt & Zelkowitz, Programming Languages Design and Implementation , 4th Edition, Prentice Hall (2001). Tucker and Noonan, Programming Languages. McGraw Hill (2002).

    5. 5 4. Assessment Tentatively: Tutorial participation : 10% Quizzes/midterm: 10% Reserch : 30% Final examination : 50% Depending on circumstances, I may increase the quiz component (and correspondingly decrease the exam component) by a further 10%

    6. 6 4. Assessment Quizzes: Will be conducted either before each tutorial session, or before each lecture session. You decide. Will consists of MCQs, or questions which require short answers, or both. Will be open-book Will range between 15-20 minutes Exam: Open-book or Close-book (option)

    7. 7 5. Keeping in Touch (I) a. Course Website: http://www.alirezaazimi.com/courses.htm Check the course-website regularly for Lecture notes Tutorial questions Announcements Other necessary resources – programming language tutorials, downloadable compilers, interpreters.

    8. 8 5. Keeping in Touch (II) b. Consultation (After Tutorials for 1 hr) c. Email: For course admin matters d. IVLE… See if I can set it up.

    9. 9 6. Why??? Increased capacity to express ideas The depth of what we can think is influenced by the expressive power of the language in which we communicate. Awareness of various PL features advantages in Helping software development thought process. Using them through simulation in languages which do not have these features.

    10. 10 6. Why??? Improved background for choosing an appropriate language. An old saying “When all you have is a hammer, everything looks like a nail.” Eg. Ericsson and Erlang.

    11. 11 6. Why??? Increased ability to learn a new language. Languages come and go… concepts remain. Once a thorough understanding of the fundamental concepts of languages is acquired, it becomes far easier to see how these concepts are incorporated into the design of the language being learned. Learn the paradigms… languages become treated as dialects.

    12. 12 6. Why??? Better understanding of the significance of implementation. This in turn leads us to: The design decisions of the language Efficient and informed use of language constructs (Eg. Recursion vs Iteration)

    13. 13 6. Why??? Understand the overall advancement in computing: The rise and fall of a language… Why certain langauges are well-received? Is it because of certain good design features? Did it succeed due to hype? Did it fail due to biasness? Eg. Algol60 was not well received even though it was the first to introduce block structure, recursion and well-structured control statements.

    14. 14 6. Why??? Understand the overall advancement in computing: Eg. Java’s use of OO vs Perl’s use of OO “…But this is not primarily a book about object-oriented methodology, and we're not here to convert you into a raving object-oriented zealot, even if you want to be converted. There are already plenty of books out there for that. Perl's philosophy of object-oriented design fits right in with Perl's philosophy of everything else: use object-oriented design where it makes sense, and avoid it where it doesn't. Your call.” (Larry Wall, Programming Perl)

    15. 15 Lecture 1: Introduction Reading: Sebesta Chapter 1 and 2 (You may consult the text by Tucker and Noon, and also the other by Pratt, both chapter 1)

    16. 16 Overview Background Paradigms of Computation Abstraction of Computation Role of Programming Langugaes Implementation What makes a successful language?

    17. 17 A. Background

    18. 18 A. Background

    19. 19 A. Background “Frankly, we didn’t have the vaguest idea how the thing [FORTRAN language and compiler] would work out in detail. …We struck out simply to optimize the object program, the running time, because most people at that time believed you couldn’t do that kind of thing. They believed that machined-coded programs would be so inefficient that it would be impractical for many applications.” John Backus Unexpected successes are common – the browser is another example of an unexpected success.

    20. 20 A. Background

    21. 21 A. Background

    22. 22 A. Background

    23. 23 A. Background

    24. 24 A. Background

    25. 25 A. Background

    26. 26 A. Background

    27. 27 A. Background

    28. 28 A. Background

    29. 29 A. Background

    30. 30 A. Background

    31. 31 Overview Background Paradigms of Computation Abstraction of Computation Role of Programming Langugaes Implementation What makes a successful language?

    32. 32 B. Paradigms Fundamental Paradigms Instructional Reasoning Functional Reasoning Deductive Reasoning Augmented Paradigms Reasoning by Simulating the Real World Reasoning by the Mass

    33. 33 B. Paradigms Instructional Basic property : Machine State Program = Sequence of Instructions to change machine state. Solution to problem = Program to change from start state to final state

    34. 34 B. Paradigms Functional Key Idea: Mathematical Functions. More concerned with the input and output, and not about state changes in Machines. Program = sequence of function applications. = f1(f2 (f3 … (fn data)…)) Paradigm Shift : To treat program as a mathematical specification/proof.

    35. 35 B. Paradigms Deductive

    36. 36 B. Paradigms The way we reason dictates the way we program: Instructional Reasoning : Imperative Functional Reasoning : Functional Deductive Reasoning : Logical Reasoning by simulating the Real World : Object-Oriented Reasoning by the mass : Concurent

    37. 37 B. Paradigms – Languages Functional Haskell, Scheme, Lisp, ML or SML Logical/Relational Prolog, ECLiPSe, B-Prolog, CLP(R) Imperative C, Pascal, Perl, Tcl Object-Oriented C++, Eiffel, Java, Smalltalk, Simula Concurrent Ada, Linda, Concurrent Pascal

    38. 38 Overview Background Paradigms of Computation Abstraction of Computation Role of Programming Langugaes Implementation What makes a successful language?

    39. 39 C. Abstraction What is abstraction? Abstraction in Programming : The act of finding a common framework that represents and describes a variety of computational entities. Computational entities : control, data, objects, relations… Abstraction is the most fundamental concept for programming and language design. Why Perform Abstraction? Facilitates problem definition and solving. Abstraction creates entities that live in the model of mental reasoning, therefore makes mental reasoning comfortable and efficient

    40. 40 C. Abstraction What can be abstracted? Many computational entities can be abstracted Control flow : functions, procedures Data : abstract data types (ADTs) Program : modules, objects File systems : I/O streams Entities/objects : types, classes

    41. 41 C. Abstraction What must a language do to allow abstraction? Syntactic : (Give you a way to specify abstraction…) abstraction body, possibly with parameters, and possibly with names (e.g. f(x, y, z) - just a function name with parameters : x, y and z) Semantic : (…and tell you what it means) A more complex example for OO-paradigm – data abstraction: Identifying and grouping (eg. through classes, types) Protocol for interaction (e.g. objA.f(x,y,z)) Mechanism for specialization (how to “narrow down” to the actual object – an objA of class X?)

    42. 42 C. Abstraction What are the benefits of Abstraction? Be closer to the mental model of the problem (and solution) easier to verify correctness separation of concern -- focusing on issues at hand improve programmers’ productivity easier to communicate among programmers/managers

    43. 43 Overview Background Paradigms of Computation Abstraction of Computation Role of Programming Langugaes Implementation What makes a successful language?

    44. 44 D. Role of Programming Languages Different Paradigms (of thought), and the use of Abstraction (of almost anything) influence the role of a programming languages and their compilers/interpreters. 2 main roles: PLs used as an higher level means of communication with the computer. We want to bring the computer up to the level of our mind (through paradigms of thought; through abstraction), and not the other way round. PLs as a means to provide effective ways of organising computations. Organize data/computation through abstraction or through our modes of thought and not according to hardware details.

    45. 45 D. Role of Programming Languages

    46. 46 D. Role of Programming Languages Importance of organizing complexity Due to a programming error, the rocket carrying Mariner I, an unmanned probe to Venus, had to be destroyed 290 seconds after launch on July 22, 1962. Program (in pseudocode): … if in radar contact with rocket then do not correct its flight path.

    47. 47 D. Role of Programming Languages Chairman: Who was responsible for leaving this [not] out? Mr Wyatt: It was a human error… Mr Fulton: Does NASA check to see that the computers are correctly [programmed]? Doesn’t any outside inspector check, or is it just up to the [programmer] and if he does not do it nobody else knows about it? Dr Morrison: This is a minute detail of the [program], which I agree should be checked. However, in good management practices, if we followed every detail to this point, we would have a tremendous staff. Mr Fulton: …the loss up to $18 or $20 million, plus the time, plus the loss of prestige… would seem to me to require a system of checking to see that the contractor programmed correctly…

    48. 48 D. Role of Programming Languages Dr Morrison: This is true. I would like to point out there were 300 runs made of this [program; the error was not uncovered]… Mr Fulton: My point is that we know of one [error], but we do not know if there were others… Mr Waggonner: … I share your concern there. I would have to be reluctant to say we hire enough personnel to check every [programmer]. That would mean… two people doing every job – a man checking every man… Chairman: … I feel that I have a vague knowledge of what you are talking about, but we certainly should be able to devise some system for checks that will not allow this type of error to creep in. (31/7/62 Hearing before the Committee)

    49. 49 D. Role of Programming Languages

    50. 50 Overview Background Paradigms of Computation Abstraction of Computation Role of Programming Langugaes Implementation What makes a successful language?

    51. 51 E. Implementation

    52. 52 E. Implementation – Compilation

    53. 53 E. Implementation – Interpretation

    54. 54 E. Implementation To compile or interpret? Pros and cons for each. Compilation can be more efficient than interpretation. Interpretation can be more flexible than compilation.

    55. 55 Overview Background Paradigms of Computation Abstraction of Computation Role of Programming Langugaes Implementation What makes a successful language?

    56. 56 F.What makes a Language Successful

    57. 57 F.What makes a Language Successful

    58. 58 F.What makes a Language Successful

    59. 59 F.What makes a Language Successful

    60. 60 F.What makes a Language Successful

    61. 61 F.What makes a Language Successful

    62. 62 F.What makes a Language Successful

    63. 63 F.What makes a Language Successful

    64. 64 F.What makes a Language Successful

    65. 65 F.What makes a Language Successful

    66. 66 F.What makes a Language Successful

    67. 67 F.What makes a Language Successful

    68. 68 F.What makes a Language Successful

    69. 69 F.What makes a Language Successful Design Aspects Naturalness for the application Support for Abstraction Clarity, Simplicity, Unity Orthogonality Practical Aspects Programming Environment Support Portability Cost of Use Affects both Design and Practice Ease of Verification

More Related