Programming Part 1
Programming Part 1
Programming Part 1
• ADD 210(8,13),02B(4,7)
• PACK 218(8,13),02F(4,7)
• MP 212(6,13),21D(3,13)
ADVANTAGES OF LOW LEVEL LANGUAGE:
10010101001010001010100
Object Code 10101010100011101111011
(machine language)) 10110111100011100101011
PROGRAM-ORIENTED LANGUAGE:
• Unlike general purpose languages, problem-oriented
languages are designed to solve specific problems. While
3rd GLs focus on procedures and how a program will
accomplish a specific task, 4th GLs are non-procedural
and focus on specifying what the program is to
accomplish.
• 4th GLs are more English-like, easier to program, and
widely used by non-programmers . Some of these
4thGLs, are used for very specific applications. 4th GLs
includes query languages e.g. SQL and application
generators eg Visual Basic
NATURAL PROGRAMMING LANGUAGES (5
GL) :
• The standard definition of a 5th GL is a computer
language that incorporates the concepts of artificial
intelligence to allow direct human communication.
Examples are PROLOG, LISP etc.
• Additionally, these languages would enable a computer
to run and to apply new information as people do.
ADVANTAGES OF HIGH LEVEL
LANGUAGES:
• English-like phrasing of high level languages makes them
easy to understand.
• High level languages are portable i.e They are
transferable from one computer to another.
• They are user-friendly and easy to use and learn.
• They are more flexible, hence they enhance creativity of
the programmer and increase productivity in the work
place.
• High level languages are far much more easy to debug.
DISADVANTAGES OF HIGH LEVEL
LANGUAGES:
• Their nature encourages loading of instructions in a word
or statement hence the complexity of these instructions
cause slower program processing.
• They have to be interpreted or compiled for translation to
machine language before the computer can trace them.
PROGRAMMING FUNDAMENTALS :
Only about 100 instructions that the computer
understands - Different programs will just use these
instructions in different orders and combinations.
The most valuable part of learning to program is
learning how to think about arranging the sequence of
instructions to solve the problem or carry out the task
PROGRAMMING FUNDAMENTALS:
PUTTING THE INSTRUCTIONS
TOGETHER
• Sequential Processing
• A List of Instructions
• Conditional Execution
• Ifs
• Repetition
• Looping / Repeating
• Stepwise Refinement / Top-Down Design
• Breaking Things into Smaller Pieces
• Calling Methods / Functions / Procedures / Subroutines
• Calling a segment of code located elsewhere
• Reuse of previously coded code segment
METHODS OF PROGRAMMING:
• Procedural
• Defining set of steps to transform inputs into outputs
• Translating steps into code
• Constructed as a set of procedures
• Each procedure is a set of instructions
METHODS OF PROGRAMMING:
• Object-Oriented
• Defining/utilizing objects to represent real-world
entities that work together to solve problem
• Basic O-O Programming Components
• Class
• Object/Instance
• Properties
• Methods
PROBLEM SOLVING:
The process of defining a problem, searching for
relevant information and resources about the problem,
and of discovering, designing, and evaluating the
solutions for further opportunities. Includes:
Finding an Answer to a Question
Figuring out how to Perform a Task
Figure out how to Make Things Work
PROBLEM SOLVING:
Not enough to know a particular programming
language… Must be able to problem solve…
Very desirable to be a good Problem Solver in any CIS
discipline.
POLYA’S 4 STEPS OF PROBLEM SOLVING:
• U – Understand the Problem
• D – Devise a Good Plan to Solve
• I – Implement the Plan
• E – Evaluate the Solution
UNDERSTAND THE PROBLEM :
• What is the Problem to be solved? What is the unknown?
What is the condition? What is the data? What is needed
to solve the problem? What actions need to take place?
• Identify the inputs and outputs
• Identify the processes needed to produce the outputs
from the given inputs
• Draw a figure. Introduce suitable notation.
• Isolate Principle parts of the problem.
DEVISE A PLAN :
• Find connections between the knowns and unknowns.
• Simplify: Break the problem into smaller sub-problems
• Design a solution
• Make a plan or list of actions to implement the solution
• Algorithm / Flowchart / Psuedocode
DEVISE A PLAN :
• Algorithm
• A FINITE set of clear, executable steps that will
eventually terminate to produce the desired outcome
• Logical design used to solve problems – usually a list
of actions required to perform task
DEVISE A PLAN :
• Pseudocode
• Written like program code but more “English Like”
and doesn’t have to conform to language syntax
• Flowchart
• Diagram that visually represents the steps to be
performed to arrive at solution.
IMPLEMENT THE PLAN :
• Implement in a Programming Language
• Carry out the plan checking the preliminary results at
each step.
• Code A Little Test A lot
EVALUATE THE SOLUTION :
• Run the Code
• Check results repeatedly and thoroughly
• Use numerous test cases or data sets
• Use highly varied test case, including expected as well
as and unexpected cases
• Look for new solutions
• Is there a better, easier, or more efficient solution
• Can other problems be solved using these techniques?
REFERENCES:
• Introduction to Programming - Mr. G. Mariga
• Computer Programming 1 -
https://www.scribd.com/document_downloads/direct/378715003?
extension=pptx&ft=1599234095<=1599237705&user_id=389262235&ua
hk=HRswl7YFfm7Ly4PjhbrD8X5B8fU
• Introduction to Programming - Debra Chapman
• A Beginner's Introduction to Computer Programming - Francis Glassborow
& Roberta Allen