Re: Questions about Coding Practices
- From: "Peter Morris" <mrpmorrisNO@xxxxxxxxxxxxx>
- Date: Mon, 14 Jul 2008 10:07:29 +0100
10. Avoid method-level document.
a. Use extensive external documentation for API documentation.
b. Use method level comments only as tool tips for other developers.
Does he say why? Why would you not document a method in code? If your documentation is separate it is more likely to be out of sync with the method. I would document in the source *or* use a tool like doc-o-matic which at least reads the source (I would prefer this, it keeps your source smaller).
29. Avoid using the trinary conditional operator.
Q: Is it really hard to read?
For very long lines it can be hard to read, for short stuff it isn't. I use if/else for long lines and trinary where it is short enough.
35. Always mark public and protected methods as virtual in a non-
sealed class.
At this point I would have stopped reading the book.
58. Do not use late-binding invocation when early binding is possible.
Q: Microsoft Application Blocks seem to encourage the uses of late-
binding invocation. Personally I like early binding as the compiler
may check errors for me.
It says "when early binding is possible". Compile time checks are better than runtime ones, but if early binding isn't possible then you can't use it. This one makes sense, what is your objection?
Pete
.
- References:
- Questions about Coding Practices
- From: wangdaixing
- Questions about Coding Practices
- Prev by Date: Re: Questions about Coding Practices
- Next by Date: Re: Questions about Coding Practices
- Previous by thread: Re: Questions about Coding Practices
- Next by thread: Re: Questions about Coding Practices
- Index(es):
Relevant Pages
|