Programming Fundamentals
Mithat Konar
with material from Capron's “Essentials of Computing”, 2/e
What is programming?
What programmers do
“Write programs”
Prepare the instructions of a computer program.
Test and correct programs.
Document the way a program works.
Interact with other programmers, systems analysts, clients.
Programming languages
Levels of language
Machine language
10110110100100101101011101001010
10110110110101101101011011000111
Lowest level of language.
Just 1’s and 0’s.
Very hard not to make a mistake.
Each type of computer processor has its own machine language.
Assembly language
MOV AL, 1h
MOV CL, 2h
MOV DL, 3h
High-level languages
if score > 60:
print('You passed!')
else:
print('Try harder!')
Very high-level languages
Natural language programming
Tries to let people program using everyday language.
“Show a list of names from the contact list,” same as “Display the names of everyone in the contact list.”
Kinds of translation
Kinds of errors
syntax error: you broke a language rule.
semantic or logic error: the program runs and doesn't complain, but it doesn't produce the desired result.
runtime error: you ask the program to do something it can't, like divide A by B when B happens to be zero.
Programming process
Define the problem.
Design a solution.
Code the solution.
Test the solution.
Document the solution.
Define the problem
Undefined problems cannot be solved.
May be formal or informal.
Sometimes simple, often not.
Design a solution
Design your solution before you try to build it!
80/20 rule: spend 80% of your time designing, 20% writing.
Code the solution
Test the solution
debugging: detecting, locating, and fixing mistakes.
desk checking: working through your code without running it to find mistakes.
Document the solution
code editor: used to write the program code (i.e., source code).
translator: used to translate source code into a form the computer can execute.
debugger: used to interactively run a program and observe its internal state.
project manager: used to organize source code and other files associated with a program.
IDE (integrated development environment): integrates a number of these tools into one unified environment to help increase productivity.
Fin
<html>
<script>
var uls = document.getElementsByTagName('ul');
for(var i=0,j=uls.length;i<j;++i){uls[i].setAttribute('class','incremental')}
</script>
</html>