Submit Search
Ruby Object Design (Chinese)
6 likes
792 views
AI-enhanced description
Eddie Lee
本文件讨论了 Ruby 对象设计的独特之处,强调了其语法简洁性与初学者的学习曲线,以及封装和元编程的优势与缺点。此外,文件还探讨了模块化设计的好处和挑战,尤其是如何减少代码重复及提升对象的灵活性。
Technology
Read more
1 of 35
Download now
Downloaded 10 times
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
More Related Content
PPT
從 Java programmer 的觀點看 ruby
建興 王
PPT
漫谈php和java
sulong
PDF
Java SE 7 技術手冊投影片第 07 章 - 介面與多型
Justin Lin
PPTX
Duck Typing and Multiple Inheritance
Sway Wang
PPTX
Code guidelines
Jeffray Huang
PDF
Rails talk-5
Eddie Lee
PDF
Ruby Object Design
Eddie Lee
PDF
Ruby Object Design
Eddie Lee
從 Java programmer 的觀點看 ruby
建興 王
漫谈php和java
sulong
Java SE 7 技術手冊投影片第 07 章 - 介面與多型
Justin Lin
Duck Typing and Multiple Inheritance
Sway Wang
Code guidelines
Jeffray Huang
Rails talk-5
Eddie Lee
Ruby Object Design
Eddie Lee
Ruby Object Design
Eddie Lee
Featured
(20)
PDF
2024 Trend Updates: What Really Works In SEO & Content Marketing
Search Engine Journal
PDF
Storytelling For The Web: Integrate Storytelling in your Design Process
Chiara Aliotta
PDF
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
PDF
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
PDF
2024 State of Marketing Report – by Hubspot
Marius Sescu
PDF
Everything You Need To Know About ChatGPT
Expeed Software
PDF
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
PDF
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
PDF
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
PDF
Skeleton Culture Code
Skeleton Technologies
PDF
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
PDF
Content Methodology: A Best Practices Report (Webinar)
contently
PPTX
How to Prepare For a Successful Job Search for 2024
Albert Qian
PDF
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
PDF
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
PDF
5 Public speaking tips from TED - Visualized summary
SpeakerHub
PDF
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
PDF
Getting into the tech field. what next
Tessa Mero
PDF
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
PDF
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
2024 Trend Updates: What Really Works In SEO & Content Marketing
Search Engine Journal
Storytelling For The Web: Integrate Storytelling in your Design Process
Chiara Aliotta
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Ad
Ruby Object Design (Chinese)
1.
淺談 ruby 物件設計
2.
Eddie Li (ADZ)
eddie@visionbundles.com http://adz.visionbundles.com Github: afunction Facebook: /adz.624
3.
Ruby 物件與其他語⾔言不同的地⽅方
4.
1.語法省略
10.
優點 1. 程式碼更容易閱讀、更像⼈人類語⾔言
(model validation, routes, rspec, view helper) 缺點 1. 對初學者來說更⾼高的學習曲線 (⾮非常容易誤解)
11.
2. 沒有真正的 property
class/instance variables and method instead.
12.
attr_accessor / attr_reader
/ attr_writer
13.
不過還是可以透過 class/instance variable
存取
15.
3. 運算⼦子也是 method
magic!
17.
def + def
- def * def / def << def == def ===
18.
4. Open Class
20.
5. Meta-programming ⽤用程式寫程式
21.
封裝抽象⾏行為
22.
優點 1. 區隔不同
level 的邏輯,讓商業邏輯更乾淨。 2. 沒有極限的增加⽣生產⼒力
23.
缺點 1. 不容易維護
(但有解決⽅方法) 2. 難以對抽象⾏行為的 method, variables 命名 3. 有時候也難以了解閱讀程式碼
24.
class_eval define_method define_singleton_method
25.
6. module &
class PHP Traits 多重繼承 打破上下繼承關係
26.
a. DRY 重複的
method
27.
b.當有 class include
這 module 時會呼叫 self.included “base” 指的是誰 include 了這個 module
28.
你可以⽤用 module …
1. 把共通⾏行為模組化 2. 搭配 meta-programming 把抽象⾏行為模組化 3. 減少程式碼重複
29.
優點 1. 容易組織⼀一個⼤大型
class 2. 更彈性的設計跟擴充物件
30.
缺點 1. 難以閱讀和撰寫
unit-test (當模組間有⾼高度相依的 context 時) 2. ⾼高學習曲線 3. 容易產⽣生程式碼誤解
31.
7. 跳過 “private,
protected” 保護
32.
“send” method 能夠跳過
“private, protected 保護
33.
結合 send, include
和 module 從外部擴充已存在的物件,完全不需修改程式碼
34.
Live Coding. aka
Demo!
35.
Q&A Thank you.
Download