Title: BIL 106E Introduction to Programming in F General Course Related Information
1BIL 106E Introduction to Programming in
FGeneral Course Related Information Lecture
Notes
- Version 1.1
- Last Update Sep 9, 2005
2General Information
- BIL106E is an internet-assisted course.
- The official course website is at
www.be.itu.edu.tr Lisans Dersleri BIL106E - It is the students responsibility to check this
website to find out about announcements, homework
and midterm solutions and lecture notes. - There may be newer versions of lecture notes or
any other file that you see at the course
website, due to either a correction, or the
inclusion of a better explanation, or a new
example.
3General Information
- AGAIN, it is the students responsibility to
check if there are newer versions of the files
posted at the course website. - Note that all the files posted at the course
website will have a version number in their file
names, such as BIL_106_INTRO_SLIDE_v1.1.ppt or
BIL_106_INTRO_SLIDE_v1.1.zip. (Note that if a
file is compressed with WinZip its extension
changes to .zip. In order to uncompress it, you
need to download WinZip or WinRar from
www.download.com and install it in your computer.
This download is free of charge.) - If version 1.1 is what you have downloaded and
the next time you visit the course website, you
notice that there is a file with name
BIL_106_INTRO_SLIDE_v1.2.ppt, or .zip, you should
download version 1.2 and immediately delete
version 1.1. - This is known as VERSION CONTROL. It is your
foremost responsibility to do version control in
any computing project including keeping track of
lecture notes.
4General Information (contd)
- There are 3 sections and 3 instructors for this
course. - The two midterms and the final exam will be
common to all 3 sections. - Homeworks and quizzes will be different for each
section. - The letter grade will be based on a single bell
curve instead of 3.
5General Information (cont)
- Breakdown of the letter grade
- Final Exam 40
- 2 Midterms Each 20
- Labwork, Homeworks, Quizzes and In-class bonus
points 20 - The third item above will be determined
separately by each instructor. - The result will then be standardized using
3 separate curves from the 3 sections. - The standardized grade will then count as
20 towards your letter grade. - Each instructor is free to decide whether
or not to give in-class bonus points. - Since the results will be standardized at
the end, this will not be a setback for any - section.
-
6General Information (cont)
- Useful Websites
- http//www.foldoc.org
- (Free OnLine Dictionary of Computing)
- http//www.merriamwebster.com
- (English Dictionary Thesaurus)
-
- http//www.zargan.com
- (Turkish-English English-Turkish Dictionary)
7What is FORTRAN?
- Fortran "FORmula TRANslation" is the oldest
language still in general use, dating back to
1957, the year the Space Age began. It excels at
the first task computers were called on for
number-crunching. - This is the language that literally put a man on
the moon, and some of the features it developed
in the process of that project (and other less
glamorous ones) have yet to be duplicated in
other, more "modern" languages.
8What is F?
- F is a subset of FORTRAN.
- The F compiler was written by Walt Brainerd, one
of the authors of your textbook.
9Why teach a subset of FORTRAN and not a
full-fledged version of FORTRAN?
- F has all the necessary components of FORTRAN to
write efficient computer programs. - F is easier to learn and to teach.
10What is the most well-known version of FORTRAN?
- FORTRAN77, or F77, for short.
11What is the major difference between FORTRAN77
and FORTRAN90?
- F90 can be used for parallel programming whereas
F77 cannot. - Note that F is also amenable to parallel
computing, but this is beyond the scope of BIL106.
12What is the latest full-fledged version of
FORTRAN?
13Can we use pointers in F just like in C?
- Yes, you can.
- This is within the scope of BIL106 starting from
this semester.
14Is Object-Oriented Programming possible in
FORTRAN just like in C?
- Yes, there is a new book by Ed AKIN that explains
how to do that using FORTRAN95, but this is
beyond the scope of BIL106.
15What is a computer?
- Hardware
- Processor
- Memory
- I/O units (Input/Output Units)
- How does it work?
- Executes very simple instructions.
- Executes them incredibly fast.
- Must be programmed it is the software, i.e., the
programs, that characterize what a computer
actually does.
16Simplified architecture of a computer
17What is a computer program?
- The computer program characterizes what a
computer actually does. - A program (independently of the language in which
it is written) is constituted by two fundamental
parts - A representation of the information (data)
relative to the domain of interest. - A description of how to manipulate the
representation in such a way as to realize the
desired functionality operations. - To write a program both aspects have to be
addressed.
18A recipe that combines operations is an
Algorithm
- We need a recipe (just like the ones in a
cookbook) that combines certain operations in
order to solve a specific problem. - Example given a person name, find the
corresponding telephone number in a telephone
registry. - To delegate to a computer the solution of a
problem, it is necessary to find an algorithm
that solves the problem.
19Algorithms
- An algorithm is a recipe through which we obtain
the solution of a problem. In other words, a
sequence of instructions that, when executed in
sequence, allow one to calculate the solution of
the problem starting from the information
provided as input. - An algorithm is characterized by
- non ambiguity the instructions must be
interpretable in a unique way by whom is
executing them - executability it must be possible to execute
each instruction (in a finite amount of time)
given the available resources - finiteness the execution of the algorithm must
terminate in a finite amount of time for each
possible set of input data
20Example of an Algorithm for the Previously Given
Problem
- Scan the person names, one after the other as
they appear in the registry until you have found
the requested one then return the associated
telephone number. - Are there other algorithms to solve a given
problem? - Yes!
21Exercise
- Write an algorithm for a stupid robot so that it
can light - gas stove (ocak).
- Here is how you could start writing the
algorithm - Find a box of matches.
- Stand in front of the gas stove.
- Turn the dial of the stove so that gas starts to
come out. - Take out a match from the box.
- Try to light the match.
- If not lit go to step 4.
- If lit
- You may want to modify this algorithm a little
bit. )
22What next?
- Once we have found/developed an algorithm, we
have to code it in the selected programming
language.
23The edit-compile-verify cycle
24Is reaching the end in the previous flowchart
enough?
- No, because you may have programmed an incorrect
algorithm that produced a result without giving a
compiler error or a run-time error. - For instance you might compute the age of the
universe using a rough algorithm and find 42 as
the result. - Obviously, the result is incorrect due to a
logical error, which can either be an
implementation error, or an algorithmic error,
which is much worse than a simple implementation
error.
25Logical Errors are either Implementation Errors,
or Algorithmic Errors, or both
- How does one discover logical errors in a
computer program? - You need to test your program using test
problems. These test problems should start from
very simple problems and go towards more
difficult problems. You can never be 100 sure
that a program does not have any logical errors
until you, or the user discovers it while using
the program. The more testing you do, the more
likely that your code does not have any logical
errors in it. - If you discover a logical error, you have to
write a correct implemention of the algorithm
that you used. - If this does not work either, you have to find a
better algorithm and implement that algorithm
without any implementation errors.