B
Ben Bacarisse
We are not really disagreeing about much, but there are a few things I
take issue with...
I don't think these are all same at all. You probably need a huge
justification to use a risky feature, and very little to use one that is
specialised. Some of the others may not need any justification at all.
If I use a surprising feature, I'll just write a comment about it
(provided I can guess that it will be considered surprising). I won't
necessarily think it needs any justification to use it since the comment
immediately renders it unsurprising.
Now, you may well think that I'm just picking nits -- that all this is
properly wrapped up in the basic, un-contentious idea, that everything
in a program needs to have suitable justification for it's use -- that
all I'm doing is quibbling about the details -- but I think there really
is a different view of programming here.
From the way you've expressed it, I suspect that the meaning of
"justification" is not far off from "having a good reason to do
something bad" (this may be a misreading on my part) but I see it very
differently. A program with an explained, but surprising, bit of code
is better than one without. The surprise is the justification.
Just to be clear, when I talked about learning stuff I was not talking
about writing code to learn stuff. I was talking about the joy of
learning something in the middle of a tedious bit of program porting or
maintenance.
This takes a narrow view of professional programming. I wrote code for
some years at a leading research university. I would have lost this
professional job if I had not pushed myself and been continually learning
new stuff. Working right up to the limits of the tools was required.
Just another nit-pick? Maybe. But professional programmers do all
kinds of things, and the degree to which they must suppress their joy
and exuberance about the task varies greatly. Writing code to control a
pacemaker is very different to writing code to crack a code.
I think there are piles and piles of C code that will never go near a
C++ compiler. I would weigh as close zero as possible the disadvantage
of using 'mutable' as a variable name in some C libraries. Let's not
forget that there is also harm in terms time and effort when a C
programmer is always looking over their shoulder at C++.
<snip yet more points of agreement>
take issue with...
David Brown said:Using a language to its full potential does not mean using every feature
of the language, or every possible technique. Look at Rosario1903's
code in this group - he uses the C pre-processor "to its full
potential", and is universally condemned for it.
You are of course correct that you need to take advantage of the
language and toolchain's features when the make the program better - but
the more advanced, complicated, surprising, risky or specialised the
feature or technique is, the more justification you need to use it.
I don't think these are all same at all. You probably need a huge
justification to use a risky feature, and very little to use one that is
specialised. Some of the others may not need any justification at all.
If I use a surprising feature, I'll just write a comment about it
(provided I can guess that it will be considered surprising). I won't
necessarily think it needs any justification to use it since the comment
immediately renders it unsurprising.
Now, you may well think that I'm just picking nits -- that all this is
properly wrapped up in the basic, un-contentious idea, that everything
in a program needs to have suitable justification for it's use -- that
all I'm doing is quibbling about the details -- but I think there really
is a different view of programming here.
From the way you've expressed it, I suspect that the meaning of
"justification" is not far off from "having a good reason to do
something bad" (this may be a misreading on my part) but I see it very
differently. A program with an explained, but surprising, bit of code
is better than one without. The surprise is the justification.
Note also there is a big difference between what you do "to learn stuff"
and what you do when writing serious code that must work, and be
supported and maintainable for years to come.
Just to be clear, when I talked about learning stuff I was not talking
about writing code to learn stuff. I was talking about the joy of
learning something in the middle of a tedious bit of program porting or
maintenance.
When trying things out
and learning new stuff, or writing code for fun, it's fine to push
yourself and your tools to the limits. But when you are working
professionally, you take a step back to avoid the risk of going over
these limits.
This takes a narrow view of professional programming. I wrote code for
some years at a leading research university. I would have lost this
professional job if I had not pushed myself and been continually learning
new stuff. Working right up to the limits of the tools was required.
Just another nit-pick? Maybe. But professional programmers do all
kinds of things, and the degree to which they must suppress their joy
and exuberance about the task varies greatly. Writing code to control a
pacemaker is very different to writing code to crack a code.
Because of the overlap between C and C++, and between C programmers and
c++ programmer (and perhaps more importantly, the /imagined/ overlap in
the languages as many programmers think of C++ as a pure superset of C),
it /does/ matter if you use a technique in C that cannot be used in C++.
Sometimes a C-only feature is useful enough that it is worth using -
but you should view "incompatibility with C++" as a disadvantage of such
features, which will weigh against its use.
I think there are piles and piles of C code that will never go near a
C++ compiler. I would weigh as close zero as possible the disadvantage
of using 'mutable' as a variable name in some C libraries. Let's not
forget that there is also harm in terms time and effort when a C
programmer is always looking over their shoulder at C++.
<snip yet more points of agreement>