TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Epic Answer - Avoiding If statements

9 点作者 sidmkp96大约 12 年前

3 条评论

yen223大约 12 年前
It's easy - use switch/case statements!<p>But seriously, isn't it true that Smalltalk doesn't have if statements?
评论 #5400431 未加载
andymoe大约 12 年前
His idea in the second edit is similar to what is done with a lot of methods in Cocoa and Cocoa Touch and so on: <a href="http://cocoadev.com/wiki/MethodSwizzling" rel="nofollow">http://cocoadev.com/wiki/MethodSwizzling</a>
amccloud大约 12 年前
Wouldn't that be considered a state machine? I've done something with an audio player. Each state was a different class.