Re: problem in creating Services

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



See below...
On Mon, 28 May 2007 15:10:13 -0700, "Ashot Geodakov" <a_geodakov@xxxxxxxxxxxxxxxxxx>
wrote:

"MrAsm" <mrasm@xxxxxxx> wrote in message
news:ugim53lmvb984aioqa8jf75j8bq3t64ccc@xxxxxxxxxx

With C you can write "horror" code.
If the compiler does not emit warning or errors, that does not mean
that the code has been written in a *clean* way.

You are right.
****
The approach of writing bad C while using C++, full of global varables, or, for the naive,
thinking that "no global variables:" means "putting everything in the CWinApp class is the
right solution" [it isn't, and I consider it irresponsible], slamming classes around with
circular dependencies (but which compiles without warnings, so it must be OK), having
dialogs reach into the parent class for control values, or modify variables of the parent
class, or even KNOW the parent class at all, are horrors that compile. Declaring
non-const static variables inside message handlers. Tossing global variables around so
parameters don't need to be passed in. Putting side effects in parameter values. The
list of bad techniques is endless. All of these compile, and sometimes even run
successfully, but are hard to write, hard to debug, hard to understand, and hard to
maintain.

I was talking to one of my ex-IBM friends last week, and he said "we stopped doing code
reviews before I left, and I insisted we do only INTERFACE reviews. Once the interface is
accepted, the coding is an irrelevant detail". He has a good point. I work from
interface specs, and don't worry about the code. The code just happens. If the interface
is clean, the code is usually clean.
*****


array[++index++] ...?!?

Do you want to show how well you know C syntax and rules, or better
writing more *readable* code?

Of course I'd rather see 10 lines of code (plus comments) than just one
line. It's just I can't see anything wrong in compact code, as long as I can
read it, and as long as it's elegant.


I believe that quality code is a *readable* code; the more readable,
the better; and better "unpacking" instructions on several line
statements than doing "WinZIP" with source code :)

The assignment inside if-statement is readable.
*****
No, it is not. In fact, I've seen two forms of errors: the obvious one of writing = when
== is expected, thus getting a side effect when one is not expected, and someone
"correcting" an = to an == and losing the side effect expected. It is not readable, it is
confusing, it is error prone, and it is often not robust under maintenance.
*****

I can't understand at all what New-Yorkers are saying, and that accent
should be outlawed. :)

Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: creaping coupling......
    ... but it is a more strict contract than required. ... "I am capable of implementing things via interface XYZ i.e. ... consider specifically that we compile, deploy and then we delete a method to ... IWriteable pipe = new Pipe; ...
    (comp.object)
  • Re: Code Review requested: Postscript Interpreter
    ... or constraint checking functionality to a subset of an interface. ... quite tedious to enable trace messages for only a subset of functions, ... You can in essence compile ... I definitely recommend using the single file approach for major ...
    (comp.lang.c)
  • Re: ActiveX.exe question
    ... > the public interface still need registered in order to use them. ... Compile AXExe.exe against a Share on the TestPC ... Open a Standard-Exe-Project on your DevelopPC and name it AXTest ... Compile AXTest.exe against the Share on the TestPC ...
    (microsoft.public.vb.general.discussion)
  • Re: RAD vs. performance
    ... thus they fulfull the number interface and can be used interchangeably. ... I'm not about to ditch statically typed languages ... Because you need whole-program optimisation for a start. ... The benefits of static typing come at compile time. ...
    (comp.lang.misc)
  • Re: Is Direct3D a rip-off of OpenGL?
    ... People who think that a method change in a NEW INTERFACE in DirectX really ... Moving to use a NEW INTERFACE, ... > ago simply isn't going to compile with the latest SDK, ...
    (comp.graphics.api.opengl)