[go: up one dir, main page]

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

CSC 419 Group 1

COMPUTER FINAL YEAR

Uploaded by

ayomidekelly21
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)
27 views26 pages

CSC 419 Group 1

COMPUTER FINAL YEAR

Uploaded by

ayomidekelly21
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

Organisation of

programming languages

Concept of programming languages

Group 1 members
Unit 1
1) Adebayo Precious
190404048
2) Daniel olabambo ayomide
190404117
3) Boluwaji Eniola Daniel
190404033
4) Balogun Praise Ayomide
190404042
5) Oladejo Oluwatamilore Iremide
190404102
6) Okiti Peter Moyinoluwa
190404055
7) Oludare olawale oluwatobi
190404026
Unit 2
8) Adams Olamilekan Ayoola
190404121
9) Ijiwade Isaiah Adekunle
190404021
10) Jegede Samuel oluwatosin
190404032
11) Akinola Francis Temidayo
190404035
12) Agunloye Adetola oluwaseyi
190404118
13) Emmanuel Olajide Akeredolu-Ale
190404023
14) Olubumi victor
190404011
Unit 3
15) Shokoya Damilola Samson
190404088
16) Adejoro Tobi Joseph
190404072
17) Ahmad fahad
190404087
18) Adesoji Temidayo Abidemi
190404041
19) Oladejo Eniola Demilade
200404172
20) Adeola Oluwatimilehin Faith
200404138
21) TONY-AKINLOSOTU Favour A
19040404089
22) Akinkoye Ayodeji peace
190404038

Unit 1: Introduction to programming languages

What is programming language?


A programming language is a set of instructions written by a
programmer to communicate instructions to the computer to
perform and accomplish a task. It is a system of notation for
writing computer program, which are specifications of a
computation or an algorithm. However, some authors restrict
the term “programming languages” to those languages that
can express all possible algorithms. Thus, programming
languages is a set of commands, strings or characters readable
by a programmer and can be easily translated to machine
code. It has Syntax, grammar and semantics.
Syntax is a set of rules for grammar and spelling, it defines
how a program will be written correctly translatable to
machine code
Grammar It is a set of rules that specifies how programs
written in a particular language should be constructed. It is
also a set of rules of using different punctuation marks,
quotation mark, semicolon and other symbols to clarify the
syntax of a programming language.
Semantics is the set of rules that define what each statement
in a programming language means or does, to be able to
properly translate the program to machine code.

Classification of programming languages


Programming languages can be classified into three groups.
1) Machine language:
Machine language is a collection of binary digits or bits
that the computer reads and interprets. Machine language
is the only language a computer can understand. It is a
consisting of binary code, represented by 0s and 1s. It is
the most basic form of programming language that
directly corresponds to the hardware instructions of a
computer’s central processing unit (CPU). It is executed
directly by the central processing unit (CPU). Machine
code is CPU dependent; it is a series of 1s and 0s that
translate to instructions that are understood by the CPU.
Each instruction in machine language is specific to the
computer’s architecture, and programmers rarely use it
directly.
2) Assembly language:
Assembly language uses mnemonic instructions to
represent machine code instructions. These are short,
easy-to-remember words representing specific
instructions that the computer’s processor can
understand. Assembly language encourage Modular
programming
3) High level language:
High-level programming languages allow programmers
to write code that is closer to human language, making it
easier to read, write. It supports the human and
application side of programming. Example c, c++,java,
python, JavaScript etc.

Attributes of a good programming languages


Good programming languages possess several key attributes
that make them effective tools for software development:

1. Readability: A good programming language should be


easy to read and understand. Clear syntax and well-
defined structures help developers write code that is easy
to comprehend and maintain.

2. Writability: The language should allow developers to


express their ideas and algorithms concisely and
efficiently. Writing code in the language should be
straightforward and not overly verbose.

3. Reliability: The language should facilitate writing


reliable and bug-free code. It should include features like
strong typing, error handling mechanisms, and clear
documentation to help developers write robust software.

4. Portability: A good programming language should be


portable across different platforms and architectures.
This means that code written in the language should be
able to run on various systems without major
modifications.

5. Performance: While ease of use is essential, the language


should also offer good performance. It should allow
developers to write efficient code that runs quickly and
consumes reasonable amounts of system resources.

6. Community and Ecosystem: A thriving community and


ecosystem around the language are crucial. This includes
access to libraries, frameworks, tools, and active support
communities that help developers solve problems and
build software more effectively.

7. Scalability: The language should support the


development of both small-scale and large-scale projects.
It should offer features and tools that enable developers
to manage complexity and scale their applications as
needed.

8. Security: Security features built into the language can


help developers write more secure code by preventing
common vulnerabilities like buffer overflows, injection
attacks, and insecure data handling.

9. Flexibility: A good programming language should be


flexible enough to support different programming
paradigms and styles. It should allow developers to
choose the approach that best fits their problem domain
and coding preferences.
10. Maintainability: The language should support code
maintainability by encouraging good coding practices,
modular design, and easy refactoring. It should also
facilitate collaboration among developers working on the
same codebase.

11. Orthogonality: Two components are orthogonal if a


change in one does not affect the other.

12. Reusability: This is the capacity to repurpose pre-


existing code when developing new software
applications. Ideally, code reuse should be easy to
implement, and any stable, functional code could freely
be reused when building a new software application.

Program performance and features of programming


languages

Program performance refers to how efficiently a program


executes its tasks, including how quickly it completes
computations, how much memory it consumes, and how
effectively it utilizes system resources. The performance of a
program can be influenced by various factors, including the
algorithms used, data structures employed, and the efficiency
of the programming language itself.
The features of a programming language play a significant
role in determining program performance. Here’s how various
language features can impact performance:

1. Execution speed: Some programming languages, such as


C and C++, are known for their high execution speed.
They offer low-level control over system resources and
allow developers to optimize code for performance. In
contrast, languages like Python and Ruby prioritize ease
of use and may sacrifice execution speed for developer
productivity.

2. Memory management: Languages with manual memory


management, like C and C++, require developers to
explicitly allocate and deallocate memory. While this
level of control can lead to efficient memory usage, it
also increases the risk of memory leaks and segmentation
faults if not managed properly. Languages with
automatic memory management, such as Java and
Python, use garbage collection mechanisms to reclaim
unused memory, which can introduce overhead but helps
prevent memory-related errors.

3. Static vs. Dynamic typing: Languages with static typing,


like Java and C#, perform type checking at compile time,
which can lead to more efficient code execution since
type information is known in advance. Dynamic
languages, such as Python and JavaScript, perform type
checking at runtime, which can result in additional
overhead but offers flexibility and ease of development.

4. Optimization capabilities: Some programming languages


provide built-in optimization features or allow
developers to apply compiler optimizations to improve
program performance. For example, languages like C
and C++ offer compiler flags and optimization
techniques to generate highly optimized machine code.

5. Concurrency and parallelism: Languages that support


concurrency and parallelism, such as Go and Erlang,
enable developers to write programs that execute tasks
concurrently or in parallel, potentially improving
performance by utilizing multiple CPU cores or handling
asynchronous tasks efficiently.

6. Standard libraries and frameworks: The availability of


optimized standard libraries and frameworks can
significantly impact program performance. Languages
with extensive standard libraries and mature frameworks,
like Java and .NET, offer developers pre-built
components and tools for common tasks, which can help
improve productivity and performance.
Unit 2: Programming language evolution and
paradigms

The evolution of programming languages spans several


decades and has been influenced by advances in technology,
changes in computing paradigms, and the evolving needs of
software development. Here’s a broad overview of the major
phases in the evolution of programming languages:

1. The beginning 1883:


Charles Babbage had made the device these period but he
didn’t know how to give instructions to it. Ada Lovelace
wrote the code for computing Bernoulli’s number.

2. Machine Language and Assembly Language (1940s-


1950s):

- Initially, programmers wrote code directly in machine


language, which consisted of binary instructions understood by
the computer’s hardware.
- Assembly language (1949), which used mnemonic codes to
represent machine instructions, provided a more readable and
easier-to-write alternative to machine language.
3. High-Level Programming Languages (1950s-1960s):
- High-level programming languages like FORTRAN
(1954), Lisp, and COBOL (1959) were developed to
provide abstraction from the underlying hardware and
make programming more accessible to a wider audience.
- These languages introduced features such as symbolic
names for variables, control structures like loops and
conditionals, and support for complex data structures.

4. Procedural Programming Languages (1960s-1970s):


-Procedural programming languages like ALGOL,
Pascal, and C introduced the concept of structured
programming, which emphasized the use of subroutines
and modular design to improve code readability and
maintainability.
- Languages like C introduced features such as pointers and
low-level memory manipulation, enabling greater control over
system resources.

5. Object-Oriented Programming Languages (1970s-1980s):


- Object-oriented programming (OOP) languages like
Simula, Smalltalk, and later, C++, introduced the concept of
classes and objects, encapsulation, inheritance, and
polymorphism.
- OOP languages facilitated code reuse, modularity, and
abstraction, making it easier to manage and maintain large
software projects.

6. Scripting and Dynamic Languages (1990s-2000s):


- Scripting languages like Perl, Python, and Ruby gained
popularity for their ease of use, dynamic typing, and
support for rapid development.
- Dynamic languages offered features such as automatic
memory management and dynamic typing, making them well-
suited for web development, scripting, and prototyping.

7. Functional Programming Languages (1980s-present):


- Functional programming languages like Lisp, ML,
Haskell, and later, Scala and Clojure, emphasize the use
of mathematical functions and immutable data structures.
- Functional languages support higher-order functions,
pattern matching, and declarative programming paradigms,
enabling concise and expressive code.

8. Concurrency-Oriented Languages (2000s-present):


- With the rise of multi-core processors and distributed
computing, languages like Go, Erlang, and Rust have
focused on concurrency, parallelism, and safe concurrent
programming.
- These languages offer features such as lightweight threads
(goroutines), actor-based concurrency models, and memory
safety mechanisms.

The evolution of programming languages continues to evolve,


with ongoing efforts to improve language design, performance,
and developer productivity in response to emerging
technologies and changing software development practices.
Programming paradigms are overarching models or styles that
dictate how programming languages are structured, how code
is organized, and how tasks are accomplished within a program.
Different programming paradigms offer distinct approaches to
problem-solving and program design. Here are some common
paradigms:

1. Imperative Programming: In imperative programming, the


focus is on describing how a program operates by giving
a sequence of commands or statements that modify the
program’s state. Languages like C, Pascal, and BASIC
follow this paradigm.

2. Declarative Programming:
- Functional Programming: Functional programming
emphasizes the evaluation of expressions and the use of
functions as primary building blocks. Languages like Haskell,
Lisp, and Erlang adhere to this paradigm.
- Logic Programming: Logic programming involves
describing the problem domain in terms of logical relationships
and constraints. Prolog is a well-known logic programming
language.

2. Object-Oriented Programming (OOP): OOP focuses on


modeling real-world entities as objects that encapsulate
data and behavior. Objects interact with each other
through defined interfaces. Languages like Java, C++, and
Python support OOP principles.

3. Procedural Programming: Procedural programming


organizes code around procedures or routines that perform
specific tasks. It emphasizes modularity and code reuse.
C, Pascal, and Fortran are examples of procedural
languages.

4. Event-Driven Programming: In event-driven


programming, the flow of the program is determined by
events triggered by user actions or system events.
Languages like JavaScript (in web development) and GUI
frameworks like Java Swing use event-driven
programming.

5. Aspect-Oriented Programming (AOP): AOP is a paradigm


that allows developers to modularize cross-cutting
concerns, such as logging, authentication, and transaction
management, which cut across multiple modules of a
program. AspectJ is a popular language extension for Java
that supports AOP.

6. Concurrent and Parallel Programming: This paradigm


deals with writing programs that can execute multiple
tasks concurrently or in parallel, often to utilize multicore
processors effectively. Languages like Go, Erlang, and
Clojure provide features for concurrent and parallel
programming.

7. Meta Programming: Meta programming involves writing


programs that manipulate other programs or themselves as
data. It often involves techniques like code generation,
reflection, and introspection. Languages like Lisp, Ruby,
and Python support meta programming.

Programming languages can support multiple paradigms, and


the choice of paradigm often depends on the problem domain,
the nature of the application, and the preferences of the
developers. Many modern languages offer support for multiple
paradigms, allowing developers to choose the most suitable
approach for their specific requirements.

Unit3: Structured and unstructured


programming language

Structured programming and unstructured programming


represent different approaches to organizing and
controlling the flow of instructions in a program.

Structured Programming:

Structured programming is a programming paradigm that


emphasizes the use of well-structured techniques for
organizing code. It advocates for the use of control
structures like sequences, selections (if-else statements),
and iterations (loops) to create clear, readable, and
maintainable code.

Unstructured Programming:

Unstructured programming, also known as spaghetti


programming, is an older style of programming
characterized by a lack of modularization and structured
control flow. In unstructured programming, the code tends
to be written as a series of instructions with extensive use
of Goto statements to control program flow.

Elementary structures of structure programming:

1. Block:
- A block is a group of statements or declarations enclosed
within braces `{}` in many programming languages.
- Blocks are used to define the scope of variables, to group
statements that should be treated as a single unit, and to control
the flow of execution.
- In languages like C, C++, Java, and JavaScript, blocks are
commonly used within functions, conditionals, loops, and other
control structures.

2. Selection:
- Selection refers to the process of making decisions in a
program based on certain conditions.
- Selection is typically implemented using conditional
statements such as `if`, `else if`, and `else` in most
programming languages.
- Based on the evaluation of a condition, the program decides
which branch of code to execute.
- Selection statements allow programs to perform different
actions based on the state of the program or the input data.

3. Iteration:
- Iteration, also known as looping or repetition, refers to the
process of executing a block of code repeatedly.
- Iteration is often used when the same set of instructions
needs to be executed multiple times until a certain condition is
met or for a specified number of iterations.
- Common loop constructs include `for`, `while`, and `do-
while` loops in programming languages like C, Java, Python,
and JavaScript.
- Iteration is essential for tasks such as traversing arrays,
processing lists, and performing repetitive computations.

4. Nesting:
- Nesting refers to the practice of placing one construct inside
another, such as placing a loop within another loop or placing
conditional statements within other conditional statements.
- Nesting allows for the creation of complex program logic
by combining multiple levels of control flow constructs.
- For example, a `for` loop may contain an `if` statement
inside it, or an `if` statement may contain another `if` statement
within its block.
- Proper indentation and formatting are crucial for
maintaining readability when nesting multiple levels of
constructs.

5. Subroutine:
- A subroutine, also known as a function or procedure, is a
named block of code that performs a specific task.
- Subroutines are reusable units of code that can be called
from different parts of a program.
- They help in modularizing code, promoting code reuse, and
improving the readability and maintainability of programs.
- Subroutines typically accept parameters, perform operations
based on those parameters, and optionally return a value.
- Languages like C, C++, Java, Python, and JavaScript
support the definition and invocation of subroutines.

Different between structured and unstructured


programming languages

Structured and unstructured programming languages represent


different approaches to organizing and controlling the flow of
instructions in a program. Here are the key differences between
the two:

Structured Programming Languages:

1. Organization: Structured programming languages


emphasize well-organized, modular code structures.
Programs are divided into smaller, manageable units such
as functions, procedures, and modules.

2. Control Flow: Control flow in structured programming


languages is managed using structured constructs like
sequences, selections (if-else statements), and iterations
(loops). Goto statements are discouraged or limited in
their use.

3. Readability and Maintainability: Structured programming


languages promote readability and maintainability by
encouraging clear, understandable code structures.
Modularization allows for easier debugging, testing, and
maintenance of code.

4. Scalability: Structured programming supports the


development of scalable applications by promoting code
reuse and modularity. Programs can be easily extended
and modified without causing disruptions to other parts of
the codebase.

5. Examples: Examples of structured programming


languages include C, Pascal, Ada, and modern versions of
Fortran.

Unstructured Programming Languages:


1. Lack of Organization: Unstructured programming
languages lack clear organization and modularization.
Programs are typically written as sequences of
instructions without well-defined boundaries between
different parts of the code.

2. Goto Statements: Unstructured programming languages


rely heavily on Goto statements to control the flow of
execution. Goto statements allow programmers to transfer
control arbitrarily within the program, leading to spaghetti
code and making programs difficult to understand and
maintain.

3. Readability and Maintainability Issues: Unstructured


programming languages suffer from poor readability and
maintainability due to the lack of clear structure and the
extensive use of Goto statements. Programs written in an
unstructured manner are challenging to debug, test, and
modify.

4. Scalability Challenges: Unstructured programming


languages pose scalability challenges as programs grow in
size and complexity. Making changes or adding new
features to unstructured codebases can be error-prone and
time-consuming.
5. Historical Context: Early versions of programming
languages like FORTRAN and assembly language
programming often exhibited characteristics of
unstructured programming. However, modern
programming languages have largely moved away from
unstructured paradigms in favor of structured
programming principles.

Type of structured programming


Procedural programming, object-oriented programming
(OOP), and model-based programming are different paradigms
within the realm of structured programming. Here’s a brief
explanation of each within the context of structured
programming:

1. Procedural Programming:
- Procedural programming is a structured programming
paradigm that focuses on organizing code into procedures or
functions.
- It emphasizes the use of procedures to break down tasks into
smaller, reusable units of code.
- Programs are structured around procedures that perform
specific tasks, with a main program coordinating the execution
of these procedures.
- Languages like C, Pascal, and BASIC are examples of
procedural programming languages.

2. Object-Oriented Programming (OOP):


- Object-oriented programming is a structured programming
paradigm that emphasizes the concept of objects.
- It organizes code around the concept of objects, which
encapsulate data and behavior.
- Classes define the structure and behavior of objects, and
objects interact with each other through defined interfaces.
- OOP promotes code reuse, modularity, and extensibility
through concepts like inheritance, polymorphism, and
encapsulation.
- Languages like Java, C++, Python, and C# support object-
oriented programming.

3. Model-Based Programming:
- Model-based programming is a structured approach where
programs are built around models that represent real-world
entities, processes, or systems.
- It emphasizes the use of models to define the structure,
behavior, and interactions of software components.
- Models are used to generate executable code, perform
simulations, or analyze system behavior.
- Model-based programming is common in domains such as
embedded systems, control systems, and software engineering.
- Tools like MATLAB/Simulink, LabVIEW, and UML
(Unified Modeling Language) support model-based
programming.

Advantages of structured programming


Procedural programming, object-oriented programming
(OOP), and model-based programming are different
paradigms within the realm of structured programming.
Here's a brief explanation of each within the context of
structured programming:

1. Procedural Programming:
- Procedural programming is a structured programming
paradigm that focuses on organizing code into procedures
or functions.
- It emphasizes the use of procedures to break down
tasks into smaller, reusable units of code.
- Programs are structured around procedures that
perform specific tasks, with a main program coordinating
the execution of these procedures.
- Languages like C, Pascal, and BASIC are examples of
procedural programming languages.

2. Object-Oriented Programming (OOP):


- Object-oriented programming is a structured
programming paradigm that emphasizes the concept of
objects.
- It organizes code around the concept of objects, which
encapsulate data and behavior.
- Classes define the structure and behavior of objects,
and objects interact with each other through defined
interfaces.
- OOP promotes code reuse, modularity, and
extensibility through concepts like inheritance,
polymorphism, and encapsulation.
- Languages like Java, C++, Python, and C# support
object-oriented programming.

3. Model-Based Programming:
- Model-based programming is a structured approach
where programs are built around models that represent
real-world entities, processes, or systems.
- It emphasizes the use of models to define the structure,
behavior, and interactions of software components.
- Models are used to generate executable code, perform
simulations, or analyze system behavior.
- Model-based programming is common in domains
such as embedded systems, control systems, and software
engineering.
- Tools like MATLAB/Simulink, LabVIEW, and UML
(Unified Modeling Language) support model-based
programming.

Disadvantages of structured programming

While structured programming offers many advantages, it also


has some limitations and disadvantages. Here are three
disadvantages of structured programming:

1. Limited Expressiveness:
- Structured programming languages may lack the expressive
power to represent certain complex algorithms or problem
domains efficiently.
- Some programming tasks may require convoluted
workarounds or compromises to fit within the structured
paradigm, leading to less elegant or less efficient solutions.

2. Inefficiency in Certain Scenarios:


- In some cases, structured programming constructs may
result in less efficient code compared to more low-level or
specialized approaches.
- For tasks that require fine-grained control over memory or
CPU resources, structured programming languages may
introduce overhead or limitations that impact performance.

3. Difficulty Handling Certain Patterns:


- Structured programming may struggle to handle certain
programming patterns or paradigms elegantly.
- For example, tasks involving complex state machines,
event-driven programming, or highly concurrent systems may
be challenging to implement or maintain within a purely
structured framework.
- Developers may need to resort to workarounds or external
libraries to address these challenges, which can introduce
complexity and reduce code clarity.

You might also like