Something to keep in mind is that code is written once, modified a couple
of times, and read hundreds of times. Legitibilty is everything from a
maintenance perspective.
I've written, oh, close to a million lines of code. Two 4gls, four
relational database systems, a JVM, a search engine, a template driver page
generator, a non-relational database, and a lot of other smaller stuff.
I've had dozens and dozens of people working on the code at various times.
Not once, that I'm aware of, has anyone committed a bug related on a
single line sub-block without braces.
MySQL, on the other hand, used K&R (unbalanced) braces, which are indeed
death if not used consistently. When Ann and I joined MySQL, version 6 was
in beta. When we left, version 6 was still in beta. They had fixed
several times more bugs that they started with and still had many more
outstanding bugs that they started with.
I analyzed one particular function, the primary select loop. It had 700 or
800 lines, 56 gotos, 90 odd conditions up to three or four levels, and not
a single blank line. I didn't look, but I would guess it had been modified
serveral hundred times, most, probably, to fix erroneous changes.
Clean code is legible, easy to understand, and easy and safe to change.
Blindly applying rules that evolved to address faults in the K&R coding
style willl not address any problems, make the actual control flow more
difficult to follow, and increase the likelihoom that some well meaning
soul will make a change without fully understanding the intent of the
existing code.
I've expressed the opinion before that I consider 3/4 of "computer science"
to be group thinks of lemmings following each other. The K&R coding style,
now nearly universal thanks to the Java guys, is indeed deadly dangerous.
It should have been re-thought years ago in light of the huge amount of
unmaintainable code that it has produced.
I'm not coding on Firebird, so do anything you like (as if anyone would do
anything else). But there is more to learn about coding styles from
experience than popular culture.
On Tuesday, September 2, 2014, Mark Rotteveel <m...@lawinegevaar.nl> wrote:
> On Tue, 02 Sep 2014 16:11:43 +0100, Lester Caine <les...@lsces.co.uk
> <javascript:;>>
> wrote:
> > On 02/09/14 16:00, Mark Rotteveel wrote:
> >> Braces around single statements would have made this bug less likely.
> > Have made many bugs less likely ...
> > It's not 'dangerous' just a little more error prone.
> > My IDE code completion is set to add the braces on every language.
>
> In my opinion things that make bugs more likely qualify as 'dangerous' (or
> maybe 'risky'). Not dangerous as in life threatening though (although
> https://en.wikipedia.org/wiki/Therac-25 is a fine example of how software
> bugs can be really dangerous).
>
> Mark
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/
> Firebird-Devel mailing list, web interface at
> https://lists.sourceforge.net/lists/listinfo/firebird-devel
>
--
Jim Starkey
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel