0% found this document useful (0 votes)
22 views26 pages

Lecture 1

The document outlines the course COM 202 Programming Languages for Spring 2024-2025, including details about the instructor, grading criteria, and reference materials. It emphasizes the importance of studying programming languages for better expression, informed language choice, and ease of learning new languages. Key evaluation criteria for programming languages are discussed, including readability, writability, reliability, and cost.

Uploaded by

ENES
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views26 pages

Lecture 1

The document outlines the course COM 202 Programming Languages for Spring 2024-2025, including details about the instructor, grading criteria, and reference materials. It emphasizes the importance of studying programming languages for better expression, informed language choice, and ease of learning new languages. Key evaluation criteria for programming languages are discussed, including readability, writability, reliability, and cost.

Uploaded by

ENES
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Lecture 1

Preliminaries
COM 202 Programming Languages (3+0) – 6 - 6

Semester : Spring 2024-2025


Instructor : Assist. Prof. Dr. Kübra Uyar
Email : [email protected]
Class Hours : Friday 13:30 - 16:15
Phone Number : 0(242) 510 60 60 / 2539
Courseware : Course materials for this class and announcements about the course can be found at
https://bilge.alanya.edu.tr
Grading

• Quizzes / Homeworks : 20 %
• Midterm : 30 %
• Final : 50 %

Reference Books

– Robert W. Sebesta, “Concepts of Programming Languages”, Pearson, 11th Edition (also 10th is OK)
Tentative Course Outline

1. Preliminaries -Introduction to Programming Languages


2. Evolution of the Major Programming Languages
3. Describing Syntax and Semantics
4. Names, Bindings, and Scopes
5. Data Types
6. Expressions and Assignment Statements
7. Statement-Level Control Structures
8. Subprograms
9. Implementing Subprograms
10. Abstract Data Types and Encapsulation Concepts
11. Support for Object-Oriented Programming
12. Concurrency
13. Exception Handling and Event Handling
14. Functional Programming Languages
Lecture 1 Topics

• Reasons for Studying Concepts of Programming Languages


• Programming Domains
• Language Evaluation Criteria
• Language Categories
• Language Design Trade-Offs

Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-5


What is a (Programming) Language?

A language is a vocabulary and set of grammatical rules for communication between people.

A programming language is a vocabulary and set of grammatical rules for instructing a computer
to perform specific tasks.

Why Study Programming Languages?


• One or two languages is not enough for a computer scientist.
• You should know
✓ the general concepts beneath the requirements
✓ choices in designing programming languages.

How many programming languages are out there?


700 +
Source: Wikipedia
https://en.wikipedia.org/wiki/List_of_programming_languages

Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-6


Reasons for Studying Concepts of Programming Languages

• Increased ability to express ideas


– Awareness of a wider variety of programming language features can reduce such limitations in
software development.
– Programmers increase the range of software development by learning new language constructs. For
example, if you learn associate arrays in Perl, you can simulate them in C.
• Improved background for choosing appropriate languages
– Not every programming language can be suitable for all the software requirements.
– Many programmers learn one or two languages specific to the projects. Some of those languages
may no longer be used.
– When they start a new project, they continue to use those languages which are old and not suited to
the current projects. However, another language may be more appropriate to the nature of the
project. If you are familiar with the other languages, you can choose better languages.
• Lots of text processing -> Perl may be a good option.
• Lots of matrix processing -> MATLAB can be used.
• Increased ability to learn new languages
– Programming languages are still evolving. Many languages are very new, new languages can be
added in time.
– If you know the programming language concepts you will learn other languages much easier.
– For example, if you know concept of object oriented programming, it is easier to learn C++ after
learning Java.

Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-7


Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-8
Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-9
Languages in common use (today)

Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-10


Languages in common use (today)

Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-11


Reasons for Studying Concepts of Programming Languages

• Better understanding of significance of implementation


– Knowing implementation details helps you to use a language more intelligently and write the code
that is more efficient
– Also, it allows you to visualize how a computer executes language constructs
* Cost optimization; e.g. recursion is slow
• Better use of languages that are already known
– Many programming languages are large and complex
* It is uncommon to know all the features
– By studying the concepts of programming languages, programmers can learn about previously
unknown parts of the languages easily.
• Overall advancement of computing
– New ways of thinking about computing, new technology, hence need for new appropriate language
concepts
* Market Power, Practical Considerations, Compatibility
- Although ALGOL 60 was a better language (with better block structure, recursion, etc) than
FORTRAN, it did not become popular. If those who choose languages are better informed, better
languages would be more popular.

Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-12


Programming Domains

• Scientific applications (High-performance numerical computing, data analysis, simulation)


– Large numbers of floating-point computations
– Python, Fortran, Matlab, Wolfram Language (Mathematica), R

• Business applications (banking, insurance, and government systems)


– Produce reports, data analysis, business intelligence, automation, mobile apps
– COBOL, Python, SQL, C#, Swift

• Artificial intelligence (provides libraries-> TensorFlow, Deeplearning4j, Weka, OpenCV)


– LISP, Python, R, Java

• Systems programming
– Low-level control, high performance, and efficient memory management.
– Need efficiency because of continuous use
– C, C++, Swift

• Web Software (Frontend, backend, full stack)


– Eclectic collection of languages: markup (e.g., HTML), scripting (e.g., PHP), general-
purpose (e.g., Java)
– Database Querying (SQL, NoSQL)

Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-13


Language Evaluation Criteria

• Readability: the ease with which programs can be read and understood
• Writability: the ease with which a language can be used to create programs
• Reliability: conformance to specifications (i.e., performs to its specifications)
• Cost: the ultimate total cost

Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-14


Evaluation Criteria: Readability

• Overall simplicity
– A manageable set of features and constructs
– Minimal feature multiplicity
– Minimal operator overloading (a single operator symbol has more than one meaning
such as +)
• Orthogonality
- If data types and operations in a programming language can work independently of each
other, then that language is more orthogonal.

Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-15


Evaluation Criteria: Readability

• Data types
– Adequate predefined data types
• Syntax considerations
– Identifier forms: flexible composition A flag may be defined as integer
– Special words and methods of forming
compound statements
– Form and meaning: self-descriptive
constructs, meaningful keywords

Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-16


Evaluation Criteria: Writability

• Simplicity and orthogonality


– Few constructs, a small number of primitives, a small set of rules for combining
them

• Support for abstraction


– The ability to define and use complex structures or operations in ways that allow
details to be ignored
– Process abstraction : subprograms (eliminates replication of code, ignores
implementation details)
– Data abstraction (tree can be represented more naturally using pointers in node)

• Expressivity
– A set of relatively convenient ways of specifying operations

Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-17


Evaluation Criteria: Reliability

Reliable: it performs to its specifications under all conditions

• Type checking
– Testing for type errors
• Exception handling
– Intercept run-time errors and take
corrective measures

Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-18


Evaluation Criteria: Reliability

Reliable: it performs to its specifications under all conditions a and b both point to the same list
in memory. When b[0] = 99 is
executed, the list that
• Aliasing both a and b reference is modified,
and this change is reflected in both
– Presence of two or more distinct variables because they refer to the
referencing methods for the same same list.
memory location
• Readability and writability

Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-19


Evaluation Criteria: Cost

1. Cost of training the programmers: Function of simplicity and orthogonality, experience of


the programmers.

2. Cost of writing programs: Function of the writability

Note: These two costs can be reduced in a good programming environment

3. Cost of compiling programs: cost of compiler, and time to compile


• First generation Ada compilers were very costly

4. Cost of executing programs: If a language requires many run-time type checking, the
programs written in that language will execute slowly.
- Trade-off between compilation cost and execution cost.

Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-20


Evaluation Criteria: Cost

5. Cost of the implementation system: If expensive or runs only on expensive hardware it


will not be widely used.

6. Cost of reliability: important for critical systems such as a power plant or X-ray machine.

7. Cost of maintaining programs: For corrections, modifications and additions.


- Function of readability.
- Usually, and unfortunately, maintenance is done by people other that the original authors
of the program.
-For large programs, the maintenance costs is about 2 to 4 times the development costs.

Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-21


Language Categories

• Imperative
– Central features are variables, assignment statements, and iteration
– Include languages that support object-oriented programming
– Include scripting languages
– Include the visual languages
– Examples: C, Java, Perl, JavaScript, Visual BASIC .NET, C++

• Functional
– Main means of making computations is by applying functions to given parameters
– Examples: LISP, Scheme, ML, F#

• Logic
– Rule-based (rules are specified in no particular order)
– Example: Prolog

• Markup/programming hybrid
– Markup languages extended to support some programming
– Examples: JSTL(JSP Standard Tag Library) , XSLT (Extensible Stylesheet Language
Transformations)

Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-22


Language Design Trade-Offs

• Reliability vs. cost of execution


– Example: Java demands all references to array elements be checked for proper indexing,
which leads to increased execution costs

• Readability vs. writability

• Writability (flexibility) vs. reliability

Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-23


Summary

• The study of programming languages is valuable for a number of reasons:


– Increase our capacity to use different constructs
– Enable us to choose languages more intelligently
– Makes learning new languages easier

• Most important criteria for evaluating programming languages include:


– Readability, writability, reliability, cost

Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-24


“Hello World” in different languages
https://www.geeksforgeeks.org/hello-world-in-30-different-
languages/

Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-25


Copyright © 2017 Pearson Education, Ltd. All rights reserved. 1-26

You might also like