28
Open Source Business Systems www.opusvl.com Software Development with Open Source Jon Allen (JJ) – [email protected] Birmingham University 2010 Software Development with Open Source

Software Development with Open Source

  • Upload
    opusvl

  • View
    455

  • Download
    3

Embed Size (px)

DESCRIPTION

Presented to Birmingham University in 2010 as part of the Computer Science - Commercial Programming course.

Citation preview

Page 1: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Software Development with "Open Source

Jon Allen (JJ) – [email protected]

Birmingham University 2010

Software Development with Open Source

Page 2: Software Development with Open Source

Open Source Business Systems www.opusvl.com

About OpusVL

•  Open Source development company •  Based in Rugby, UK

•  Founded in 2000 •  Business systems (ERP, VOIP, CRM, etc) •  Bespoke software development •  Use and contribute to Open Source – Code –  Sponsorship

Software Development with Open Source

Page 3: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Open Source

•  Who uses Open Source software?

Software Development with Open Source

Page 4: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Open Source

•  Who uses Open Source software?

•  Who uses… – Google –  Facebook –  BBC iPlayer –  Amazon

Software Development with Open Source

Page 5: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Open Source

•  Who uses Open Source software?

•  Who uses… – Google –  Facebook –  BBC iPlayer –  Amazon

•  All built on Open Source software

Software Development with Open Source

Page 6: Software Development with Open Source

Open Source Business Systems www.opusvl.com

What is Open Source Software?

•  Licensing model –  Free redistribution –  Source code available – Modifications and derived works allowed

•  Distribution allowed under same terms as original licence

– No discrimination against people or fields of usage

•  Typical licenses –  BSD, Apache, GPL, Artistic

•  Restrictions vary by license (BSD vs. Copyleft)

Software Development with Open Source

Page 7: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Why Open Source?

•  Try before you buy – Use first, get support later – Open documentation, support forums, etc

•  Source code available – Can make changes and fix bugs

•  Freedom to fork – No vendor lock-in

•  Access to developers –  Speak directly to the author

Software Development with Open Source

Page 8: Software Development with Open Source

Open Source Business Systems www.opusvl.com

What do we use?

•  Products – Debian, Ubuntu, Apache, PostgreSQL, CouchDB,

Asterisk, XEN, OpenERP, DAViCal, Memcached, etc.

•  Development tools –  Perl – Catalyst, Moose, DBIx::Class, Template Toolkit,

DateTime, HTML::FormFu, etc.

Software Development with Open Source

Page 9: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Perl

•  Multi-paradigm programming language –  Procedural, Functional, Object-Oriented

•  Mature, stable, scalable – Used in mission-critical systems across the globe –  BBC, Cisco, Amazon, Vodafone, LOVEFiLM –  http://www.perl.org

•  Perl 5, version 12.2 –  Released 7th September 2010

Software Development with Open Source

Page 10: Software Development with Open Source

Open Source Business Systems www.opusvl.com

CPAN

•  Comprehensive Perl Archive Network – Over 21,000 modules - Perl’s “killer app”

•  Interfaces, frameworks, applications, dev tools, file formats, imaging, databases, and lots more

•  Code reuse – Don’t re-invent the wheel –  Building blocks for applications

•  http://search.cpan.org

Software Development with Open Source

Page 11: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Quality Assurance

•  Perl has a strong QA culture •  Test-driven development

•  CPAN Testers –  Automated testing community –  Every CPAN upload tested with multiple platforms

and Perl versions –  9,000,000 test reports (500,000 per month) –  http://www.cpantesters.org

Software Development with Open Source

Page 12: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Community

•  Perl Mongers – local user groups –  Birmingham, London, Milton Keynes, North West –  http://birmingham.pm.org

•  Conferences and workshops –  YAPC – Europe, Asia, Russia, North America –  http://conferences.yapceurope.org/lpw2010

•  Online –  http://blogs.perl.org –  Forums, IRC, mailing lists

Software Development with Open Source

Page 13: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Jobs

•  Contribute to Open Source projects –  Very impressive on your CV – Great way to gain experience

•  Not just programming – Documentation, testing, bug triage

•  User groups –  Perl Mongers, LUGs, UKUUG, Multipack, PyWM – Networking – get yourself known

Software Development with Open Source

Page 14: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Software Stack

Software Development with Open Source

Base software stackLinux, Apache, Perl

Core framework modulesCatalyst, Moose, DBIx::Class, etc

OpusVL framework modules

Clientapplication

components

OpusVL application

components

Client customisations

DBMSIngres,

PostgreSQL, CouchDB, etc

•  Core framework – Catalyst – Moose – DBIx::Class

Page 15: Software Development with Open Source

Open Source Business Systems www.opusvl.com

DBIx::Class

•  ORM – Object Relational Mapper – Database abstraction layer

•  Creates objects, classes, and methods •  Writes SQL – improves maintainability •  Easily add new class methods –  Business logic –  Encapsulation

•  Use methods, not database queries

Software Development with Open Source

Page 16: Software Development with Open Source

Open Source Business Systems www.opusvl.com

DBIx::Class Schema

•  Describes tables and relationships –  Loaded from DB – DBIx::Class::Schema::Loader

Software Development with Open Source

CREATE TABLE authors ( id integer primary key, name text ); CREATE TABLE books ( id integer primary key, author_id integer, title text, foreign key(author_id) references authors(id) );

dbicdump Authors 'dbi:SQLite:test.db'

Page 17: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Using generated classes

•  Gives us an Authors class –  Relationships converted to class methods

Software Development with Open Source

use Authors; my $db = Authors->connect("dbi:SQLite:test.db");

my $author = $db->resultset("Author") ->find(name => "Stephen King");

foreach my $book ($author->books) { say $book->title; say $book->author->name; }

Page 18: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Extending classes

•  With a “rate” method added to the Book class

Software Development with Open Source

# in Authors/Result/Author.pm

use List::Utils qw/sum/;

sub is_liked { my $self = shift;

my $total = sum( map {$_->rating} $self->books->all );

return ($total / $self->books->count) > 3; }

Page 19: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Moose

•  Object Oriented programming framework

•  Extension of Perl’s native OO •  Improves syntax and facilities – Method modifiers, introspection, roles, type checking

•  Large developer community

•  http://moose.perl.org

Software Development with Open Source

Page 20: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Moose example

Software Development with Open Source

use MooseX::Declare

class Report extends ‘Document’ with ‘Confidentiality’ {

has ‘total’ => (isa => ‘Num’, default => ‘1000’); has ‘notes’ => (isa => ‘Str’);

method fake_data {...} }

role Confidentiality { before print { # hide any incriminating data! }; }

Page 21: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Catalyst

•  Web development framework

•  Application server •  Scalable, high performance –  Powers some of the world’s biggest websites

•  Structured, maintainable – URLs dispatched to class methods

•  DRY – Don’t Repeat Yourself – Modular, self-contained components

Software Development with Open Source

Page 22: Software Development with Open Source

Open Source Business Systems www.opusvl.com

What does Catalyst provide?

•  Session handling •  Authentication / access control •  Page caching •  Built-in development server •  URL generation – What’s the URL to reach this method?

•  Library of pre-built components

Software Development with Open Source

Page 23: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Catalyst block diagram

Controller

View

Model

Stash

User

Business Logic DB

Software Development with Open Source

Page 24: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Model

•  Business logic

•  Interface to a class – Data storage (DBIx::Class, LDAP, S3, data files) –  API (REST, SOAP, XMLRPC) –  External system (OpenERP, Asterisk, hardware) –  Any other piece of Perl code

•  External to Catalyst – Used and maintained separately

Software Development with Open Source

Page 25: Software Development with Open Source

Open Source Business Systems www.opusvl.com

View

•  Presentation logic

•  Renders output as… – HTML, XML, JSON, PDF, Excel, JPEG, PNG, etc. –  Template::Toolkit

•  Messaging –  Email, SMS

•  Processing – Generating thumbnail images

Software Development with Open Source

Page 26: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Controller

•  Application logic –  Links Models to Views

•  Passes input to the model •  Puts data from the model onto the stash •  Runs the application – Control flow –  Logging / error handling –  Status codes

Software Development with Open Source

Page 27: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Conclusion

•  Open Source gives us the tools to deliver •  The Community makes it possible

•  Birmingham Perl Mongers –  http://birmingham.pm.org

•  Birmingham Linux User Group –  http://birmingham.lug.org.uk

Software Development with Open Source

Page 28: Software Development with Open Source

Open Source Business Systems www.opusvl.com

Essay question

•  Open Source software is often perceived as being non-commercial as free redistribution is permitted. However, many companies have managed to turn both the development and usage of Open Source software into a profitable business.

–  Research the different business models that companies use to derive commercial benefit from Open Source software.

–  Investigate the challenges that companies face in managing external development and user communities.

Software Development with Open Source