Making communications land - Are they received and understood as intended? we...
Program concep sequential statements
1. Program Concept
Program is a group of sequential statements; which are executing line by line. It specifies
the programming task and module of the program. It wills easy the effort of the program and
helps to achieve the goal of user. So in another word we can say, “Program is a group of
statement or instruction which are executing line by line by compiler or interpreter to get the goal
of programs.”
The software should be designed effectively so as to meet its objective of user
satisfaction. Lawrence Peter has stated “Software design technology is a system not a secret.”
According to Sethi89, “Language must help us write a good programs, where a program
is a good if it is easy to read, easy to understand, and easy to modify.”
Therefore, we can say, “A programming language intended to be used by a person to
express a process by which a computer can solve a problem.”
4 key components of definition: -
A. Computer: - A machine that will carry out the process described by a program.
B. Person: - A person is a programmer who serves as the source of the communication.
C. Process ; - Process is the activity being described by the program.
D. Problem: - Problem is a actual system or environment where the problem arises.
Language to satisfy 4 components: -
A. Imperative: - It is geared towards easy machine translation.
B. Logical (Declarative): - It geared towards people and the logical thinking process.
C. Functional: - It focused on the function or operation being performed.
D. Object – Oriented: - It geared towards the problem domain.
Good programs will minimum the effort of the user. It will also reduce the effort of the
time efficiency and line of programming code. The concept of program will shows the quality of
the program, and quality of services.
Why study programming languages: -
i. Organize computations
ii. Different problems have different needs.
iii. Efficient Programming
iv. Language Providers
2. 1. Computation model
2. Data types and operation
3. Abstraction facilities
4. Checking and enforcement.
A good program will show the following characteristics: -
1. Good program will easily understand by programmer as well as new user.
2. Good program will easily describe the role of the every step.
3. Good program will not increase the length of the program. They will increase the
efficiency of the program.
4. Good program will decrease the line of code.
5. In good program functions are used.
6. Good program will hide the complexity of the program.
7. Good program will use array also as per programming requirement.
8. Good program will not bind the user.
9. The source code of program will well define.
10. The good program will easily modify in future.
11. The vocabulary of the language should resemble.
12. The language and its class or function library should be fully documented.
13. The logic of the program is easily so that in future it will easily modify as per
requirement.
14. The good program normally defined top to down or bottom to top approach.
15. The program should be portable.
16. A good program must have self-documenting code.
17. Good program must have user friendly.
18. Good programs are more reliable.
Stages of Program Development Process: -
3. 1. Creak the problem: - This is the first stage of programming development. In this stage the
problem is creaked and an algorithm is formulated which gives the solution for the
problem.
2. Code the algorithm: - In this stage, the algorithm is translated into a program. The
program is normally known as source code. This process is call coding.
3. Compile the program: - After feeding the program, next step is to compile it. Compilation
is a process to convert the source code into object code.
4. Execute the program: - After compilation of an error free program, the program is
executed. This phase is call run-time, the phase of program executing during which
program instruction are carried out.
A good programmer will define the program with efficient programming code and he will
define the program into three (3) types: -
1. Algorithm
2. Flow Charts
3. Source Code.
1. Algorithm: - In mathematics and computer science, an algorithm is a step-by-step
procedure for calculations. Algorithms are used for calculation, data processing and
automated reasoning. In short we cam saw that an algorithm is a suitable process to
execute the program step-by-step and it will follow the instruction given by user as well
as program. It will also show the efficient way and tell us “How to execute the program
perfectly. It will free the programming environment and it will easily convert into any
programming language.
Definition: -
1. “An algorithm is an effective method expressed as a finite list of well-defined
instructions for calculation a function.” Starting an initial state and initial input the
instruction describes a computation that, when executed, proceeds through a finite
number of well-defined successive states, eventually producing “output” and
4. terminating at a final ending state. The transition from one state to the next is not
necessarily deterministic; some algorithm, known as randomized algorithm,
incorporate random input.
2. An informal definition could be “a set of rules that precisely defines a sequence of
operation”, which would include all computer programs, including program that do
not perform numeric calculation. Generally, a program is only an algorithm if it stops
eventually.
3. An algorithm is precise instruction (in language understood by “the computer”) for a
fast, efficient, “good” process that specifies the “moves” of “the computer” (machine
or human, equipped with the necessary internally contained information and
capabilities to find decode, and then process arbitrary input integers/symbols m and n,
symbols + and = … and “effectively” produce, in a “reasonable” time, output-integer
y at a specified place and in specified format.
4. “Well ordered collection of unambiguous and effectively computable operation, that
when executed, produces a result and halts in a finite of time.”
Characteristics of an algorithm: -
1. Well Ordered: - The steps are in a clear order.
2. Unambiguous: - A computing agent without further simplification understands
the operations described.
3. Effectively Computable: - The computing agent can actually carry out the
operation.
Method for Developing an algorithm: -
1. Define the Problem: - State the problem you are trying to solve in clear and
concise terms.
2. List the Input: - Information needed to solve the Problem.
3. List the Output: - What the algorithm will produce as a result.
4. Describes the steps needed to convert or manipulate the inputs to produce the
output: - Start at a high level first, and keep refining the steps until them
effectively computable operation.
5. Test the algorithm: - Choose data sets and verify that your algorithm works!
The concept of algorithm is also used to define the notion of decidability. That
notation is central for explaining how format system comes into being starting from a
small set of axioms and rules. In logic, the time that an algorithm requires to complete
5. cannot be measured, as it is not apparently related with our customary physical
dimension. From such uncertainties, than characterize ongoing work, stems the
formalization.
Algorithm can be expressed in many kinds of notation, natural languages, pseudo
code, flowcharts, programming languages or control tables. Natural language expressions
of algorithm tend to be verbose and ambiguous, and are rarely used for complex or
technical algorithms.
Examples of Algorithm: -
1. The bus algorithm: -
i. Outside the railway station, catch bus number 1.
ii. Transfer to bus 6 near Gol building, Jalori Gate.
iii. Get off near GDMCMT.
iv. Walk two blocks east to my house.
2. Add two number: -
i. Take two number as input from user.
ii. Take third variable to store the result.
iii. Add two input variable and transfer the sum into third variable.
iv. Print third variable value at computer screen.
3. To find out simple interest: -
i. To determine the simple interest, we need three basic value such as principal,
rate and time. The value of these value provide by user or program.
ii. To process these variable we must know formula of Simple interest such as
Si= (principal * rate * time)/ 100.
iii. Si is the store variable and if we want to print total amount then we need
addition variable tot_amount = principal + Si.
iv. After calculating Si and tot_amount, print the result.
These algorithms clearly show that “Algorithm is a process to develop the good
program and it would free from any programming language.” In computer programming,
there are often many different algorithms to accomplish any given task. Each algorithm
6. has advantage and disadvantage in different situation. Sorting is one place where a lot of
research has been done, because computer spends a lot of time sorting list.
Algorithms also provide some addition feature such as -
1. Efficiency: - Efficient algorithm must be use to solve such problems considering
the time and cost factor involved in each algorithm.
2. Abstraction: - Algorithms provide a level of abstraction in solving problem
because many seemingly complicated problems can be distilled into simpler ones
for which well-known algorithm exist. Once we see a more complicated problem
in simpler light, we can thing of the simpler problem as just an abstraction of the
more complicated one.
3. Reusability: - Algorithms are often reusable in many different situations. Since
many well-known algorithm are the generalization s of more complicated ones,
and since many complicated problem can be distilled into simpler ones.
Advantage of Good Algorithm: -
1. Methods have been developed for the analysis of algorithms.
2. Different algorithms may complete the same task with a different set of instructions in
less or more time, space, or 'effort' than others.
3. The analysis and study of algorithms is a discipline of computer science, and is often
practiced abstractly without the use of a specific programming language or
implementation.
4. Algorithm analysis resembles other mathematical disciplines in that it focuses on the
underlying properties of the algorithm and not on the specifics of any particular
implementation.
5. Empirical testing is useful because it may uncover unexpected interactions that affect
performance.
6. An algorithm may be viewed as controlled logical deduction.
7. A good algorithm may provide a good programming approach.
8. Algorithm may provide time saving and improve to understand new programming
metrology.
9. Algorithm may also provide minimum effort to understand complex problem.
10. Algorithm may also use to solve new problem using different algorithm.
7. 11. Algorithms are not depending any programming language.
12. Algorithms are provide a scientific view to a new user.
Disadvantage of Algorithm: -
1. Algorithms not follow any programming language so it is difficult to write down.
2. In algorithm approach, no pre specified method will define.
3. Algorithms are complex to understand for new user.
4. For one problem, it provides set of solution, so it is difficult to choose correct
approach.
5. A good mathematical person may design a good algorithm and to easily understand.
6. Algorithms can execute one statement at a time so it will also follow top to down
approach.
7. Algorithms can be classified by the amount of time they need to complete compared
to their input size.
Real example of Algorithm: -
1. Write an algorithm to find the larger number among three number A, B and C.
1. Read the number A, B and C
2. If A>B then go to step 3 else go to step 4.
3. If A>C then go to step 5 else go to step 6.
4. If B>C then go to step 7 else go to step 6.
5. Print A is the largest and go to step 8.
6. Print C is the largest and go to step 8.
7. Print B is the largest and go to step 8.
8. Stop.