Re: Questions about Coding Practices

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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

.



Relevant Pages

  • Re: Linux, X, ld, gcc, linking, shared libraries and stuff
    ... > and Late binding seems to be some OLE stuff. ... Actually, "dynamic linking" covers more than one thing...as, really, it ... "lazy binding" is only being mentioned because it's LD's ... option in their documentation anywhere, no-one seems to be using this ...
    (alt.lang.asm)
  • Re: CollectionChanged event
    ... Never mind!! ... The documentation seems to be wrong, ... > want to be able to detect if the binding is removed. ... > event fires, and thus I must somehow compare the collections? ...
    (microsoft.public.dotnet.languages.vb.controls)
  • Re: Curses binding?
    ... Ada, for example on Linux. ... A Google search turned up the *documentation* ... for such a binding, but the actual code itself eludes me. ...
    (comp.lang.ada)
  • Re: Curses binding?
    ... A Google search turned up the *documentation* ... for such a binding, but the actual code itself eludes me. ... AFAIK ncurses comes with Ada bindings. ...
    (comp.lang.ada)
  • Re: commenting, was Re: Use of declare blocks
    ... Minimal documentation ... For example, in developing a binding to some API, I do a lot of throw-away ... makes it easy to refresh my memory, ...
    (comp.lang.ada)