Chapter 1 BCP
Chapter 1 BCP
Programming
Chapter One
Problem Solving Using Computers
Course contents
• Computer fundamentals
• Generations of computers
• Types of computers
• The computer system
• Programming languages
• Generations of programming languages
• Problem solving methods
• Software crisis
• Software development life cycle
1. Computer fundamentals
Over view:
• A computer is a programmable machine with electronic and electromechanical parts.
• It is programmable and is capable of performing the following basic computing functions:
Accept data (input)
Process data
Generate output (information)
Store data/information
Retrieve/send data/information
Definition of computer
It is an electronic device that processes data based upon the instructions provided
and generates the desired output.
A computer is a machine that can be programmed to carry out sequences of
arithmetic or logical operations automatically. Modern computers can perform
generic sets of operations known as programs. These programs enable computers
to perform a wide range of tasks.
A computer system is a "complete" computer that includes the hardware,
operating system (main software), and peripheral equipment needed and used for
"full" operation. This term may also refer to a group of computers that are linked
and function together, such as a computer network or computer cluster.
2. Generations of computers
• Punch cards, paper tape, and magnetic tape was used as input and output
devices.
• The computers in this generation used machine code as the programming
language.
• Some computers of this generation were: ENIAC, EDVAC, UNIVAC, IBM-
701, IBM-650
The main features of the first generation are:
Vacuum tube technology Slow input and output devices
Unreliable Huge size
Supported machine language only Need of AC
Very costly Non-portable
Generated a lot of heat Consumed a lot of electricity
Second generation
• The period of second generation was from 1959-1965.
• In this generation, transistors were used that were cheaper, consumed less power, more
compact in size, more reliable and faster than the first generation machines made of vacuum
tubes.
• In this generation, magnetic cores were used as the primary memory and magnetic tape and
magnetic disks as secondary storage devices.
• Assembly language and high-level programming languages like FORTRAN, COBOL were
used.
• The computers used batch processing and multiprogramming operating system.
• Some computers of this generation were: IBM 1620, IBM 7094, CDC 1604, CDC 3600,
UNIVAC 1108.
Third generation
• The period of third generation was from 1965-1971.
• Third generation used Integrated Circuits (ICs) in place of transistors.
• A single IC has many transistors, resistors, and capacitors along with the
associated circuitry.
• High-level languages (FORTRAN-II TO IV, COBOL, PASCAL PL/1, BASIC,
ALGOL-68 etc.) were used during this generation.
• Some computers of this generation were: IBM-360 series, Honeywell-6000
series, PDP (Personal Data Processor), IBM-370/168, TDC-316.
Forth generation
• The period of fourth generation was from 1971-1980.
• Computers of fourth generation used Very Large Scale Integrated (VLSI) circuits. VLSI
circuits having about 5000 transistors and other circuit elements with their associated circuits
on a single chip made it possible to have microcomputers of fourth generation.
• Fourth generation computers became more powerful, compact, reliable, and affordable.
• As a result, it gave rise to Personal Computer (PC) revolution.
• In this generation, time sharing, real time networks, distributed operating system were used.
• All the high-level languages like C, C++, DBASE etc., were used in this generation.
• Some computers of this generation were: DEC 10, STAR 1000, PDP 11, CRAY-1(Super
Computer), CRAY-X-MP(Super Computer).
Fifth generation
• The period of fifth generation is 1980-till date. I
• The fifth generation uses ULSI (Ultra Large Scale Integration) technology,
• This generation is based on parallel processing hardware and AI (Artificial Intelligence)
software.
• AI is an emerging branch in computer science, which interprets the means and method of
making computers think like human beings.
• All the high-level languages like C and C++, Java, .Net etc., are used in this generation.
• Some computer types of this generation are: Desktop, Laptop, NoteBook, UltraBook,
ChromeBook.
3. Types of Computers
Personal computer
• hardware, and
• software.
Computer Hardware:
• The physical devices that carry out the activities of:
• capturing,
• processing,
• storing, and
• communicating data and information.
• It is composed of a number of interacting physical parts based on the need of the information
flow.
• Based on the data and information processing function; the hardware part of a computer fall in
to five categories:
• Input devices,
• Processor,
• Memories,
• Output devices and
• Storage devices.
Computer software
• Computer software comprises a set of machine-readable instructions that
directs a computer’s processor to perform specific operations.
• Computer software can be divided into the following types:
System software
Application software
Programming tools and language translators
Basic organization of a computer system
5. Programming languages
• What is programming?
• Programming is a skill that can be acquired by a computer
professional that gives him/her the knowledge of making the
computer perform the required operation or task.
• Why do we need to learn computer programming?
• Most users of a computer only use the available applications on the
computer.
• These applications are produced by computer programmers.
• Thus if someone is interested to make such kind of applications,
he/she needs to learn how to talk to the computer, which is learning
computer programming.
• Programming Language?
• A programming language is a set of rules that provides a way of
telling a computer what operations to perform.
• A programming language is a set of rules for communicating an
algorithm Medium of communication between computer and the user
containing words, symbols and syntax rules Each language has its
own vocabulary and rules.
• A set of instructions written in any specific language ( C, C++, Java,
Python) to perform a specific task.
• Programming Language is a set different category of written
symbols that instruct computer hardware to perform specified
operations required by the designer.
•What skills do we need to be a programmer?
Programming Language Skill: knowing one or more programming language to
talk to the computer and instruct the machine to perform a task.
Problem Solving Skill: skills on how to solve real world problem and represent
the solution in understandable format.
Algorithm Development skill: skill of coming up with sequence of simple
and human understandable set of instructions showing the step of solving
the problem. Those set of steps should not be dependent on any
programming language or machine.
• These set of rules determine how the programmer can make the computer
hardware to perform a specific operation. These sets of rules are called syntax.
Generations of Programming Language
• The concept of language generations is closely connected to the
advances in technology that brought about computer generations.
• Programming languages are categorized into five generations: (1st,
2nd, 3rd, 4th and 5th generation languages).
• From the five categories of programming languages, first and
second generation languages are low level languages and the rest
are high level programming languages.
• The higher the level of a language, the easier it is to understand and
use by programmers.
• Languages after the fourth generation are referred to as a very high
level languages.
Generations of Programming Language
• Programming languages are categorized into five
generations: (1st, 2nd, 3rd, 4th and 5th generation
languages).
• From the five categories of programming languages,
first and second generation languages are low level
languages and the rest are high level programming
languages.
• The higher the level of a language, the easier it is to
understand and use by programmers. Languages after
the fourth generation are referred to as a very high level
languages.
Generations of Programming Language
• First Generation (Machine languages, 1940’s):
• Difficult to write applications with.
• Dependent on machine languages of the specific computer
being used.
• Machine languages allow the programmer to interact directly
with the hardware, and it can be executed by the computer
without the need for a translator.
• Is more powerful in utilizing resources of the computer.
• Gives power to the programmer.
• They execute very quickly and use memory very efficiently.
• Second Generation (Assembly languages, early 1950’s):
• Uses symbolic names for operations and storage
locations.
• A system program called an assembler translates a
program written in assembly language to machine
language.
• Programs written in assembly language are not
portable. i.e., different
• Computer architectures have their own
machine and assembly languages.
• They are highly used in system software
development.
• Third Generation (High level languages, 1950’s to 1970’s):
• Uses English like instructions and mathematicians were
able to define variables with statements such as Z = A +
B
• Such languages are much easier to use than assembly
language.
• Programs written in high level languages need to
be translated into machine language in order to be
executed.
• The use of common words (reserved words) within
instructions makes them easier to learn.
• All third generation programming languages are
procedural languages.
• In procedural languages, the programmer is expected
to specify what is required and how to perform it.
• Fourth Generation (since late 1970’s):
• Have a simple, English like syntax rules; commonly used to
access databases.
• Fourth generation languages are non-procedural languages.
• The non-procedural method is easier to write, but you have less control
over how each task is actually performed.
• In non-procedural languages the programmer is not required to write
traditional programming logic.
• Programmers concentrate on defining the input and output rather than
the program steps required.
• For example, a command, such as LIST, might display all the records in a file
on screen, separating fields with a blank space.
• In a procedural language, all the logic for inputting each record, testing for
end of file and formatting each column on screen has to be explicitly
programmed.
• Fourth generation languages have a minimum number of syntax
rules.
• This saves time and free professional programmers for more
complex tasks.
• Some examples of 4GL are structured query languages (SQL),
report generators, application generators and graphics languages.
• Fifth Generation (1990’s):
• These are used in artificial intelligence (AI)
and expert systems; also used for accessing
databases.
• 5GLs are “natural” languages whose
instruction closely resembles human speech.
For example, “get me Jone Brown’s sales
figure for the 1997 financial year”.
• 5GLs require very powerful hardware and
software because of the complexity involved
in interpreting commands in human language.
Programming Language types
• Machine Language (Low-level language)
• It is the only language understood by the computer
without using a translation program.
• It can be written in Binary values 0’s and 1’s.
• Advantages:
• This program can be executed very fast by the computer
• No translation is required
• Disadvantages:
• Machine Dependent
• Difficult to Program
• Error Prone
• Difficult to Modify
Assembly Language
• A language which allows locations to be represented
by letters, symbols / mnemonics, instead of numbers, is
called an Assembly Language (or) Symbolic Language.
• . Ex: Statements are like, ADD, SUB, MUL, DIV, HLT.
• Advantages:
• Easier to understand and use.
• Easy to correct errors.
• Easier to modify.
• More efficient than machine language.
• Disadvantages:
• Machine dependent.
• Knowledge of hardware is required.
• Machine level coding.
High-Level Language
• The programs written in alphabets, number and some special
characters are also known as High-Level Language Programs. It
has several examples: BASIC, FORTRAN, PASCAL, C, C++, and etc.
• Advantages:
• Machine Independence.
• Easier to Learn and use.
• Fewer errors.
• Lower program preparation cost.
• Better documentation.
• Easier to maintain.
• Disadvantages:
• Lower efficiency.
• Execution time is more.
• It need translator to execute.
• Less flexibility.
Problem Solving Methods
• A problem is an undesirable situation that prevents the
organization from fully achieving its purpose, goals and
objectives.
• Or problem can also be defined as the gap between the
existing and the desired situation where problem
solving will try to fill this gap.
• Problem Solving:
• It is the process of transforming the description of a problem
into the solution by using our knowledge of the problem
domain and by relying on our ability to select and use
appropriate problem-solving strategies, techniques, and
tools.
Problem Solving Methods
• There are two approaches of problem solving:
• Top down design:
• is a systematic approach based on the concept that the
structure of the problem should determine the structure of
the solution and what should be done in lower level.
• This approach will try to disintegrate a larger problem into
more smaller and manageable problems to narrow the
problem domain.
• Bottom up design:
• is the reverse process where the lowest level component are
built first and the system builds up from the bottom until
the whole process is finally completed.
Basic Program development tips:
• The program we design in any programming language
need to be:
• Reliable:
• the program should always do what it is expected to do and
handle all types of exception.
• Maintainable:
• the program should be in a way that it could be
modified and upgraded when the need arises.
• Portable:
• It needs to be possible to adapt the software written for one
type of computer to another with minimum modification.
• Efficient:
• the program should be designed to make optimal use of time,
space and other resources of the computer.
Algorithm designing and modeling
the logic (using flow chart)
• A digital computer is a useful tool for solving a great
variety of problems.
• A solution to a problem is called an algorithm;
• it describes the sequence of steps to be performed for the
problem to be solved.
• Generally, an algorithm is a finite set of well-defined
instructions for accomplishing some task which, given an
initial state, will terminate in a corresponding recognizable
end-state.
• The algorithm should be:
• Precise and unambiguous
• Simple
• Correct
• Efficient
Modeling a programs logic using flow chart:
• Algorithm could be designed using many techniques
and tools. One tool of designing algorithm is by using
flowcharts.
• Flowchart is a graphical way of expressing the steps
needed to solve a problem.
• A flow chart is a schematic (diagrammatic description)
representation of a process.
Basic flowcharting symbols are:
Example:
• A flow chart that depicts weather a number is even or odd.
Software Crisis
• Developments in software technology continue to be
dynamic.
• These rapid advances appear to have created a situation
of crisis within the industry. The following issued need
to be addressed to face the crisis:
• How to represent real-life entities of problems in system
design?
• How to design system with open interfaces?
• How to ensure reusability and extensibility of modules?
• How to develop modules that are tolerant of any changes in
future?
• How to improve software productivity and decrease software
cost?
• How to improve the quality of software?
• How to manage time schedules?
Software Development Life Cycle
Software Development Life Cycle
• Brainstorming and planning
• Brainstorming – the first step of the software development process. It all starts with
a great idea. But any idea needs to be carefully thought over in order to be
implemented.
• Meticulous planning is the initial and one of the core phases of software
development or product development as it presupposes determining the scope of
the project, defining means and ways for the new system to meet business strategic
objectives, resource availability, cost-related issues, timeframes and determining
solutions.
• Requirements and feasibility analysis
• During this phase of software development process, the project is defined in details
and the analysis of the project’s feasibility is carried out.
• In order to build an actionable solution, clean code and catchy design are not
enough, you first need for the development team to get a deeper understanding of
the project goal and collect all the requirements.
Software Development Life Cycle
• Design
• Software design is a preeminent component of product development cycle.
• During the design phase, the actual conceptualizing of the solution is created,
that is the detailed software architecture meeting specific
project requirements is created.
• During this phase, the whole structure of the project is built with the final
prototype and mockups used for the next stages of the software development
process.
• Development & coding
• The development phase is about writing code and converting design
documentation into the actual software within the software development
process.
• This stage of software development cycle is generally the longest as it’s the
backbone of the whole process and there are a number of vital things to pay
attention to.
Software Development Life Cycle
• Integration and testing
• Now that the software is built and completed the next phase involving system testing
and integration starts. Depending on the adopted testing processes it might vary. But
typically the QA engineers use a whole range of frameworks alongside continuous
integration executing unit tests, automation compilation, and testing.
• Implementation and deployment
• This is a stage when the actual installation of the crafted solution takes place. It’s done
step-by-step according to the implementation plan. The newly built and tested
application is moved to production including data and components transfer while
during the next releases only the specific changes will be deployed. Depending on the
complexity of the project it might be a straightforward release (if the project is simple)
or staggered released (in stages) in case of a more complex project. Now system
analysts and the end-users can actually see and try out the ready application.
Software Development Life Cycle
• Operations and maintenance
• The final stage of software development lifecycle includes
maintenance and regular updates. The phase is treated with the
utmost attention since during the stage the product is polished,
upgraded, enhanced and fine-tuned according to the real-world
feedbacks on its performance. That’s exactly a perfect timing to
robust the application’s functionalities to upgrade its
performance and modify according to the actual needs of the
end-user add new capabilities or meet additional user
requirements.
End!