Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Python: The Programmer's Lingua Franca

3,761 views

Published on

There are thousands of programming languages, but even if your organization works in one of the more popular languages, it's likely you will eventually interact with others who are unfamiliar with it. Since you can't be proficient in every programming language under the sun, a language that bridges technologies and allows people to communicate their ideas is needed.

A few programming languages have tried to fill this role over the years, but none holds as much promise as Python.

Published in: Technology
  • If you would like to watch this presentation, complete with discussion, you can download the recorded webcast at any time: http://www.activestate.com/webinars/python-lingua-franca
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Python: The Programmer's Lingua Franca

  1. 1. Python:The Programmer’s Lingua Franca Using Python to build bridges between technologies, businesses and people
  2. 2. What well talk about• What is a lingua franca?• Why the industry needs one• Acmeism – the Ingy approach• Past and current examples: BASIC, C, and Java• Why Python is better• TPSL: Teaching Python as a Second (or third or fourth) Language• Getting past the barriers
  3. 3. What is a lingua franca? “a language systematically used to make communication possible between people not sharing a mother tongue, in particular when it is a third language, distinct from both mother tongues.” -- Wikipedia• The original “Lingua Franca” was an amalgam of languages – Made up of Italian, Arabic, French, Greek, Portuguese, Spanish and Turkish. – Used in the Mediterranean during the Rennaissance• English functions as the de facto modern lingua franca – For international business, aviation, science and technology – Integrates words from other languages• English doesnt fit the strict definition – It is often the mother tongue of at least one party... – but this example is closer to what well talk about
  4. 4. Why do we need one forprogramming?• So many languages – more than 2500 in all (“The Language List” Bill Kinnersley) – if you just include popular ones, you still cant learn them all• Programmers need a vehicle to express concepts to one another• Programs need a vehicle to interact with one another – open data formats – standard protocols – an API everyone can use
  5. 5. What this audience reported: Number of Languages in Organization 5% 14% 27% 1 language 2 languages 3 languages 4 or more languages Unknown or no answer 18% 37%
  6. 6. Ingy döt Net • Inventor of YAML • Leader in the Perl Community • 100+ CPAN modules • Several PyPI Modules • Old and New “Activator” • Acmeist • Currently travelling around Europe
  7. 7. Acmeism• A different path to mutual comprehension• Ideas (modules) need to be shared across all language boundaries• Build technology that is programming language independent – YAML – data serialization for many programming languages – CDent - Acmeist Module Language – Pegex - Acmeist Parser for creating new languages – TestML - Acmeist Unit test language (like FIT)
  8. 8. Other programming lingua francas• BASIC – Used to be everywhere, code samples in math and science textbooks – Many first generation micro-computer hackers started with this language• C – Widely used and part of most comp-sci programs – Most experienced programmers are familiar with it – Lower-level language• Java – Extremely popular, cross-platform, also widely taught – Very verbose – Open source (GPL) only since 2007 (c.f. Apache Harmony)
  9. 9. ... used by this audience Language Used to Describe Programming Ideas 15% 14% 14% C Java Python Other No answer 13% 43%
  10. 10. Why Python is better• Free• Easy to read – Syntax (specifically indentation) enforces sane visual block structure – Concise, high-level interpreted language• Easy to learn – Excellent documentation and tutorials – Numerous training resources• Increasingly popular – Adopted by important organizations: Google, NASA, Disney, Sony, SEC
  11. 11. ComparisonsWhich language is most readable and concise? – Example code adapted from http://www.dmh2000.com/cjpr/ – Using object oriented C++ instead of C to be more fair
  12. 12. C++#include <iostream>#include <sstream>#include <string>#include <vector>using namespace std;template<class T> class RedBlackTree {private: static const int red = 0; static const int black = 1; int m_color; T m_val; RedBlackTree *m_left; RedBlackTree *m_right; RedBlackTree(RedBlackTree *b) { m_val = b->m_val; m_left = b->m_left; m_right = b->m_right; m_color = red; }public: RedBlackTree(T x) { m_val = x; m_left = 0; m_right = 0; m_color = red; } const RedBlackTree *find(const T &key) const { const RedBlackTree *result = 0; if (key == m_val) { result = this; } else if (key < m_val) { if (m_left != 0) { result = m_left->find(key); } } else { if (m_right != 0) { result = m_right->find(key); } } return result; }};
  13. 13. Javaimport java.util.*;public class RedBlackTree<T extends Comparable<T>> { public static final int red = 0; public static final int black = 1; private int __color; private T __val; private RedBlackTree<T> __left; private RedBlackTree<T> __right; private RedBlackTree(RedBlackTree<T> b) { __val = b.__val; __left = b.__left; __right = b.__right; __color = red; } public RedBlackTree(T x) { __val = x; __left = null; __right = null; __color = red; } public RedBlackTree<T> find(T key) { RedBlackTree<T> result = null; if (key == __val) { result = this; } else if (key.compareTo(__val) < 0) { if (__left != null) { result = __left.find(key); } } else { if (__right != null) { result = __right.find(key); } } return result; }}
  14. 14. Pythonclass RedBlackTree: red, black = range(2) def __init__(self, val=None): self.left = None self.right = None self.val = val self.color = RedBlackTree.red def find(self, key): result = None if (key == self.val): result = self elif (key < self.val): if (self.left != None): result = self.left.find(key) else: if (self.right != None): result = self.right.find(key) return result
  15. 15. Integration with other languages• Python libraries are commonly written in C or C++ when performance is a consideration• You can use other languages in Python, and Python in other languages – Inline, PyInline, Inline::Python etc.• More projects integrating Python with other programming languages: – Bridges for C/C++, Java, C#/.NET, PHP, Perl, and more... and databases • Commercial / enterprise: Oracle, SQL Server, DB2, SAP DB, Sybase • Open source: MySQL, PostgreSQL, SQLite, redis, MongoDB
  16. 16. Alternative Python interpretersPython is an open source language, implementations of Python are not controlled by a single commercial entity, as was case with Java and is the case with C#. – Important for avoiding vendor lock-in – PSF license is very permissiveThis encourages innovation and allows for alternative implementations: – Jython: implemented in Java – Stackless Python: CPython variant – unladen-swallow: Google project for a faster Python – Iron Python: for the .NET Framework – PyPy: also focussing on speed and efficiency
  17. 17. Python as a Second Language• What makes it easier to read also makes it easier to learn• Many programmers come to Python from other languages – lots of resources (Python wiki) for those switching – “Learning Python” by Mark Lutz and David Ascher – Ingys anecdotal evidence• Non-English tutorials and documentation – http://wiki.python.org/moin/Languages – theres even a Python tutorial in Esperanto!
  18. 18. How ActiveState can helpResources for developer-led initiatives to introduce and expand Python usage in your organization • Commercial support and indemnification • Quality assured, vendor-backed builds • Python training from the best in the field • Development advice • code.activestate.com • PyPM Index • Recipes • Komodo Edit and IDE
  19. 19. Python in the cloudCloud application platform for Python and many others languages – not a Platform as a Service... its for creating your own – based on Cloud Foundry – weve added Python support and a lot more – supports multiple languages: Python, Perl, Ruby, Node.js, Java... – all the Python web frameworks: Django, Bottle, Flask, Pyramid – ... via WSGI – deploy new applications or migrate existing ones – http://activestate.com/cloud
  20. 20. Questions?
  21. 21. Thank You! Troy Topnik: troyt@activestate.com Ingy döt Net: ingy@activestate.com www.acmeism.org Speak to a representative about ActivePython or Python training: 1-866-510-2914 business-solutions@activestate.com www.activestate.com

×