Re: attack of silly coding standard?
On Dec 6, 4:41 pm, Leigh Johnston <le...@i42.co.uk> wrote:
On 06/12/2010 16:33, James Kanze wrote:
On Dec 5, 2:35 pm, Leigh Johnston<le...@i42.co.uk> wrote:
On 05/12/2010 14:08, Daniel T. wrote:
[...]
RAII has everything to do with this rule as RAII makes old fashioned
SESE redundant.
How? SESE has nothing to do with managing resources: it's
a rule to simplify analysis of program logic, in order to ensure
program correctness.
SESE is commonly used to ensure any resources allocated in the function
are deallocated in one place; it is an easy mistake to omit freeing a
resource if a function has many returns; however, RAII ensures that
resources are freed irrespective of number of returns or if an exception
is thrown. RAII makes SESE redundant and SEME common in modern C++
designs.
SESE is commonly used in functions which don't allocate any
resources as well. That the resources are freed can be
considered as just one more post-condition that has to be
maintained. In the code I work on, we do have other
post-conditions (that the return value is correct, for example),
and SESE helps make them more easily verifiable.
RAII involves destructors and destructors are arguably
part of C++ OOP.
That's an original definition of OOP. In *every* definition
of OOP I've seen, polymorphism is an essential aspect. RAII
does not require polymorphism, and in most cases, makes no use
of polymorphism. (But of course, OOP has become such a wide
spread buzz word, it's hard to know what it really means.)
It is a bullshit position to say that constructors and destructors
(which RAII utilizes) has nothing to do with *C++* OOP.
Then I guess people like Booch are just spouting bullshit. I'd
suggest that you learn what OO means before trying to explain it
to other people.
--
James Kanze