"The Trouble with Checked Exceptions A Conversation with Anders Hejlsberg, Part II" 阅读笔记
2010-12-22 15:34
507 查看
(Anders artima 访谈系列的第二部分
)
"Do the simplest thing
possible, but no simpler."
最近在规划一些小东西, 发现自己常常无意识的犯下过度设计的错误, 幸好看到这句话, 让我幡然醒悟.
"I'm a strong believer in being minimalistic."
这个系列, 七七八八看差不多了, 从中可以看出, Anders 对于 .Net 的设计, 确实是在遵循这个思路. 而 .Net 本身, 也称得上杰出了.
"Unless you actually are going to
solve the general problem, don't try and put in place a framework for solving a
specific one, because you don't know what that framework should look like."
作为一个设计过很多复杂框架, 系统的人都这样讲, 我们还有什么好说的呢.
关于异常处理, 有一整段非常精彩的评论, 摘抄如下
"Bill Venners
: What's in the finally?
Anders Hejlsberg
: In the finally, you protect yourself against the
exceptions, but you don't actually handle them. Error handling you put
somewhere else. Surely in any kind of event-driven application like any kind of
modern UI, you typically put an exception handler around your main message
pump, and you just handle exceptions as they fall out that way. But you make sure
you protect yourself all the way out by deallocating any resources you've
grabbed, and so forth. You clean up after yourself, so you're always in a
consistent state. You don't want a program where in 100 different places you
handle exceptions and pop up error dialogs. What if you want to change the
way you put up that dialog box? That's just terrible. The exception handling should be centralized,
and you should just protect yourself as the exceptions propagate out to the handler."
关于异常处理, 也曾困惑过, 看过网上的很多讨论, 大多限于谈玄论道, 给不出切实可行的建议. 当然, 异常处理本身很复杂, 需要见招拆招, 不能谈得很具体, 这也可以理解. 不过, 牛人之所以牛, 就在于能人所不能. Anders 这段话中提出的方式, 结合我自己的经验来看, 对于大多数的异常处理来说, 都简单, 且有效.
)
"Do the simplest thing
possible, but no simpler."
最近在规划一些小东西, 发现自己常常无意识的犯下过度设计的错误, 幸好看到这句话, 让我幡然醒悟.
"I'm a strong believer in being minimalistic."
这个系列, 七七八八看差不多了, 从中可以看出, Anders 对于 .Net 的设计, 确实是在遵循这个思路. 而 .Net 本身, 也称得上杰出了.
"Unless you actually are going to
solve the general problem, don't try and put in place a framework for solving a
specific one, because you don't know what that framework should look like."
作为一个设计过很多复杂框架, 系统的人都这样讲, 我们还有什么好说的呢.
关于异常处理, 有一整段非常精彩的评论, 摘抄如下
"Bill Venners
: What's in the finally?
Anders Hejlsberg
: In the finally, you protect yourself against the
exceptions, but you don't actually handle them. Error handling you put
somewhere else. Surely in any kind of event-driven application like any kind of
modern UI, you typically put an exception handler around your main message
pump, and you just handle exceptions as they fall out that way. But you make sure
you protect yourself all the way out by deallocating any resources you've
grabbed, and so forth. You clean up after yourself, so you're always in a
consistent state. You don't want a program where in 100 different places you
handle exceptions and pop up error dialogs. What if you want to change the
way you put up that dialog box? That's just terrible. The exception handling should be centralized,
and you should just protect yourself as the exceptions propagate out to the handler."
关于异常处理, 也曾困惑过, 看过网上的很多讨论, 大多限于谈玄论道, 给不出切实可行的建议. 当然, 异常处理本身很复杂, 需要见招拆招, 不能谈得很具体, 这也可以理解. 不过, 牛人之所以牛, 就在于能人所不能. Anders 这段话中提出的方式, 结合我自己的经验来看, 对于大多数的异常处理来说, 都简单, 且有效.
相关文章推荐
- "Contracts and Interoperability A Conversation with Anders Hejlsberg, Part V" 阅读笔记
- Objective-C Programming: The Big Nerd Ranch Guide (2nd Edition) 阅读笔记(Part I & II)
- "Scalable Multithreaded Programming with Thread Pools" 阅读笔记
- "The Design and Evolution of C++" 阅读笔记
- "My History of Visual Studio" 阅读笔记
- "Essential WPF - Chapter 5 Visuals" 阅读笔记
- "Essential WPF - Chapter 8 Styles" 阅读笔记
- "Essential WPF - Chapter 6 Data" 阅读笔记
- "The Development of AppleScript"的笔记
- The Trouble with Checked Exceptions
- JavaScript.The.Good.Parts阅读笔记(二)作用域&闭包&减缓全局空间污染
- "The F language" by Jeanne Adams
- "The C Programming Language", 2nd edition, Kernighan and Ritchie
- "The Complete Reference C" 读书笔记
- Selected solutions to exercise of "The C Programming Language" 2e (Part 6)
- <java>No enclosing instance of type GraphicFrame is accessible. Must qualify the allocation with an
- <C++Primer>第四版 阅读笔记 第二部分 “容器和算法”
- irq 29: nobody cared (try booting with the "irqpoll" option) 问题说明
- part-aligned系列论文:1711.Beyond Part Models- Person Retrieval with Refined Part Pooling 论文阅读笔记
- 如何在多线程下保证Lazy初使化对象的完全整性与正确-The "Double-Checked Locking is Broken" Declaration