You are on page 1of 31

SOFTWARE DEVELOPMENT 2

SECOND S EMEST ER
SCHOOL YEAR 2022 – 2023

LESSON 1 1
LESSON 1: FUNDAMENTALS OF
PROGRAMMING LANGUAGE

LESSON 1 1
Overview of Computer
▪ Computer is an electronic, programmable device that
can store, retrieve and process data.
▪ Computers are everywhere
▪ Are they more powerful and smarter than human?
▪ Computers need human intervention

LESSON 1 3
Computer Programming

❑Programming is problem
solving
❑You must use your logic
❑Programming is like
constructing a building

LESSON 1 4
What is a Program?
❑A program is a list of instructions for the computer to
follow to accomplish the task of processing data into
information.
❑The instructions are made up of statements used in a
programming language.
❑The process of planning, problem solving and creating
programs is what we called programming.

LESSON 1 5
Programming Language
❑A collection of symbols, words, and phrases that
instruct a computer to perform specific operations.
❑A standardized communication technique for
expressing instructions to a computer. Like human
languages, each language has its own syntax and
grammar.

LESSON 1 6
Remember!
“There are different types of
programming languages that can be used
to create programs, but regardless of what
language you use, these instructions are
translated into machine language that can be
understood by computers.”

LESSON 1 MITF214 | PROGRAMMING LANGUAGES 7


How do programming languages differ?
❑Common Constructs:
• basic data types (numbers, etc.); variables; expressions;
statements; keywords; control constructs; procedures;
comments; errors ...
❑Uncommon Constructs:
• type declarations; special types (strings, arrays, matrices, ...);
sequential execution; concurrency constructs;
packages/modules; objects; general functions; generics;
modifiable state; ...

LESSON 1 8
Programming Language Principles
❑Distinguishing programming languages properties

Types
Names
Syntax

Abstractions
Semantics

LESSON 1 9
Programming Language Principles
❑For any language
•Its designers must define these properties
•Its programmers must master these properties

LESSON 1 10
Syntax
Programming ❑The syntax of a programming
Languages language is a precise description of all
Principles its grammatically correct programs
1. Syntax ❑When studying syntax, we ask
questions like:
2. Names
•What is the grammar for the language?
3. Types
•What is the basic vocabulary?
4. Abstractions •How are syntax errors detected?
5. Semantics

LESSON 1 11
Names
Programming ❑Various kinds of entities in a program
Languages have names:
Principles •variables, types, functions, parameters,
classes, objects, …
1. Syntax •Named entities are bound in a running
2. Names program to
3. Types ◦ Scope
◦ Visibility
4. Abstractions ◦ Type
5. Semantics ◦ Lifetime

LESSON 1 12
Types
Programming ❑A type is a collection of values and of
Languages operations on those values
Principles ❑Simple types
• Numbers, characters, Booleans, …
1. Syntax ❑Structured types
2. Names • Strings, lists, trees, hash tables, …
3. Types ❑A language’s type system can help:
• Determine legal operations
4. Abstractions
• Detect type errors
5. Semantics • Optimize certain operations

LESSON 1 13
Abstractions
Programming ❑Mechanisms for generalizing
Languages computations or data:
Principles • Procedures/functions
• Modules
1. Syntax • Abstract data types
2. Names • Classes
3. Types • Memory models

4. Abstractions
5. Semantics

LESSON 1 14
Semantics
Programming ❑The meaning of a program is called its
Languages semantics
Principles ❑In studying semantics, we ask
questions like:
1. Syntax • When a program is running, what happens to the
values of the variables?
2. Names • What does each construct do?
3. Types • What underlying model governs run-time
behavior, such as function call?
4. Abstractions
• How are variables and objects allocated to
5. Semantics memory at run-time?

LESSON 1 15
Programming Paradigms
❑A programming paradigm is a pattern of problem-
solving thought that underlies a particular genre of
programs and languages.
❑It is a way to classify programming languages based on their
features.
❑Some paradigms are concerned mainly with implications for
the execution model of the language, such as allowing side
effects, or whether the sequence of operations is defined by
the execution model.

LESSON 1 16
Programming Paradigms

Object-
Imperative Functional Logic Dataflow
Oriented

LESSON 1 17
Imperative Paradigm
❑Follows the classic von Neumann-
Programming Eckert model:
Paradigms • Program and data are indistinguishable in
memory
1. Imperative • Program = sequence of commands modifying
current state
2. Object-Oriented
• State = values of all variables when program runs
3. Functional • Large programs use procedural abstraction
4. Logic
❑ Example of imperative languages
5. Dataflow • Cobol, Fortran, C, Ada, Perl, …

LESSON 1 18
Object-oriented (OO) Paradigm
❑An OO Program is a collection of
Programming objects that interact by passing
Paradigms messages that transform local state
❑Major features:
1. Imperative • Encapsulated state
• Message passing
2. Object-Oriented
• Inheritance
3. Functional • Subtype Polymorphism
4. Logic ❑ Example OO languages
5. Dataflow • Smallralk, Java, C++, C#, Python, …

LESSON 1 19
Functional
❑Functional programming models a
Programming computation as a collection of
Paradigms mathematical functions
• Input = domain
• Output = range
1. Imperative
❑ Major Features
2. Object-Oriented
• Functional composition
3. Functional • Recursion
4. Logic • Referential transparency
5. Dataflow ❑ Example functional languages:
• Lisp, Scheme, ML, Ocaml, Haskell, F#, ….
LESSON 1 20
Functional
❑Notable features of modern
Programming functional languages:
Paradigms • Functions as values
• Symbolic data types
1. Imperative • Pattern matching
• Sophisticated type systems and module systems
2. Object-Oriented
3. Functional
4. Logic
5. Dataflow

LESSON 1 21
Logic Paradigm
❑Logic programming declares what
Programming outcome of the program should be,
Paradigms rather than how it should be achieved.
1. Imperative
❑Major features:
• Programs as sets of constraints on a problem
2. Object-Oriented
• Computation of all possible solutions
3. Functional • Non-deterministics computation
4. Logic ❑ Example logic programming languages:
5. Dataflow • Prolog, Datalog, Mozart

LESSON 1 22
Brief History of Programming Languages
❑How and when did programming languages evolve?
❑What communities have developed and used them?
• Artificial Intelligence
• Computer Science Education
• Science and Engineering
• Information Systems
• Systems and Networks
• World Wide Web
•…

LESSON 1 23
Language Genealogy

LESSON 1 MITF214 | PROGRAMMING LANGUAGES 24


Language Genealogy

LESSON 1 MITF214 | PROGRAMMING LANGUAGES 25


What makes a successful language?
❑Key characteristics
• Simplicity and readability
• Reliability
• Support
• Abstraction
• Orthogonality
• Libraries
• Efficient implementation
• Community

LESSON 1 26
Simplicity and Readability
Characteristics of
Programming ❑Small instruction set
• Example: Java vs Scheme
Language
1. Simplicity and readability
❑Simple syntax
2. Reliability
• Example: C/C++/Java vs Python
3. Support ❑Benefits
4. Abstraction • Ease of learning
5. Orthogonality • Ease of programming
6. Libraries
7. Efficient implementation
8. Community

LESSON 1 27
Reliability
Characteristics of
Programming ❑Program behavior is the same on different
platforms
Language • Example: early Fortran, C
1. Simplicity and readability
❑ Type errors are detected
2. Reliability
3. Support
• Example: C vs Haskell
4. Abstraction ❑ Semantic errors are properly trapped
5. Orthogonality • Example: C vs C++
6. Libraries
7. Efficient implementation
❑ Memory leaks are prevented
8. Community • Example: C vs Java

LESSON 1 28
Language Support
Characteristics of
Programming ❑Accessible (public domain) compilers /
interpreters
Language
1. Simplicity and readability
❑ Good texts and tutorials
2. Reliability ❑ Wide community of users
3. Support
❑ Integrated with development
4. Abstraction
5. Orthogonality
environments (IDE’s)
6. Libraries
7. Efficient implementation
8. Community

LESSON 1 29
Orthogonality
Characteristics of
❑A language is orthogonal if its features are
Programming
built upon a small, mutually independent
Language set of primitive operations
1. Simplicity and readability
2. Reliability
❑Fewer exceptional rules = conceptual
3. Support
simplicity
4. Abstraction • Example: restricting types of arguments to a
5. Orthogonality
function
6. Libraries ❑ Tradeoff with efficiency
7. Efficient implementation
8. Community

LESSON 1 30
Efficiency Issues
Characteristics of
❑ Embedded Systems
Programming
• Real-time responsiveness (E.g.: navigation)
Language
• Failure of early ADA implementations
1. Simplicity and readability
2. Reliability
❑ Web Applications
3. Support • Responsiveness to users (E.g.: Google Search)
4. Abstraction ❑ Corporate database applications
5. Orthogonality
• Efficient search and updating
6. Libraries
7. Efficient implementation ❑ AI applications
8. Community • Modeling human behaviors

LESSON 1 31

You might also like