Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Programming CONTENTS Introduction to Operating Systems Introduction to programming languages Introduction to perl programming language Programming.

Similar presentations


Presentation on theme: "Computer Programming CONTENTS Introduction to Operating Systems Introduction to programming languages Introduction to perl programming language Programming."— Presentation transcript:

1

2 Computer Programming

3 CONTENTS Introduction to Operating Systems Introduction to programming languages Introduction to perl programming language Programming skills in perl Perl applications in bioinformatics

4 Software Categories System SW – Programs written for computer systems Compilers, operating systems, … Application SW – Programs written for computer users Word-processors, spreadsheets, & other application packages

5 Operating system The set of software that controls the overall operation of a computer system, typically by performing such tasks as memory allocation, job scheduling, and input/output control Software designed to control the hardware of a specific data-processing system in order to allow users and application programs to make use of it.

6 OS Tasks The operating system's tasks, in the most general sense, fall into six categories: i.Processor management ii.Memory management iii.Device management iv.Storage management v.Application interface vi.User interface

7 Language The purpose of language is simply that it must convey meaning. (Confucius) That which can be said, can be said clearly. (Wittgenstein,1963) A program is a specification of a computation. A programming language is a notation for writing programs.(Sethi,89)

8 7 What is a programming language? A language that is intended for the expression of computer programs and that is capable of expressing any computer program.

9 What is Programming Program – a very specific set of instructions (or command lines) that making a computer do what you want it to do Programming – the process of creating a program – the development of a solution to an identified program, and setting up of a related series of instructions which, when directed through computer hardware, will produce the desired results

10 Differences or Similarities Natural Language – Grammar – Vocabulary – Sentences Programming Language – Syntax – Objects, data types – Commands

11 Steps in program development 1.Define the problem 2.Outline the solution(pseudocode) 3.Develop the outline into an algorithm 4.Test the algorithm for correctness 5.Code the algorithm into a specific programming language 6.Run the program on the computer 7.Document and maintain the program

12 Define the Problem Divide the problem into three components (called IPO): – Inputs – what do you have? – Outputs – what do you want to have? – Processing how do you go from inputs to outputs? A defining diagram is recommended

13 Outline the Solution The major processing steps involved The major subtasks (if any) The major control structures (e.g. repetition loops) The major variables and record structures The mainline logic

14 Develop the Outline into an Algorithm Algorithm is a set of precise steps that describe exactly the tasks to be performed, and the order in which they are to be carried out Pseudocode (a form of structured English) is used to represent the solution algorithm

15 Test the Algorithm for Correctness The main purpose of desk checking the algorithm is to identify major logic errors early, so that they may be easily corrected Test data needs to be walked through each step in the algorithm, to check that the instructions described in the algorithm will actually do what they are supposed to

16 Code the Algorithm into a Specific Programming Language Only after all design considerations have been met should you actually start to code the program into your chosen programming language (e.g. Visual Basic, Java, C++)

17 Run the Program on the Computer This step uses a program compiler and programmer- designed test data to machine test the code for syntax errors Program complier translate high-level languages (e.g. VB) to low-level machine language before execution

18 Document and Maintain the Program Not the last step in the program development process An ongoing task from the initial definition of the problem to the final test result Involves both external documentation (such as hierarchy charts) and internal documentation that may have been coded in the program

19 How do Programming Languages Differ? Common Constructs: basic data types (numbers, etc.); variables; expressions; statements; keywords; control constructs; procedures; comments; errors... Uncommon Constructs: type declarations; special types (strings, arrays, matrices,...); sequential execution; concurrency constructs; packages/modules; objects; general functions; generics; modifiable state;...

20 Pseudocode vs Algorithm Pseudocode is a compact and informal high-level description of a computer programming algorithm that uses the structural conventions of some programming language, but is intended for human reading rather than machine reading. Algorithm Procedure that produces the answer to a question or the solution to a problem in a finite number of steps. In mathematics, computing, and related subjects, an algorithm is a sequence of finite instructions, often used for calculation and data processing. It is formally a type of effective method in which a list of well-defined instructions for completing a task will, when given an initial state, proceed through a well-defined series of successive states, eventually terminating in an end-state.

21 Problem 1  A program is required to read three numbers, add them together and print their total.

22 Defining diagram InputProcessingOutput Number1 Number2 Number3 Prompt for input numbers total Get input numbers Apply addition Display total

23 Solution Pseudocode Begin Program Get number1 Get number2 Get number3 Total = number1 + number2 + number3 Display total End Program

24 Problem 2 A program is required to prompt the terminal operator for the maximum and minimum temperature readings on a particular day, accept those readings as integers, and calculate and display to the screen the average temperature, calculated by (maximum temperature + minimum temperature)/2.

25 Defining diagram InputProcessingOutput Max_temp Min_temp Prompt for temperatures Get temperatures Calculate average temperature Display average temperature Avg_temp

26 Solution Pseudocode Begin program Get max_temp, min_temp Avg_temp= (max_Temp + min_temp)/2 Output avg_temp to the screen End Program

27 Problem 3 Calculate the circumference and area of a circle

28 Defining diagram InputProcessingOutput Radius pi Get radius, pi Calculate circumference = 2 * P I* radius Calculatearea=PI * radius ^ 2 Display circumference, area Circumfere nce area

29 Solution Pseudocode Begin program get radius, PI circumference = 2 * P I* radius area=PI * radius * radius display circumference, area End program

30 29 Attributes of a good language 1.Clarity, simplicity, and unity – Have a minimum number of different concepts, with the rules for their combination, simple and regular (conceptual integrity). – readability 2.Orthogonality – Being able to combine various features of a language in all possible combinations. 3.Support for abstraction

31 30 Attributes of a good language 4. Ease of program verification – Proof of correctness, desk checking, test – Simplicity of semantic and syntax 5. Programming environment 6. Portability of programs 7. Cost of use – Program execution – Program translation – Program creation, testing, and use – Program maintenance

32 Jazayeri31 Attributes of a good language (another view: to make a software reliable, maintainable, efficient) Reliability – Writability – Readability – Simplicity – Safety (no goto, no pointers) – Robustness (undesired events can be trapped, like arithmetic overflow, invalid inputs) Maintainability – Factoring (modularity) – Locality Efficiency

33 Can you answer these questions? What is an OS? PL? Pseudocode vs Algorithm? Steps involved in programming? Attributes of good PL? How do PL differ? Write pseudocode for a given problem?

34 Assignment Uses of internet as biologists Single page


Download ppt "Computer Programming CONTENTS Introduction to Operating Systems Introduction to programming languages Introduction to perl programming language Programming."

Similar presentations


Ads by Google