Re: problem in creating Services
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Mon, 28 May 2007 22:57:10 -0400
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.
*****
Joseph M. Newcomer [MVP]
I can't understand at all what New-Yorkers are saying, and that accent
should be outlawed. :)
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- Re: problem in creating Services
- From: Alexander Grigoriev
- Re: problem in creating Services
- References:
- problem in creating Services
- From: ashukasama
- Re: problem in creating Services
- From: Joseph M . Newcomer
- Re: problem in creating Services
- From: Ashot Geodakov
- Re: problem in creating Services
- From: MrAsm
- Re: problem in creating Services
- From: Ashot Geodakov
- problem in creating Services
- Prev by Date: Re: problem in creating Services
- Next by Date: Re: Seeing VERSIONINFO under Vista?
- Previous by thread: Re: problem in creating Services
- Next by thread: Re: problem in creating Services
- Index(es):
Relevant Pages
|