Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Exploring ActiveRecord (Ruby China 2017)
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
leon
September 24, 2017
Programming
0
200
Exploring ActiveRecord (Ruby China 2017)
1. Meatadata: Association; Attribute;
2. ActiveRecord Hierarchies
leon
September 24, 2017
Tweet
Share
Other Decks in Programming
See All in Programming
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
160
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
220
AIフル活用時代だからこそ学んでおきたい働き方の心得
shinoyu
0
130
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
380
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
680
2026年 エンジニアリング自己学習法
yumechi
0
130
AgentCoreとHuman in the Loop
har1101
5
220
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
420
AI Agent の開発と運用を支える Durable Execution #AgentsInProd
izumin5210
7
2.3k
IFSによる形状設計/デモシーンの魅力 @ 慶應大学SFC
gam0022
1
290
Data-Centric Kaggle
isax1015
2
760
高速開発のためのコード整理術
sutetotanuki
1
380
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
463
34k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
89
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
320
Measuring & Analyzing Core Web Vitals
bluesmoon
9
750
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.4k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
150
Raft: Consensus for Rubyists
vanstee
141
7.3k
Mind Mapping
helmedeiros
PRO
0
75
How to train your dragon (web standard)
notwaldorf
97
6.5k
Optimising Largest Contentful Paint
csswizardry
37
3.6k
Transcript
Confidential Exploring ActiveRecord Leon Confidential
2 Agenda Ø Preface ü Beauty Of Mathematics Ø Metadata
ü Reflection; Association; Attribute Ø Hierarchies ü Scoping Ø Wrapping Up
Introduction
4 FreeWheel是做什么的? 目前90%美国主流电视媒体和运营商使用我们的广告平台。 2014年,我们服务的视频播放超过1250亿次。
5 MRM-FreeWheel的旗舰产品 Monetization Rights Management®
6 FreeWheel的客户
ORM Preface
8 归类 Ø 现有煤气灶、水龙头、水壶和火柴摆在您面前,需要烧水时,须进行如下 操作: ü 往水壶里注满水,点燃煤气,把水壶放到煤气灶上。 Ø 假设现在水壶中的水是满的,其他情况不变,又该怎样去做? ü
物理学家的答案:“点燃煤气,再把水壶放上去。” ü 数学家的答案:“只须把水壶中的水倒掉,问题就化归为前面所说的 问题了。”
9 Ø Hibernate (JAVA) Ø Entity Framework (C#) Ø SQLBoiler
(Golang) Ø Django (Python) Ø ActiveRecord (Ruby)
Real Life Gem
11 Real-life Case: Brand New Copy
12 Tasks Split Up Ø Data Structure: ü Association; Reflection;
Attribute; Graph Ø Algorithm ü Graph copy ü Topology sort ü Priority queue Ø Detail is evil !!
13 ActiveRecord Hierarchies
ActiveRecord Metadata
15 Beauty Of Mathematics
16 Metaphor For Input & Output
17 What's Metadata? - Compiler
18 What's Metadata? - Association
19 Association & Reflection Ø Reflection ü Host; Options Ø
Association: ü Owner ü Reflection ü Target
20
21 Builder & Reflection & Association
22 What's Metadata? - Attribute
23 Attribute Ø Attribute: two dimensions ü Type • data
type; SQL type • casting from/to database type ü Value • Accessor for business model
24
25 Attribute Accessor
ActiveRecord Hierarchies
27 Hierarchies
28 Scoping Ø Scope Ø Relation Ø Scope vs. Relation
Ø Relation vs. Arel
29 Scope
30 Relation
31 Nested Scopes Combined Relation
32 Default Scope Combined Relation
33
Wrapping Up & Abstraction
35 Summary Ø Functionalities ü Metadata Management ü Accessor Methods
Generation ü Scoping && Relation Ø Design ü Meta Programming ü Multiple Layers Design For Single Responsibility ü Interface Over Implementation Ø Program = Data Structure + Algorithm
Confidential THANKS