Benefits
- Configuration is not in code
- Easily deploy of crud apps
- Easy scaling
- Easily addons
- Enforces scalable architecture
Drawbacks
Benefits
Drawbacks
What it is? Why its important? When is it used? - In the wild How to implement it? - Single file demo
########################### | |
# Identify the question | |
########################### | |
Identify the question you are trying to solve | |
# Which car is the most undervalued? | |
# Are we trying to maximize or minimize a variable? | |
########################### | |
# Understand the data |
class PizzaFactory | |
def self.create_pizza(type) | |
if type == 'Pepperoni' | |
return PepperoniPizza.new | |
if type == 'Greek' | |
return GreekPizza.new | |
end | |
end | |
package com.verdad.core; | |
import android.content.Context; | |
import com.google.gson.FieldNamingPolicy; | |
import com.google.gson.Gson; | |
import com.google.gson.GsonBuilder; | |
import java.util.HashMap; | |
import java.util.Map; |
import json, urllib2, re, csv | |
import xml.etree.ElementTree as ET | |
patterns = { | |
'YEAR': re.compile('(19|20)\d{2}'), | |
'ZIP': re.compile('(\d{5})'), | |
'MILES': re.compile('\d+,?(\d|X|k)+\smiles') | |
} | |
occurrences = { |
class MorningAlgorithm | |
# This method is used to encapsulate the algorithm's general process. | |
# Notice this method is not concerned how the methods are accomplished | |
def execute | |
wake_up | |
workout | |
eat_breakfast | |
drive_to_work | |
end |
# This gist is a continuation of a previous gist which defines the MorningAlgorithm class | |
# https://gist.github.com/jpotts18/1f4269c9e1f22c963a0d | |
class LateMorningAlgorith < MorningAlgorithm | |
def work_out | |
puts "Nope..." | |
end | |
def eat_breakfast |
class WebScraper | |
def execute | |
create_folders | |
download_data | |
parse_data | |
write_output | |
end | |
def create_folder |
import uuid, random, json | |
# json.dumps(x, indent=4) | |
product_range = range(100000,110000) | |
num_recs_per_type = 20 | |
num_users = 500000 | |
user_ids = [ str(uuid.uuid1()) for _ in range(num_users) ] | |
rec_types = ['by_x','by_y','by_z'] |