1 / 33

Computer Programming

Computer Programming. CONTENTS. Introduction to Operating Systems Introduction to programming languages Introduction to perl programming language Programming skills in perl Perl applications in bioinformatics. Software Categories. System SW Programs written for computer systems

vivien
Download Presentation

Computer Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Programming

  2. CONTENTS • Introduction to Operating Systems • Introduction to programming languages • Introduction to perl programming language • Programming skills in perl • Perl applications in bioinformatics

  3. 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

  4. 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.

  5. OS Tasks The operating system's tasks, in the most general sense, fall into six categories: • Processor management • Memory management • Device management • Storage management • Application interface • User interface

  6. 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)

  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.

  8. 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

  9. Differences or Similarities • Natural Language • Grammar • Vocabulary • Sentences • Programming Language • Syntax • Objects, data types • Commands

  10. 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

  11. 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

  12. 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

  13. 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

  14. 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

  15. 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++)

  16. 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

  17. 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

  18. 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; ...

  19. Pseudocodevs 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.

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

  21. Defining diagram

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

  23. 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.

  24. Defining diagram

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

  26. Problem 3 • Calculate the circumference and area of a circle

  27. Defining diagram

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

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

  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

  31. 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 Jazayeri

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

  33. Assignment • Uses of internet as biologists • Single page

More Related