0% found this document useful (0 votes)
2 views11 pages

Programming Methodology and Data Structures Notes Unit1

Uploaded by

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

Programming Methodology and Data Structures Notes Unit1

Uploaded by

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

Programming Methodology and Data Structures

Chapter 1
What is Program?
A computer program, often simply referred to as a "program," is a set of
instructions written in a programming language that directs a computer to
perform a specific task or a series of tasks. These instructions outline the steps
the computer should follow in order to achieve a desired outcome. Programs are
the fundamental building blocks of software and are responsible for controlling
the behavior of computers and other electronic devices.
Key characteristics of a computer program include:
Sequence of Instructions: Programs consist of a sequence of individual
instructions, which are executed in the order they are written. Each instruction
corresponds to a specific action that the computer should perform.
Logic and Control Flow: Programs include decision-making processes (using
conditional statements like "if" and "else") and repetitive structures (using loops)
that control the flow of execution based on conditions and requirements.
Data Manipulation: Programs interact with and manipulate data, performing
calculations, comparisons, and transformations on various types of information.
Modularity and Reusability: Programs are often organized into smaller,
modular components or functions. This allows for better organization, code
reuse, and easier maintenance.
Input and Output: Programs can receive input from users, external devices, or
other programs, and they can generate output in the form of information
displayed to users, data saved to files, or interactions with other software.
Abstraction: Programs often involve abstracting complex processes into
simpler, more manageable steps. This makes it easier for programmers to write,
understand, and maintain code.
Error Handling: Programs include mechanisms to handle errors and exceptions
that may occur during execution, ensuring that the program can gracefully
recover from unexpected situations.
Memory Management: Programs manage computer memory to store data and
instructions while they are being processed.
Examples of computer programs range from simple scripts that automate a
repetitive task to complex software applications like web browsers, video games,
word processors, and operating systems. Without programs, computers would
remain inert machines, unable to perform tasks beyond their basic hardware
capabilities.
What is Programming?
Programming refers to the process of writing, designing, and developing
computer programs using programming languages. It involves creating a set of
instructions that a computer can understand and execute to perform a specific
task or achieve a particular goal. Programming is a creative and problem-solving
endeavor that bridges the gap between human understanding and machine
execution.
Key aspects of programming include:
Problem Solving: Programming is essentially about solving problems through
computational thinking. Programmers break down complex tasks into smaller,
manageable steps that a computer can execute.
Algorithm Design: Programmers create algorithms, which are step-by-step
procedures or sets of rules that outline how a specific problem should be solved.
Algorithms provide a logical blueprint for writing code.
Writing Code: Programming involves writing code in a specific programming
language. Code is a series of statements and instructions that adhere to the
syntax and semantics of the chosen language.
Debugging: Debugging is the process of identifying and fixing errors, bugs, and
issues in the code. It requires careful analysis and testing to ensure that the
program functions as intended.
Testing and Optimization: Programmers test their code to ensure it produces the
correct output and behaves as expected. They also optimize code for efficiency,
striving to make programs run faster and use fewer resources.
Collaboration: In larger projects, programmers often collaborate with other team
members. Version control systems and collaborative tools facilitate working
together on the same codebase.
Continuous Learning: Programming is a field that constantly evolves, with new
languages, frameworks, and tools emerging regularly. Programmers need to stay
updated and continuously learn to keep up with the latest developments.
Problem Domains: Programming is used in various domains, including software
development, web development, game development, data analysis, artificial
intelligence, and more.
Popular programming languages include Python, Java, C++, JavaScript, Ruby,
and many others. Each language has its own syntax, features, and strengths,
making it suitable for specific types of projects.
Ultimately, programming empowers individuals to leverage technology to solve
problems, automate tasks, and create innovative solutions that impact various
aspects of modern life.
What is Programming Language?
Programming Language: A Brief Overview
A programming language is a formal and structured system used to
communicate instructions to a computer. It serves as a bridge between human
understanding and machine execution, allowing programmers to write code that
can be understood and executed by computers. Programming languages enable
the creation of software, applications, and systems that drive modern technology.
Key Characteristics:
Syntax and Semantics: Programming languages have a set of rules that define
how code should be written (syntax) and the meanings behind the code
(semantics). Proper syntax is essential for code to be interpretable by both
humans and computers.
Abstraction: Languages provide various levels of abstraction, allowing
programmers to work at higher levels of conceptualization rather than dealing
with low-level details of hardware.
Expressiveness: Different languages have varying degrees of expressiveness,
allowing programmers to write code more concisely and clearly. Some languages
provide specific constructs for certain tasks, enhancing expressiveness.
Types and Variables: Languages support different data types (integers, strings,
etc.) and allow programmers to define variables to hold data.
Control Structures: Languages provide control structures like loops and
conditionals to control the flow of program execution based on conditions.
Functions and Libraries: Functions are reusable blocks of code that perform
specific tasks. Libraries offer pre-built functions for common operations, saving
time and effort.
Compilers and Interpreters: Programming languages are processed by compilers
(which convert code into machine-readable form) or interpreters (which execute
code directly).
Paradigms: Languages follow specific programming paradigms, such as
imperative, functional, object-oriented, and more. These paradigms influence
how code is structured and organized.
Types of Languages:
High-Level Languages: Closer to human languages, high-level languages offer
abstraction and ease of use. Examples include Python, Java, and Ruby.
Low-Level Languages: These languages are closer to machine code and provide
more direct control over hardware. Assembly language is a common example.
Interpreted Languages: Code is executed line-by-line by an interpreter. Examples
include Python, JavaScript, and Ruby.
Compiled Languages: Code is translated into machine code before execution. C+
+, Java, and Swift are examples of compiled languages.
Choosing a Language:
The choice of programming language depends on factors like project
requirements, the domain of application, available libraries, programmer
expertise, and performance considerations. Different languages excel in different
areas, and the right choice can significantly impact the success of a project.
Characteristics of a Good Programming Language:
Readability and Clarity: A good programming language should have clear and
intuitive syntax, making it easy for programmers to read and understand the
code. Code readability reduces errors and aids collaboration among developers.
Expressiveness: The language should allow programmers to express complex
ideas and algorithms concisely and clearly. An expressive language minimizes
the amount of code needed to achieve a certain task.
Abstraction: The language should provide abstraction mechanisms that allow
programmers to work at higher levels of functionality without getting bogged
down in low-level details. Abstraction enhances code clarity and reduces
complexity.
Portability: A good language should be portable, meaning that code written in
one environment or platform can be easily executed in another without major
modifications.
Flexibility: The language should support a variety of programming paradigms
(imperative, object-oriented, functional, etc.), allowing programmers to choose
the best approach for their specific task.
Standard Libraries: A rich set of standard libraries and built-in functions can save
developers time by providing pre-written code for common tasks, such as string
manipulation, data structures, and networking.
Community and Documentation: A strong community of developers and
comprehensive documentation are essential. A vibrant community can provide
support, share knowledge, and contribute to the growth of the language.
Memory Management: The language should have efficient memory management
mechanisms, either through automatic garbage collection or manual memory
control, to prevent memory leaks and optimize resource usage.
Performance: While high-level languages prioritize ease of use, a good language
should also offer good performance. Balancing between abstraction and
performance is crucial.
Error Handling: The language should provide robust error handling mechanisms
that help developers identify, manage, and debug errors effectively, making the
development process smoother.
Security: A good language should have security features built-in, such as
mechanisms to prevent common vulnerabilities like buffer overflows and
injection attacks.
Scalability: The language should be able to handle projects of varying sizes and
complexities, from small scripts to large-scale applications.
Compatibility: It's important that the language can integrate well with other
languages and technologies. It should have support for interfacing with other
programming languages and systems.
Vendor and Platform Neutrality: Ideally, the language should not be tied to a
specific vendor or platform, reducing lock-in and ensuring flexibility.
Evolvability: A good language should evolve over time to adapt to changing
programming needs and technological advancements.
Community Support and Job Market: A strong job market and a community of
developers can provide career opportunities and a broader skill pool for
employers.
Different programming languages prioritize these characteristics to varying
degrees, and the choice of language often depends on the specific needs of a
project or application.
Top of Form
Bottom of Form
The Program Development Life Cycle (PDLC) outlines the stages that a software
project goes through, from conception to completion. These stages provide a
structured approach to developing software while ensuring quality and efficiency.
Here are the steps in the PDLC along with a diagram illustrating the process:
Steps in the Program Development Life Cycle:
Analysis:
Identify the problem or requirement.
Gather and analyze user needs and system requirements.
Define the scope and objectives of the project.
Design:
Create a design that outlines the architecture and structure of the software.
Specify the components, modules, and their relationships.
Design user interfaces, data structures, algorithms, and databases.
Implementation:
Write code based on the design specifications.
Create modules and functions according to the design.
Focus on maintainability, readability, and adherence to coding standards.
Testing:
Conduct various types of testing, such as unit testing, integration testing, and
system testing.
Identify and fix bugs, errors, and issues in the code.
Verify that the software functions as expected and meets requirements.
Documentation:
Create user manuals, technical documentation, and any necessary guides.
Document code, including comments, to aid in future maintenance and
understanding.
Deployment:
Prepare the software for release by packaging and configuring it.
Install the software on target systems or servers.
Perform any necessary setup, configurations, and database migrations.
Maintenance:
Provide ongoing support, updates, and bug fixes.
Address user feedback and make improvements as needed.
Update documentation and keep the software up to date with changes in
technology.
Diagram Illustrating the Program Development Life Cycle:
+-----------------+
| Requirement |
| Analysis |
+-----------------+
|
v
+-----------------+
| Design |
+-----------------+
|
v
+-----------------+
| Implementation|
+-----------------+
|
v
+-----------------+
| Testing |
+-----------------+
|
v
+-----------------+
| Documentation |
+-----------------+
|
v
+-----------------+
| Deployment |
+-----------------+
|
v
+-----------------+
| Maintenance |
+-----------------+
What is an Algorithm?
An algorithm is a step-by-step procedure or a set of rules designed to solve a
specific problem or perform a particular task. Algorithms serve as the
foundational building blocks of computer programming and computational
thinking. They provide a structured way to approach complex problems, breaking
them down into simpler, manageable steps that a computer can execute.
Key characteristics of algorithms include:
Well-Defined Inputs and Outputs: Algorithms take inputs (data) and produce
outputs (results) based on the defined steps. The inputs and outputs should be
clearly specified.
Finiteness: An algorithm must have a clear and definite stopping point. It should
eventually complete its execution and provide a result.
Definiteness: Each step of the algorithm must be precisely defined and
unambiguous, leaving no room for interpretation.
Effective Computability: Algorithms should be executable using basic operations
and actions that a computer can perform, such as arithmetic calculations,
comparisons, and data manipulations.
Generality: Algorithms should be designed to solve a class of problems, not just
specific instances.
Feasibility: Algorithms should be practical and feasible to implement within the
resources available, such as time and memory.
Discuss Flowcharts and Their Notations.
Flowcharts are graphical representations used to illustrate the step-by-step
progression of a process, algorithm, or system. They use standardized symbols
and conventions to depict different actions, decisions, inputs, and outputs within
the flow of the process. Here are some common symbols and notations used in
flowcharts:

1. Start/End Symbol:
Represents the beginning or end of the process.
Usually depicted as an oval or rounded rectangle.
2. Process Symbol:
Represents a specific action or task in the process.
Usually depicted as a rectangle with rounded corners.
3. Decision Symbol:
Represents a decision point where a choice needs to be made.
Usually depicted as a diamond shape.
Typically labeled with a question or condition.
4. Input/Output Symbol:
Represents an input or output operation.
Usually depicted as a parallelogram.
5. Connector Symbol:
Indicates a point where multiple flowchart segments connect.
Helps to avoid clutter and improve readability.
6. Flow Arrows:
Show the direction of flow from one step to another.
Arrows connect the symbols to indicate the order of execution.
7. Process Connection:
Used to connect different parts of the process when they are on different pages
or areas of the flowchart.
8. Off-Page Connector:
Indicates that the flow continues on a different page or section of the flowchart.
9. Loop/Preparation Symbol:
Represents a loop or repetition in the process.
Usually depicted as a curved arrow returning to a previous step.
10. Delay Symbol: - Represents a waiting period or delay in the process. - Often
depicted as a cylinder.
11. Annotation/Comment: - Provides additional information or comments
about a specific step in the process. - Usually depicted as a rectangle with
dashed lines.
12. Terminator Symbol: - Represents an abrupt termination or error condition
in the process. - Depicted as a rectangle with diagonally opposite corners
missing.
13. Data Storage/Database Symbol: - Represents the storage of data,
information, or records. - Often depicted as a cylinder or rectangle with a corner
folded.
14. Document Symbol: - Represents a printed document or report in the
process. - Often depicted as a rectangle with a wavy bottom edge.

These notations and symbols form the basis of flowcharting, enabling clear and
standardized communication of processes and algorithms. Flowcharts are widely
used in various fields, including software development, engineering, business
process modeling, and education, to visually represent complex workflows and
concepts.

Multiple Programming Languages & Their Features: Programmers write


instructions in various programming languages to perform their computation.
tasks such as:
(i) Machine level Language
(ii) Assembly level Language
(iii) High level Language
Machine level Language :
Machine code or machine language is a set of instructions executed directly by a
computer's central
processing unit (CPU). Each instruction performs a very specific task, such as a
load, a jump, or an
ALU operation on a unit of data in a CPU register or memory. Every program
directly executed by a
CPU is made up of a series of such instructions.
Assembly level Language :
An assembly language (or assembler language) is a low-level programming
language for a computer,
or other programmable device, in which there is a very strong (generally one-to-
one) correspondence
between the language and the architecture's machine code instructions.
Assembly language is
converted into executable machine code by a utility program referred to as an
assembler; the
conversion process is referred to as assembly or assembling the code.
High level Language:
High-level language is any programming language that enables development of
a program in much simpler programming context and is generally independent of
the computer's hardware architecture.
High-level language has a higher level of abstraction from the computer and
focuses more on the programming logic rather than the underlying hardware
components such as memory addressing and register utilization.
The first high-level programming languages were designed in the 1950s. Now
there are dozens of
different languages, including Ada, Algol, BASIC, COBOL, C, C++, JAVA, FORTRAN,
LISP,
Pascal, and Prolog. Such languages are considered high-level because they are
closer to human
languages and farther from machine languages. In contrast, assembly languages
are considered low-level because they are very close to machine languages.
The high-level programming languages are broadly categorized in to two
categories:
(i) Procedure oriented programming (POP) language.
(ii) Object oriented programming (OOP) language.
Procedure Oriented Programming Language
In the procedure-oriented approach, the problem is viewed as sequence of things
to be done such as reading, calculation and printing.
Procedure oriented programming basically consist of writing a list of instruction
or actions for the computer to follow and organizing this instruction into groups
known as functions. Main Function

Function-1
Function-2 Function-3

The disadvantage of the procedure-oriented programming languages is.


1. Global data access
2. It does not model real word problem very well
3. No data hiding
Characteristics of procedure-oriented programming:
1. Emphasis is on doing things(algorithm)
2. Large programs are divided into smaller programs known as functions.
3. Most of the functions share global data
4. Data move openly around the system from function to function
5. Function transforms data from one form to another.
6. Employs top-down approach in program design
BASIC CONCEPTS OF OBJECTS ORIENTED PROGRAMMING
1. Objects
2. Classes
3. Data abstraction and encapsulation
4. Inheritance
5. Polymorphism
6. Dynamic binding
7. Message passing
OBJECTS
Objects are the basic run-time entities in an object-oriented system. They may
represent a person, a
place, a bank account, a table of data or any item that the program must handle.
The fundamental idea behind object oriented approach is to combine both data
and function
into a single unit and these units are called objects.
The term objects means a combination of data and program that represent some
real word
entity. For example: consider an example named Amit; Amit is 25 years old and
his salary is 2500.
The Amit may be represented in a computer program as an object. The data part
of the object would
be (name: Amit, age: 25, salary: 2500)
The program part of the object may be collection of programs (retrive of data,
change age,
change of salary). In general even any user –defined type-such as employee may
be used. In the
Amit object the name, age and salary are called attributes of the object.
Object: Student STUDENT
DATA Total
Name
Date-of-birth
Marks Average
FUNCTIONS
Total
Average Display
Display
CLASS:
A group of objects that share common properties for data part and some
program part are
collectively called as class.
In C ++ a class is a new data type that contains member variables and member
functions that
operate on the variables.
DATA ABSTRACTION:
Abstraction refers to the act of representing essential features without including
the back
ground details or explanations. Classes use the concept of abstraction and are
defined as size, width and cost and functions to operate on the attributes.
DATA ENCAPSALATION:
The wrapping up of data and function into a single unit (called class) is known as
encapsulation. The data is not accessible to the outside world and only those
functions which are wrapped in the class can access it. These functions provide
the interface between the objects data and
the program.
INHERITENCE:
Inheritance is the process by which objects of one class acquire the properties of
another
class. In the concept of inheritance provides the idea of reusability. This mean
that we can add
additional features to an existing class without modifying it. This is possible by
designing a new class will have the combined features of both the classes.
POLYMORPHISIM:
Polymorphism means the ability to take more than one form. An operation may
exhibit different
instance. The behaviour depends upon the type of data used in the operation.
A language feature that allows a function or operator to be given more than one
definition. The types
of the arguments with which the function or operator is called determines which
definition will be used. Overloading may be operator overloading or function
overloading.
It can express the operation of addition by a single operator say ‘+’. When this is
possible you
use the expression x + y to denote the sum of x and y, for many different types
of x and y, integers, float and complex no. You can even define the + operation
for two strings to mean the concatenation
of the strings.
DYNAMIC BINDING:
Binding refers to the linking of a procedure call to the code to the executed in
response to the call. Dynamic binding means the code associated with a given
procedure call is not
known untill the time of the call at run-time. It is associated with a polymorphic
reference depends
upon the dynamic type of that reference.
MESSAGE PASSING :
An object oriented program consists of a set of objects that communicate with
each
other.
A message for an object is a request for execution of a procedure and therefore
will
invoke a function (procedure) in the receiving object that generates the desired
result. Message
passing involves specifying the name of the object, the name of the function
(message) and
information to be sent.

BENEFITS OF OOP:
Oop offers several benefits to both the program designer and the user. Object-
oriented contributes to
the solution of many problems associated with the development and quality of
software products.
The principal advantages are :
1. Through inheritance we can eliminate redundant code and extend the use of
existing
classes.
2. We can build programs from the standard working modules that communicate
with one
another, rather than having to start writing the code from scratch. This leads to
saving of
development time and higher productivity.
3. This principle of data hiding helps the programmer to build secure programs
that can’t be
invaded by code in other parts of the program.
4. It is possible to have multiple instances of an object to co-exist with out any
interference.
5. It is easy to partition the work in a project based on objects.
6. Object-oriented systems can be easily upgraded from small to large systems.
7. Message passing techniques for communication between objects makes the
interface
description with external systems much simpler.
8.Software complexity can be easily managed
APPLICATION OF OOP:
The most popular application of oops up to now, has been in the area of user
interface
design such as windows. There are hundreds of windowing systems developed
using oop
techniques.
Real business systems are often much more complex and contain many more
objects
with complicated attributes and methods. Oop is useful in this type of
applications because it
can simplify a complex problem. The promising areas for application of oop
includes.
1. Real – Time systems.
2. Simulation and modeling
3. Object oriented databases.
4. Hypertext,hypermedia and expertext.
5. Al and expert systems.
6. Neural networks and parallel programming.
7. Dicision support and office automation systems.
8. CIM / CAM / CAD system.

You might also like