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
leon
September 24, 2017
Programming
0
190
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
Azure AI Foundryではじめてのマルチエージェントワークフロー
seosoft
0
150
Discover Metal 4
rei315
2
110
High-Level Programming Languages in AI Era -Human Thought and Mind-
hayat01sh1da
PRO
0
710
XP, Testing and ninja testing
m_seki
3
220
生成AIコーディングとの向き合い方、AIと共創するという考え方 / How to deal with generative AI coding and the concept of co-creating with AI
seike460
PRO
1
350
ニーリーにおけるプロダクトエンジニア
nealle
0
740
#QiitaBash MCPのセキュリティ
ryosukedtomita
0
900
CursorはMCPを使った方が良いぞ
taigakono
1
220
AIエージェントはこう育てる - GitHub Copilot Agentとチームの共進化サイクル
koboriakira
0
490
Flutterで備える!Accessibility Nutrition Labels完全ガイド
yuukiw00w
0
140
“いい感じ“な定量評価を求めて - Four Keysとアウトカムの間の探求 -
nealle
1
5.5k
Kotlin エンジニアへ送る:Swift 案件に参加させられる日に備えて~似てるけど色々違う Swift の仕様 / from Kotlin to Swift
lovee
1
260
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
55
5.6k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Scaling GitHub
holman
459
140k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.3k
The World Runs on Bad Software
bkeepers
PRO
69
11k
Done Done
chrislema
184
16k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
Statistics for Hackers
jakevdp
799
220k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.5k
A better future with KSS
kneath
239
17k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
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