Sie sind auf Seite 1von 15

Perl Programming for

Bioinformatics

Dr.TomasKarpati2004

Introductiontoprogramming
ENIAC The world's first electronic digital computer was developed by Army Ordnance to compute World War II ballistic firing tables. Dr.TomasKarpati2004

U.S. Army Photo

Introductiontoprogramming

First generation (ENIAC, 1945): programming by "cables" (machine language). Second generation (transistors, 1954): programming with "punch cards". Third generation (integrated circuits, 1958): programs saved on magnetic media. First programming languages (Fortrant in 1956, Cobol in 1959, Lisp in 1960. First operating systems multiprocessing). Dr.TomasKarpati2004

Introductiontoprogramming

U.S. Army Photo

Fourth generation (microprocessor, 1971): 1969 UNIX 1972 C 1981 MS-DOS 1987 Perl Dr.TomasKarpati2004

Introductiontoprogramming
Programming Languages classification Compiled C C++ Fortrant Cobol Pascal Java Interpreted (scripting) Lisp Basic Perl Python Tcl Ruby Dr.TomasKarpati2004

Introductiontoprogramming
Programming techniques

Low level: Machine code High level: Simple sequential programming Procedural Structured Object Oriented Dr.TomasKarpati2004

Introductiontoprogramming
Machine Code (Assembler)
+Direct access to the microprocessor code +Direct manipulation of memory allocation +Very fast - Tedious to program and not intuitive - Not easy to debug LD HL, 23653 - Prone to error
LD E, (HL) INC HL LD D, (HL) EX DE, HL

Dr.TomasKarpati2004

Introductiontoprogramming
Simple sequential programming +Easy to program +Usefull for short programs +Easy to debug - Does not scale efficiently
case "$1" in start) present if test -r /etc/isapnp.conf -a -x /sbin/isapnp ; then echo "Initializing PnP devices" /sbin/isapnp /etc/isapnp.conf rc_status -v1 -r fi ;;

Dr.TomasKarpati2004

Introductiontoprogramming
Procedural programming +Usefull for larger programs +Save time on writing repetitive code (subrutines) - Does not encapsulate (isolate) data
FOR N = 1 TO 10 IF N > 5 GOTO CHECK_N A=N*3 NEXT N ... CHECK_N: N = N N^2 RETURN

Dr.TomasKarpati2004

Introductiontoprogramming
Structured programming +Usefull for larger programs +Save time on writing repetitive code (functions) +Function data is isolated from the rest of the code +Functions programmed by others may be imported and used - Difficult to debug
Dr.TomasKarpati2004

Introductiontoprogramming
Structured programming
import check.lib ... for (n=0;n<10;n++) { if n > 5 { n = Check_n(n) } a= n*3 } ...

check.lib
function Check_n(x) { y = x x^2; return y; }

Dr.TomasKarpati2004

Introductiontoprogramming
Object Oriented Programming (OOP) +Usefull for very large projects. +A new paradigm in programming +Save time on writing repetitive code (Objects) +Use AbstractClasses (tempates) to describe objects. +Easier to debug
Dr.TomasKarpati2004

Introductiontoprogramming
Abstract Class
State (properties): Weight Height Age Gender Behavior (functions): Sleep Eat Drive Study

Human

Identity Name (or ID)

Dr.TomasKarpati2004

Introductiontoprogramming
Abstract Class
State (properties): Weight: 78 kg. Height: 1.74 m Age: 56 years Gender: male Behavior (functions): Study Identity David Peres

Human

Dr.TomasKarpati2004

Introductiontoprogramming
OOP Characteristics

Encapsulation: hide and protect data Polymorphism: each object may respond differently to a message, depending on the nature of the object. Inheritance: An object (child) derived from other object (parent) inherit the states and behaviors of his parent object. Dynamic binding: objects send messages to one another, without actually knowing their specific type. Dr.TomasKarpati2004

Das könnte Ihnen auch gefallen