Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 20

What makes a good programming language for bioinformatics education?

Greg Slodkowicz Chris Workman group Center for Biological Sequence Analysis

Overview Language usage trends Practical language comparison Perl design Bioinformatics library comparison

Programming language trends

Programming language trends


2001 1. Java 2. C 3. C++ 4. (Visual) Basic 5. Perl 6. PHP 7. Python 8. C# 9. (Objective C) 10. (Lua) 2011 1. Java 2. C 3. C++ 4. C# 5. PHP 6. (Visual) Basic 7. Objective C 8. Python 9. Perl 10. Lua

Overview Language usage trends Practical language comparison Perl design Bioinformatics library comparison

Comparing programming languages


Religious aspect (holy language wars) Few hard facts, folk wisdom/software engineering practice instead Difficult to compare across universities (different student intake etc.) Personal preference

How to compare languages?


Make an army of clones, teach them programming, do statistics

Software engineering perspective Effort (/time) to solve a problem is proportional to the number of lines needed for the solution [1] The number of bugs per line of code is constant regardless of the language used [2]

[1] F Brooks 1995 [2] L Hatton 1995

Languages in the comparison

Language Perl Python Java C C++

Paradigm Mixed Mixed OO Procedural OO

Execution model Interpreted Interpreted VM Compiled Compiled

Practical comparison
We compare several small problems implemented in each language: dna2prot Translate DNA to amino acid sequence fasta* Generate and write random DNA sequences reverse-complement* Read DNA sequences and write their reverse-complement k-nucleotide* Repeatedly update hashtables and k-nucleotide strings regex-dna* Match DNA 8-mers and substitute nucleotides for IUB code

*From the Programming Language Benchmark Game

Code lengths compared

Overview Language usage trends Practical language comparison Perl design Bioinformatics library comparison

Unix legacy
Perl
$str =~ /xxx$/ $str !~ /xxx$/ `cmd` s/xxx/yyy/ tr/abc/xyz/ <FILE>

Python
str.endswith(xxx) not str.endswith(xxx) os.system(cmd)

Java
str.endsWith(xxx) !str.endsWith(xxx) Runtime.exec(cmd)

str.replace(xxx, yyy) str.replace(xxx, yyy) str.translate(trantab) file f str.translate(xxx, yyy) File f

Many more syntactic structures in Perl Things happen by magic

Perl special variables

Perl philosophy

() Perl is chock-full of exceptions to its rules. This is a good thing, as real life is chock-full of exceptions to rules.

Schwartz et al., Learning Perl, OReilly

Overview Language usage trends Practical language comparison Perl design Bioinformatics library comparison

Bio* main projects BioPerl BioPython BioJava BioRuby

Bio* commit activity


Total # of commits Activity by year

Summary Changing landscape of programming practice Scripting languages are more suited for teaching bioinformatics New languages emerge and can make teaching bioinformatics easier There are more and more viable bioinformatics libraries

Questions?

Acknowledgements Chris Workman Peter Wad Sackett Nils Weinhold

You might also like