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
OO training homework 2 review and summary
Search
hatelove
July 23, 2012
Technology
1
4.6k
OO training homework 2 review and summary
將大家 homework 2 需注意的地方,延伸思考的部分提出來
hatelove
July 23, 2012
Tweet
Share
More Decks by hatelove
See All by hatelove
1. 在沙箱中開發
hatelove
12
3k
BDD in .NET - TDD 在實務上的最後一塊拼圖
hatelove
4
2.8k
OO training 基本原則整理
hatelove
2
5.2k
OO training homework 3 review and summary
hatelove
1
11k
OO training homework 1 review and summary
hatelove
1
8k
Object Oriented Training - Session 4
hatelove
1
5.1k
Object Oriented Training - Session 3
hatelove
1
11k
Object Oriented Training - Session 2
hatelove
1
4.8k
Object Oriented Training - Session 1
hatelove
1
8.3k
Other Decks in Technology
See All in Technology
カミナシ社の『ID管理基盤』製品内製 - その意思決定背景と2年間の進化 #AWSUnicornDay / Kaminashi ID - The Big Whys
kaminashi
3
830
AWSで推進するデータマネジメント
kawanago
1
1.2k
品質視点から考える組織デザイン/Organizational Design from Quality
mii3king
0
150
Agile PBL at New Grads Trainings
kawaguti
PRO
1
330
Kubernetes における cgroup driver のしくみ: runwasi の bugfix より
z63d
2
250
まだ間に合う! StrandsとBedrock AgentCoreでAIエージェント構築に入門しよう
minorun365
PRO
11
1.1k
Vault を基盤として整備し、 みんなに使ってもらえるようになるまで
takahiko
1
110
La gouvernance territoriale des données grâce à la plateforme Terreze
bluehats
0
130
なぜテストマネージャの視点が 必要なのか? 〜 一歩先へ進むために 〜
moritamasami
0
190
生成AIでセキュリティ運用を効率化する話
sakaitakeshi
0
350
シークレット管理だけじゃない!HashiCorp Vault でデータ暗号化をしよう / Beyond Secret Management! Let's Encrypt Data with HashiCorp Vault
nnstt1
3
230
MCPで変わる Amebaデザインシステム「Spindle」の開発
spindle
PRO
3
3k
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
45
7.6k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.1k
Balancing Empowerment & Direction
lara
3
610
Fireside Chat
paigeccino
39
3.6k
Why Our Code Smells
bkeepers
PRO
339
57k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Git: the NoSQL Database
bkeepers
PRO
431
66k
Embracing the Ebb and Flow
colly
87
4.8k
Writing Fast Ruby
sferik
628
62k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
139
34k
Mobile First: as difficult as doing things right
swwweet
224
9.9k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
Transcript
Date: 2012/06/04 OO training – homework 2 review
- 2 - 延伸思考 • 增加了非Manager,但會code review的角色 – 如:資深工程師、顧問 •
增加了不會code review的Manager – 如:HR manager • 每個manager的CodeReview方式不同
- 3 - 整理 • 職責 – Program屬於場景 – Builder,
Factory屬於工廠 • 命名 – Pascal & camel – GetsXXX or SetsXXX • Magic number or magic string – hard-code的字串或數字(非0 or 1) – Extract to member/field/property with readonly • readonly & constant – Enum, config, database or resource
- 4 - 效能 • 比較字串 – a.ToUpper() == “Y”
– string.Compare(a, “y”, true) ==0 • 宣告為virtual • 透過try/catch攔exception,控制流程
- 5 - 用法 • parameter建議不要複雜化 – 三元判斷式 – Function
• Console.WriteLine() – (string format, params object[] arg) – boxing • DRY – 多型 – 判斷式執行子句,只放因為條件不同而不同的部分 • 避免使用預設存取修飾詞
- 6 - 設計 • 存取修飾詞 – public: 從外部看這個物件的觀點 –
protected: 從子類看父類的觀點 – private: 從物件本身看自己的觀點 • 設計為virtual時,考慮是否應為abstract • 使用的角度 – interface • 物件的本質與共通性 – abstract • 系統的抽象程度看interface,重用程度看abstract
- 7 - 其他 • 不同題作業,請分不同project。可共用同一個solution。 • 請確認可以建置通過與執行無誤
Q & A