tdd_homework_01's People
tdd_homework_01's Issues
review completed. well done.
完成地很好,也附上在 C# 的一些建議跟 sample solution 給您參考。
結論
可以參考一下我的 sample code: https://gist.github.com/hatelove/f5a4c2591293828b637f#file-getsumbypagesize_v2-cs
重點 focus 在下列幾點:
- 呼叫端怎麼呼叫最好用, 語意清楚, 參數夠少, intellisense輔助。
- API 在需求異動時,能越穩定越好,代表支援有足夠的彈性。在面對重構時,也不會影響到呼叫端的使用,例如 property rename。
- 測試案例要怎麼呈現,最像口語化的描述著呼叫端使用情境。包含怎麼寫語意最清楚,寫起來最快。
這個 homework 基本上有四種方式來實作,也考驗著對 C# 的熟悉程度。
- 使用 enum, production code 以 if/else 來分辨
- 使用 string + reflection 來動態決定使用哪一個 property 加總
- 使用 delegate/lambda 針對 Product 型別來處理
- 使用 generic 支援泛型,使用 extension method 針對所有集合都提供這樣的功能
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.