You are on page 1of 26

Save22 @ UPD 2013

Ronald Cheung
CTO

Tuesday, February 25, 14


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


Platforms
• IPhone
• Android
• Web

Tuesday, February 25, 14


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


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


Technology at Save22

• We use a diverse technology stack to


support our web/mobile platform

Tuesday, February 25, 14


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


Web / Backend
• Python used as primary language

• Django used as a web framework

• Apache / mod_wsgi used as web • RabbitMQ / celeryd used for


server queuing

• Postgresql used as relational • Tornado used to support Long


database Polling applications

• Amazon Web Services ( AWS ) used • Fabric used for deployment


for cloud hosting
• GIT used for source control
• Ubuntu OS

• Memcached used for general


purpose caching

Tuesday, February 25, 14


“Traditional” enterprise
stack

• Java used as primary language

• SQL Server / Oracle used as relational database

• Physical server

• Windows / Unix OS

Tuesday, February 25, 14


Python
Hello World in Java:

public class HelloWorld {


public static void main(String[] args) {
Interpreted rather than System.out.println(“Hello, World”);
compiled }
Faster speed of development
but performance can be slower }
than compiled code

• Expressive Power: More


functions with less code Hello World in Python:

print “Hello, World”

Tuesday, February 25, 14


Python
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]

• Positional and Keyword arguments


for function definition cheeseshop("Limburger", "It's very runny, sir.",
"It's really very, VERY runny, sir.",
shopkeeper='Michael Palin',
Easy to change function definition client="John Cleese",
sketch="Cheese Shop Sketch")
without extensive refactoring
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


Python
• List Comprehension
Using a for loop:
>>> squares = []
>>> for x in range(10):
... squares.append(x**2)


...
Built in data structures: >>> squares
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

Dictionary List comprehension:


squares = [x**2 for x in range(10)]

Tuples and Sequences


Sets
Lists
Instantiating a Python Dictionary:

• Has a wide array of third party >>> tel = {'jack': 4098, 'sape': 4139}
>>> tel['guido'] = 4127

libraries >>> tel


{'sape': 4139, 'guido': 4127, 'jack': 4098}

Tuesday, February 25, 14


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


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


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


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


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


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


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


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


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


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


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


GIT

• We migrated from SVN to GIT for one overriding


reason:

git merge

Tuesday, February 25, 14


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


Questions

• ronald@save22.com
• http://twitter.com/ronaldlcheung
• http://www.linkedin.com/in/ronaldlcheung

Tuesday, February 25, 14

You might also like