Credit: https://slideplayer.com/
Unit 1 Introduction to Programming language 1.1 Programming Langauges_Machine level Language ,Assembly Language and High level Lamguage 1.2 Software introductions and its types along with example 1.3 Generations of programming language with short intro 1.4 Structured Programing language
Introduction to Programming Language and its types :
A programming language is a formal system designed to instruct a computer to perform specific tasks. It serves as an intermediary between humans and computers, allowing programmers to communicate instructions in a way that the computer can understand and execute. Programming languages play a crucial role in software development, enabling the creation of a wide range of applications, from simple scripts to complex software systems.
Here are some key concepts to understand about programming languages:
1. Syntax:
- Definition:Syntax refers to the set of rules that dictate how programs written in a particular language should be structured.
- Importance: Proper syntax is crucial for the compiler or interpreter to understand and execute the code correctly.
2. Semantics:
- Definition:Semantics deals with the meaning of the instructions written in a programming language.
- Importance: A program may have correct syntax but still produce incorrect results if the semantics are not accurate.
3. **Variables and Data Types:**
- **Definition:** Variables are used to store and manipulate data in a program, and data types define the kind of data that can be stored in a variable.
- **Example:** Integer, float, string, boolean, etc.
4. **Control Flow:**
- **Definition:** Control flow refers to the order in which instructions are executed in a program. It includes concepts like loops, conditionals, and branching.
- **Example:** if statements, for loops, while loops.
5. **Functions and Procedures:**
- **Definition:** Functions and procedures are blocks of code that can be defined and called to perform specific tasks. They promote code reusability.
- **Importance:** Breaking down a program into functions makes it more modular and easier to maintain.
6. **Object-Oriented Programming (OOP):**
- **Definition:** OOP is a programming paradigm that uses objects—collections of data and methods—to design and structure code.
- **Key Concepts:** Encapsulation, inheritance, polymorphism.
7. **Compiled vs. Interpreted Languages:**
- **Compiled:** Code is translated into machine code before execution. Examples include C, C++.
- **Interpreted:** Code is executed line by line. Examples include Python, JavaScript.
8. **Integrated Development Environments (IDEs):**
- **Definition:** IDEs provide tools and features to assist programmers in writing, debugging, and testing code.
- **Examples:** Visual Studio, Eclipse, PyCharm.
9. **Common Programming Languages:**
- **High-Level Languages:** Python, Java, C#, JavaScript.
- **Low-Level Languages:** Assembly language, C, C++.
10. **Application Areas:**
- Different programming languages are suited for specific tasks. For example, web development often involves languages like HTML, CSS, and JavaScript, while data analysis may use languages like Python and R.
Machine Level Language, Assembly Language, and High-Level Language.
### 1. **Machine Level Language:**
- **Definition:** Machine language is the lowest-level programming language that directly corresponds to the machine code executed by a computer's central processing unit (CPU). It consists of binary code (0s and 1s).
- **Characteristics:**
- Each instruction corresponds to a specific operation at the hardware level.
- Machine-dependent, meaning it varies from one computer architecture to another.
- Tedious and error-prone for humans to write or understand.
- **Example:**
```
01101001 10010100 00011011
11010110 00100100 11100001
... (binary machine code)
```
### 2. **Assembly Language:**
- **Definition:** Assembly language is a low-level programming language that uses symbolic instructions instead of binary code. It is a human-readable representation of machine language.
- **Characteristics:**
- Each assembly language instruction typically corresponds to one machine language instruction.
- Easier to read and write than machine language but still closely tied to the computer's architecture.
- Assembly language programs need an assembler to convert them into machine code.
- **Example:**
```assembly
MOV AX, 5
ADD BX, AX
JMP START
```
3. **High-Level Language:**
- **Definition:** High-level languages are designed to be more user-friendly, allowing programmers to write code that is closer to human language. They are portable and not tied to the specifics of a particular computer architecture.
- **Characteristics:**
- Abstracted from machine details, making it easier for programmers to focus on problem-solving.
- Requires a compiler or interpreter to translate code into machine language.
- Generally more readable and maintainable than low-level languages.
- **Examples:**
- **Python:**
```python
x = 5
y = 10
z = x + y
print(z)
```
- **Java:**
```java
int x = 5;
int y = 10;
int z = x + y;
System.out.println(z);
```
1.2 Software introductions and its types along with example
### 1.2 Software Introductions and Types:
**Definition:**
Software refers to a set of instructions, programs, or data used to operate computers and execute specific tasks. It's a key component in computing that enables hardware to perform functions and fulfill user needs.
**Types of Software:**
1. **System Software:**
- **Definition:** System software manages and controls computer hardware to provide a platform for other software to run.
- **Examples:**
- **Operating Systems (OS):** Windows, macOS, Linux, Android, iOS.
- **Device Drivers:** Software facilitating communication between operating systems and hardware components.
2. **Application Software:**
- **Definition:** Application software serves specific purposes and enables users to perform tasks.
- **Examples:**
- **Word Processors:** Microsoft Word, Google Docs.
- **Spreadsheets:** Microsoft Excel, Google Sheets.
- **Web Browsers:** Chrome, Firefox, Safari.
- **Graphics Software:** Adobe Photoshop, GIMP.
3. **Development Software:**
- **Definition:** Development software, or programming tools, assists developers in creating, testing, and maintaining software applications.
- **Examples:**
- **Integrated Development Environments (IDEs):** Visual Studio, Eclipse.
- **Text Editors:** Sublime Text, Atom.
- **Version Control Systems:** Git, SVN.
4. **Utility Software:**
- **Definition:** Utility software provides tools to perform system maintenance, optimization, and other tasks.
- **Examples:**
- **Antivirus Software:** Norton, McAfee.
- **Disk Cleanup Tools:** CCleaner.
- **Compression Software:** WinRAR, 7-Zip.
5. **Middleware:**
- **Definition:** Middleware acts as a bridge between different software applications, facilitating communication and data management.
- **Examples:**
- **Database Management Systems (DBMS):** MySQL, Oracle.
- **Web Servers:** Apache, Nginx.
6. **Embedded Software:**
- **Definition:** Embedded software is specialized software designed to control embedded systems in devices other than computers.
- **Examples:**
- **Firmware in Smartphones:** Controls device hardware and interfaces with the operating system.
- **Automotive Control Systems:** Software in car control units.
7. **Artificial Intelligence (AI) Software:**
- **Definition:** AI software employs algorithms to perform tasks that typically require human intelligence.
- **Examples:**
- **Machine Learning Frameworks:** TensorFlow, PyTorch.
- **Natural Language Processing (NLP) Tools:** spaCy, NLTK.
8. **Business Software:**
- **Definition:** Business software supports business processes and operations.
- **Examples:**
- **Enterprise Resource Planning (ERP):** SAP, Oracle ERP.
- **Customer Relationship Management (CRM):** Salesforce, HubSpot.
9. **Entertainment Software:**
- **Definition:** Entertainment software provides recreational content and experiences.
- **Examples:**
- **Video Games:** Fortnite, Minecraft.
- **Streaming Platforms:** Netflix, Spotify.
10. **Open Source Software:**
- **Definition:** Open source software is distributed with a license that allows users to view, modify, and distribute the source code.
- **Examples:**
- **Operating Systems:** Linux.
- **Web Browsers:** Firefox, Chromium.
Software is a dynamic field with constant advancements, and new categories of software emerge as technology evolves. The diverse types of software cater to various needs, from basic computer operations to complex business processes and innovative technologies like artificial intelligence.
1.3 Generations of programming language
-Programming languages have evolved over time, and they are often categorized into different generations based on their features, capabilities, and advancements. Here's a brief overview of the four generations of programming languages:
### 1. First Generation (1940s - 1950s) - Machine Code and Assembly Language:
- **Introduction:** The first generation of programming languages directly corresponds to the hardware architecture and is machine-dependent.
- **Languages:**
- **Machine Code:** Binary code representing instructions directly executable by the computer's CPU.
- **Assembly Language:** Symbolic representations of machine code using mnemonics and symbols.
- **Characteristics:**
- Closest to the computer's hardware.
- Low-level and machine-specific.
- Tedious and error-prone for programmers.
### 2. Second Generation (1950s - 1960s) - Assembly Languages and Low-Level Languages:
- **Introduction:** Second-generation languages introduced assembly languages and low-level programming languages that allowed for more abstraction than machine code.
- **Languages:**
- **Assembly Languages:** Symbolic representations of machine code with more user-friendly mnemonics.
- **Fortran, COBOL:** High-level languages designed for specific domains (scientific and business, respectively).
- **Characteristics:**
- Still closely tied to hardware.
- Easier for programmers compared to machine code.
- Improved readability and usability.
### 3. Third Generation (1960s - Present) - High-Level Languages:
- **Introduction:** The third generation brought about high-level programming languages, which are more abstract, portable, and independent of hardware architecture.
- **Languages:**
- **C, Pascal, Fortran, COBOL:** Early high-level languages.
- **Java, Python, C#:** Modern high-level languages with increased abstraction.
- **Characteristics:**
- Platform-independent and portable.
- Improved programmer productivity.
- Abstraction from machine details.
### 4. Fourth Generation (1970s - Present) - Declarative and Problem-Solving Languages:
- **Introduction:** Fourth-generation languages focus on declarative programming and problem-solving, enabling programmers to specify what needs to be done rather than how to do it.
- **Languages:**
- **SQL:** Declarative language for database queries.
- **MATLAB, R:** Problem-solving languages for mathematical and statistical analysis.
- **Characteristics:**
- Higher level of abstraction.
- Emphasis on solving specific problems.
- Often used for database queries and data analysis.
These generations represent the evolutionary stages of programming languages, with each generation building upon the strengths and weaknesses of its predecessors. The transition from low-level, machine-dependent languages to high-level, portable languages has played a crucial role in making programming more accessible, efficient, and versatile.
1.4 Structured Programing language
Structured programming is a programming paradigm aimed at improving the clarity, quality, and development time of a computer program by using structured control flow and modularization. The key principles of structured programming involve organizing code into well-structured and easily understandable blocks. Here are some fundamental concepts associated with structured programming:
### 1. **Control Structures:**
- **Definition:** Structured programming emphasizes the use of three basic control structures to guide the flow of a program: sequence, selection (decision), and iteration (looping).
- **Examples:**
- **Sequence:** Executing statements in a sequential order.
- **Selection:** If-else statements for decision-making.
- **Iteration:** Loops (for, while) for repetitive tasks.
### 2. **Modularization:**
- **Definition:** Breaking down a program into smaller, manageable, and reusable modules or functions.
- **Advantages:**
- Enhances code readability and maintainability.
- Encourages code reuse.
- Facilitates teamwork in large projects.
### 3. **Top-Down Design:**
- **Definition:** The top-down design approach starts with a high-level view of the system and progressively refines it into more detailed levels.
- **Advantages:**
- Provides a clear hierarchy of program structure.
- Allows focusing on one aspect at a time, simplifying problem-solving.
### 4. **Structured Data Types:**
- **Definition:** The use of structured data types, such as arrays and records (structs), to organize and store related pieces of information.
- **Advantages:**
- Improves data organization and retrieval.
- Enhances code clarity by grouping related data.
### 5. **Procedural Abstraction:**
- **Definition:** Encapsulating a series of steps into a procedure or function, abstracting the details of the implementation.
- **Advantages:**
- Promotes code reuse and modularity.
- Reduces code duplication.
### 6. **No GOTO Statements:**
- **Definition:** Avoiding the use of unconditional branching statements like GOTO.
- **Advantages:**
- GOTO statements can lead to spaghetti code and make the program difficult to understand.
- The structured approach uses structured control flow instead.
### 7. **Code Readability:**
- **Definition:** Structured programming emphasizes writing code that is easy to read and understand.
- **Advantages:**
- Enhances collaboration among team members.
- Reduces the likelihood of introducing errors during maintenance.
### 8. **Examples of Structured Programming Languages:**
- **C:** A procedural language that supports structured programming principles.
- **Pascal:** Designed with a focus on structured programming.
- **Ada:** Developed for large-scale, mission-critical systems with structured programming features.
Structured programming has had a significant impact on software development, promoting best practices and contributing to the creation of clear, maintainable, and efficient code. While newer programming paradigms, such as object-oriented programming, have emerged, structured programming principles continue to be relevant and widely applied in modern software development.