Upgrade to Pro — share decks privately, control downloads, hide ads and more …

UPD Graduate Talk 2013

Avatar for Ronald Cheung Ronald Cheung
March 26, 2013
49

UPD Graduate Talk 2013

Avatar for Ronald Cheung

Ronald Cheung

March 26, 2013
Tweet

Transcript

  1. What is Save22 • Save22 is a Singaporean startup company

    developing a web/mobile platform that helps Southeast Asian shoppers make purchasing decisions on what and where to buy. • There is a general lack of accurate pricing data in SE Asia, this is the problem Save22 is in the business of solving for the consumer Tuesday, February 25, 14
  2. Company Milestones • Company founded in March 2010 • Launched

    iPhone app August 2011. 30000+ downloads in Singapore • Raised initial funding November 2011 • Jan 2012 transferred engineering operations from Singapore to Manila • Release of Android app September 2011 • Release of redesigned web platform December 2012 • We currently have a team of 10 working from Ortigas Tuesday, February 25, 14
  3. Comparison of Price Comparison Apps • US based Price Comparison

    Apps such as Red Laser and Shop Savvy all source data from other e-Commerce platforms • Save22 price listings are from traditional physical stores such as SM Tuesday, February 25, 14
  4. Technology at Save22 • We use a diverse technology stack

    to support our web/mobile platform Tuesday, February 25, 14
  5. Mobile • We use native implementations for both Android and

    iPhone ( Java and Objective-C) • We have requirements such as barcode scanning using the phone’s camera that require native implementation • Clients get data from our backend via a Web Service API Tuesday, February 25, 14
  6. Web / Backend • Python used as primary language •

    Django used as a web framework • Apache / mod_wsgi used as web server • Postgresql used as relational database • Amazon Web Services ( AWS ) used for cloud hosting • Ubuntu OS • Memcached used for general purpose caching • RabbitMQ / celeryd used for queuing • Tornado used to support Long Polling applications • Fabric used for deployment • GIT used for source control Tuesday, February 25, 14
  7. “Traditional” enterprise stack • Java used as primary language •

    SQL Server / Oracle used as relational database • Physical server • Windows / Unix OS Tuesday, February 25, 14
  8. Python • Interpreted rather than compiled Faster speed of development

    but performance can be slower than compiled code • Expressive Power: More functions with less code Hello World in Java: public class HelloWorld { public static void main(String[] args) { System.out.println(“Hello, World”); } } Hello World in Python: print “Hello, World” Tuesday, February 25, 14
  9. Python • Positional and Keyword arguments for function definition Easy

    to change function definition without extensive refactoring def cheeseshop(kind, *arguments, **keywords): print "-- Do you have any", kind, "?" print "-- I'm sorry, we're all out of", kind for arg in arguments: print arg print "-" * 40 keys = sorted(keywords.keys()) for kw in keys: print kw, ":", keywords[kw] cheeseshop("Limburger", "It's very runny, sir.", "It's really very, VERY runny, sir.", shopkeeper='Michael Palin', client="John Cleese", sketch="Cheese Shop Sketch") Output: -- Do you have any Limburger ? -- I'm sorry, we're all out of Limburger It's very runny, sir. It's really very, VERY runny, sir. ---------------------------------------- client : John Cleese shopkeeper : Michael Palin sketch : Cheese Shop Sketch Tuesday, February 25, 14
  10. Python • List Comprehension • Built in data structures: Dictionary

    Tuples and Sequences Sets Lists • Has a wide array of third party libraries Using a for loop: >>> squares = [] >>> for x in range(10): ... squares.append(x**2) ... >>> squares [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] List comprehension: squares = [x**2 for x in range(10)] Instantiating a Python Dictionary: >>> tel = {'jack': 4098, 'sape': 4139} >>> tel['guido'] = 4127 >>> tel {'sape': 4139, 'guido': 4127, 'jack': 4098} Tuesday, February 25, 14
  11. Python • Python resources: “Dive into Python” “Learn Python the

    hard way” • Trivia: The largest user of python in the world is Google Tuesday, February 25, 14
  12. Django • Django is a Python web framework • Web

    frameworks provides a single pattern to implement common web functions such as defining forms, mapping form input parameters, mapping urls to functions. • Avoids multiple ways of doing the same thing, any Django developer can quickly understand the code without extensive familiarization. Tuesday, February 25, 14
  13. Django • Object-relational mapper (ORM) Avoids direct interaction with the

    database layer, provides a way to map domain objects to database structures • URL design A regular expression based mechanism to map URL patterns to functions • Template system Provides a templating language to separate presentation layer logic from business logic from data access ( MVC design pattern ) • Out of the box admin interface Provides default mechanism for users to update, add, delete from tables, avoids building repetitive function • Internationalization Built in support for multi language applications Tuesday, February 25, 14
  14. Django • Alternative Python web frameworks: Flask Pylons Grok TurboGears

    web2py At this point in time Django is still probably the most comprehensive framework • Resources: https://www.djangoproject.com/ Tuesday, February 25, 14
  15. Postgresql • Postgresql is an open source DBMS can scale

    on the same level as SQL Server or Oracle. • Important to handle the data required to build up an index of products, prices, and stores in SE Asia! • Supports the PostGIS library that adds Geographical data to a postgresql relational database. Highly useful to support functions like: - Where is the closest place a user can buy the product they are looking for - Where is the cheapest place I can buy a product within a given polygon ( for example Quezon City is a polygon ) • PostGIS has a convenient Django wrapper ( GeoDjango ) Tuesday, February 25, 14
  16. Cloud computing • Physical infrastructure requires a high upfront set

    up costs including: Purchase of hardware, lease/setup a data center, network connectivity, build in redundancy, hardware end of life and replacement, firmware upgrades, security, hardware firewalls etc • Cloud computing has low upfront cost, pay on a per hour basis, don’t need to worry about hardware maintenance, can scale computing capacity easily Tuesday, February 25, 14
  17. Amazon Web Services • AWS is a set of cloud

    computing services provided by Amazon.com • Elastic Compute Cloud (EC2) allows users create, launch, terminate “virtual machines”. For practical purposes they function like corresponding linux or windows machines. • Different EC2 “instances types” can be started with varying amounts of memory and computing power. • S3 is a service that provides storage at a relatively low cost per GB. • We use EC2 instances to host our Web and App servers, as well as database servers • We use S3 for backups and static media hosting ( for example product images ) Tuesday, February 25, 14
  18. Memcached • Memcached is a general purpose key value pair

    caching mechanism. • Is supported out of the box by Django as a caching backend • We use memcached for query caching to minimize heavy queries on the database when generating frequently hit pages ( for example homepage, categories page ) Tuesday, February 25, 14
  19. RabbitMQ / Celery • RabbitMQ is an Open source messaging

    infrastructure • Celery is an asynchronous queuing mechanism works with RabbitMQ Written in Python! • We use RabbitMQ/Celery for job scheduling (Celery Beat), running batch jobs asynchronously. Tuesday, February 25, 14
  20. Tornado Web Server • An open source non-blocking web server

    originally developed by FriendFeed written in Python • Tornado is event based that makes it distinct from web server such as Apache that are thread based. • It was initially developed to overcome the “C10K problem” of being able to handle 10000+ concurrent socket connections. Threaded models begin to suffer at this point due to context switching between this number of threads becoming a large overhead. • Handles “long polling” style applications such as news feeds that are setup to refresh themselves at certain intervals. • We use Tornado to serve the “news feed” that is constantly being refreshed and requested by our mobile users. Tuesday, February 25, 14
  21. Fabric Deployments • Traditional deployment to servers involving SSH to

    each server and running commands. • Fabric is a tool that streamlines this process by running shell commands from a single terminal to a set of remote servers. • Fabric is also written in Python! Tuesday, February 25, 14
  22. GIT • We migrated from SVN to GIT for one

    overriding reason: git merge Tuesday, February 25, 14
  23. The Team • Product Manager / UX • Designer /UI

    • Industrial Engineer / Process • Testing / QA • Software Engineers x 3 • Software Engineers are expected to be generalists who may work on any technologies in the Save22 technology stack Tuesday, February 25, 14