SEN308 Lecture 2

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 34

Module 2

Introduction to Programming Languages

Concepts of Programming Languages - NUN 2024 Austin Olom Ogar


MODULE OUTLINE

Foundations of Computing: Machine code, assembly languages, early


programming concepts.
Procedural Programming: FORTRAN, ALGOL, COBOL, C

.
Object-Oriented Programming: Simula, Smalltalk, C++, Java, C#
Scripting Languages: Perl, Python, JavaScript, PHP
Functional Programming: LISP, Scheme, Haskell
Logic Programming: Prolog
Languages of the Future

Concepts of Programming Languages - NUN 2024 Austin Olom Ogar


Machine Code

.
• Computers only understand binary instructions (0s and 1s)
• Machine code is a direct representation of these instructions
• Incredibly difficult for humans to read and write

Concepts of Programming Languages - NUN 2024 Austin Olom Ogar


Assembly Language

• Assembly uses mnemonics (e.g., ADD, SUB, MOV) instead of raw binary
• One-to-one correspondence with machine instructions
• Still very low-level and tied to specific hardware

Concepts of Programming Languages - NUN 2024 Austin Olom Ogar


High Level Language

• Focus on human readability and machine independence


• Use more English-like keywords and syntax
• Need for compilers and interpreters to translate to machine code

Concepts of Programming Languages - NUN 2024 Austin Olom Ogar


The Origins of Programming

.
 Charles Babbage: The Analytical Engine (1830s - 1840s)
• A proposed mechanical computer, designed for complex calculations
• Never fully constructed
 Ada Lovelace: The First Programmer
• Published notes on the Analytical Engine
• Created an algorithm for calculating Bernoulli numbers
Plankalkül: A Theoretical Blueprint

.
• Designed by Konrad Zuse in Germany (1942-1945)
• Created with engineering problems in mind
• High-level language features: variables, arrays, conditional statements
• Not implemented during its time due to limitations of the era
PROCEDURAL PROGRAMMING LANGUAGES

Concepts of Programming Languages - NUN 2024 Austin Olom Ogar


Procedural Programming: A Step-by-Step Revolution

• Core Concept: Programs are sequences of instructions


• Break down code into Procedures(functions)
• Control flow: Loops, conditional statements
• E.g. FORTRAN, ALGOL, COBOL, C
Fortran Programming Language
• FORmula TRANslation: One of the first high-level programming languages.
• Introduced in 1957 by IBM, originally for scientific and engineering applications.
• Key Features:
 Fortran uses relatively English-like syntax, aiding in code readability, especially for
procedural programming.
 Emphasis on numerical computations and array manipulations
.
 Straightforward syntax for expressing mathematical concepts
 Efficient compiled code
 Extensive Libraries: Offers rich libraries for scientific and engineering domains.
 Continuous evolution with modern standards (Fortran 90, 2003, 2008, 2018)
Legacy: Shaped numerical weather prediction, computational fluid dynamics, and high-
performance computing
ALGO Programming Language
• ALGOrithmic Language: A family of procedural high-level languages
• Development: 1958 - 1968 (Key versions: ALGOL 58, ALGOL 60, ALGOL 68)
• Designed by international committees to be machine-independent and standardized
• Key Features:
• Block structure & structured programming concepts
• ALGOL offered basic data types (integers, real numbers, Booleans)
.
• Standard statements like if-then-else and for loops
• ALGOL 60's switch statement provided a more readable alternative to nested if-else
chains.
• Recursive procedures and functions
• Parameter passing mechanisms (call-by-value, call-by-name)
• Formal language definition using BNF grammar
• Legacy: Influenced Pascal, C, Ada, and countless other languages.
COBOL Programming Language
• Common Business-Oriented Language
• Designed in 1959 by a committee including Grace Hopper (“The Mother of COBOL”)
• Focus on business data processing: transactions, reports, record keeping
• English-like syntax for readability and accessibility
• COBOL uses verbose English-like keywords and statements (e.g., ADD,
SUBTRACT, DISPLAY, MOVE).
.
• This was designed to make code understandable to non-technical business
stakeholders.
• Standardized format for cross-system compatibility.
• Detailed data descriptions using hierarchical structures and the PICTURE clause to
define specific formatting.

• Extremely long lifespan with a massive legacy in existing systems


• Banking systems, including ATM networks and transaction processing, rely on COBOL
code
C Programming Language
• Developed at Bell Labs by Dennis Ritchie in the early 1970s.
• Designed for efficiency, portability, and close interaction with hardware.
• C code is compiled into machine code, leading to highly efficient and optimized applications
• C has around 32 keywords, making the core of the language relatively easy to learn
• A wide array of operators for arithmetic, logical, and bitwise operations provides
expressiveness


.
C supports functions, loops, and conditional statements for organized code.
C gives significant freedom to the developer, which also means a greater need for care to
avoid memory leaks and undefined behavior.
• While C's standard library is small, extensive external libraries provide tools for almost any
task.
• Foundation for operating systems (like Unix) and countless applications
• C is still the language of choice for operating systems, kernels, device drivers, and embedded
systems.
• Influenced many languages: C++, Java, JavaScript, C#, Python
OBJECT ORIENTED PROGRAMMING LANGUAGES

Concepts of Programming Languages - NUN 2024 Austin Olom Ogar


OOP Programming PARADIGM
• Core Concept: Modeling software as a collection of interacting objects.
• Objects: Self-contained bundles of data (attributes) and behavior (methods).
• Key Features:
• Encapsulation
• Inheritance
• Polymorphism
.
• Abstraction
• Simula, Smalltalk, C++, Java, C#
Simula Programming Language
• Developed in the 1960s by Ole-Johan Dahl and Kristen Nygaard (Norway)
• Designed for simulation and modelling of complex systems
• Introduced key object-oriented concepts:
• Classes: Blueprints for objects: define the properties (attributes) and behaviours
(methods) that objects of that class will possess.
• Objects: Instances of classes each containing its own set of data based on the class's
.
attributes. Methods operate on this object data.
• Inheritance: Creating hierarchies of classes
• Virtual procedures (an early form of polymorphism)

• Directly inspired Smalltalk, a highly influential object-oriented language.


• Concepts from Simula form the foundation of OOP principles used in modern languages like
C++, Java, and C#.
Smalltalk Programming Language
• Developed at Xerox PARC in the 1970s (Alan Kay et al.)
• Pioneering purely object-oriented language
• "Everything is an object" philosophy
• Dynamic typing & message-based communication
• Powerful development environment: integrated editor, debugger, class browser
• Influential for graphical user interfaces (GUIs) and programming paradigms
.
C++ Programming Language
• Developed by Bjarne Stroustrup in the early 1980s (originally named "C with Classes").
• Designed as a superset of C, aiming to add object-oriented capabilities while maintaining
efficiency.
• Multi-paradigm: Supports procedural, object-oriented, and generic programming.
• Allows a class to inherit from multiple parent classes
• Extensive Standard Template Library (STL) for powerful data structures and algorithms.
.
• Extensive collection of containers (vectors, lists, maps), algorithms (sorting, searching), and
iterators—essential tools for efficient development.
• Create generic functions and classes that work with various data types without rewriting
code.
• Organize code into logical units to prevent naming collisions in large projects.
• Concise way to define anonymous functions, useful for callbacks and algorithms.
• Used in a wide range of applications: systems programming, game development, high-
performance computing.
Java Programming Language
• Developed by Sun Microsystems (now Oracle), first released in 1995.
• Object-oriented, class-based language.
• Platform independence achieved via the JVM (Java Virtual Machine).
• uses WORA: "Write Once, Run Anywhere"
• Automatic memory management and garbage collection.
• Java includes error-checking, exception handling, and garbage collection for improved
.
stability and reduced memory leaks.
• Java API: A vast collection of standard packages covering:
• Core data structures and algorithms
• Networking and I/O
• GUI development (Swing, JavaFX)
• Database connectivity (JDBC)
• Web development technologies
• Extensive libraries for various domains (networking, GUI development, etc.)
C# Programming Language
• Developed by Microsoft in the early 2000s as part of the .NET initiative.
• Object-oriented, type-safe, and managed language (automatic memory management).
• Syntactically similar to Java and C++.
• Strong typing and compile-time type checking help prevent errors and make the code more
reliable.
• Generics allow the creation of type-safe and reusable classes, functions, and data structures


.
that work with different data types.
Simplifies writing asynchronous code that doesn't block threads, improving application
responsiveness
• Provides a unified syntax to query data from various sources (databases, XML, objects) in a
functional style.
• Versatile language used for web development, desktop applications, game development
(especially with Unity), and more.
• With .NET Core and later versions, C# is now cross-platform!
SCRIPTING PROGRAMMING LANGUAGES

Concepts of Programming Languages - NUN 2024 Austin Olom Ogar


SCRIPTING PROGRAMMING LANGUAGES
• Interpreted Languages: Executed line-by-line by an interpreter, unlike compiled languages.
• Focus on Rapid Development: Often easier to learn and feature less verbose syntax than
compiled counterparts.
• Common Uses:
• Automating tasks and workflows
• Web development (client-side & server-side)
.
• System administration and glue code
• Data analysis and scientific computing
• Popular Examples: Python, JavaScript, PHP, Ruby
Ruby Programming Language
• Created by Yukihiro "Matz" Matsumoto in the mid-1990s.
• Focus on developer happiness and productivity.
• Elegant Syntax: Designed to be readable and expressive.
• Dynamically typed and interpreted.
• Metaprogramming: Modify code structure and behavior at runtime. Enables flexibility and
powerful libraries.

.
Blocks: First-class closures (chunks of code) passed to methods, used extensively for
iteration and functional-style programming.
• Mixins: Modules that can be 'included' to add methods to classes. Promotes code reusability
and horizontal inheritance.
• "Everything is an Object": Even numbers, strings, and booleans are objects, providing a
consistent model.
• Garbage Collection: Automatic memory management.
Python Programming Language
• Created by Guido van Rossum, first released in 1991.
• General-purpose, high-level language.
• Supports OOP concepts (classes, objects, inheritance), but can also be used in a procedural
or functional style.
• Emphasis on code readability:
• Clean syntax
.
• Uses whitespace for indentation
• Dynamically typed and interpreted.
• Vast Third-Party Libraries: Huge selection through PyPI (Python Package Index):
• Data Science (NumPy, Pandas, Scikit-learn)
• Machine Learning (TensorFlow, PyTorch)
• Web Development (Django, Flask)
• Game Development (Pygame)
• A welcoming community with extensive documentation, tutorials, and forums to help
beginners and experts alike.
PHP Programming Language
• Created by Rasmus Lerdorf in 1994.
• Easy to learn and embed within HTML pages.
• Server-Side: PHP code executes on the web server, not in the user's browser like JavaScript.
• Database Integration: Excellent support for various databases (MySQL, PostgreSQL,
SQLite, etc.), simplifying data-driven web applications.
• Dynamic Typing: Variables don't require explicit type declaration, making development


.
faster but potentially increasing the risk of errors.
Open-Source: Freely available and widely supported, contributing to its huge developer
community.
• Cross-Platform: PHP applications can generally run on Windows, Linux, macOS, and other
operating systems with compatible web servers.
• Features:
• Dynamic content generation
• Database interaction
• Form handling
• Session management
JavaScript Programming Language
• Created by Brendan Eich in 1995 (originally named LiveScript)
• Runs in every modern web browser, making it highly accessible.
• Client-side scripting language for web browsers:
• Adds interactivity to web pages (animations, user interactions)
• Became a general-purpose language:
• Server-side development with Node.js
.
• Mobile app development, desktop applications, etc.
• Dynamically typed, interpreted language
• Web Frameworks: React, Angular, Vue.js provide structure and tools for large-scale,
dynamic web applications.
• Powerful API to interact with the structure and content of web pages in real-time.
FUNCTIONAL PROGRAMMING LANGUAGES

Concepts of Programming Languages - NUN 2024 Austin Olom Ogar


FUNCTIONAL PROGRAMMING LANGUAGES
• Core Concept: Programming with functions as the central building blocks.
• Emphasis on immutability: Data is not modified, but transformed.
• Focus on expressions, not statements.
• Key Features:
• First-class functions
• Higher-order functions
.
• Pure functions
• Recursion
• E.g. LISP, Scheme, Haskell
LISP Programming Language
• Developed by John McCarthy in the late 1950s.
• One of the oldest high-level languages still in use.
• Unique Syntax: Prefix notation with extensive use of parentheses.
• Homoiconicity: Code and data are represented in the same structure.
• Lists as the Primary Data Structure: S-expressions (parenthesized lists) are foundational.
LISP code itself is written as lists.


.
Garbage Collection: Automatic memory management simplifies development.
REPL-Driven Development: Interactive "Read-Evaluate-Print-Loop" for iterative coding and
experimentation.
• Symbol Manipulation: LISP excels at processing symbols, making it suitable for artificial
intelligence and symbolic computation.
• Key Features:
• Dynamic typing
• First-class functions
• Macros for powerful metaprogramming.
SCHEME Programming Language
• A dialect of LISP created by Guy L. Steele Jr. and Gerald Jay Sussman in the 1970s.
• Minimalist design: A small, well-defined core language.
• Emphasizes functional programming concepts:
• First-class functions
• Recursion over loops
• Immutability
.
• Lexical scoping and closures.
HASKELL Programming Language
• Developed in the late 1980s, named after logician Haskell Curry.
• Purely functional programming language.
• Strong, static type system with type inference.
• Features:
• Lazy evaluation
• Purity (side-effect free functions)
.
• Powerful abstractions (monads, higher-order functions)
LOGIC PROGRAMMING LANGUAGES

Concepts of Programming Languages - NUN 2024 Austin Olom Ogar


LOGIC PROGRAMMING LANGUAGES
• Declarative programming paradigm: Focus on what to achieve rather than how.
• Based on formal logic (e.g., first-order predicate logic).
• Programs consist of:
• Facts: Statements about the problem domain.
• Rules: Define relationships and how to derive information.
• Computation as Querying: The system finds solutions that satisfy the facts and rules.
• E.g Prolog
.
MODULE ASSIGNMENT
Discuss more on other programming languages that were not discussed earlier.

You might also like