Jay Pipes wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
Are we committed to our published naming convention of the following?
http://drizzle.org/wiki/Coding_Standards#Naming_Style
"Bools should be named "is_something" or "has_something". "
I have never understood why you need the "is_" or "has_" prefix on the
booelans.
"if (committed)" is just as good as (or better than) "if (is_committed)"
and saves you a few characters of typing...
Apart from that, I learnt FORTRAN and Pascal before C/C++ so I never
write "if (A)" if A is an integer or a pointer :)
Thanks,
Roy
"Methods should begin with a lower case verb explaining the action.
"foo.setBar()" or "foo.replaceString()". "
Let's stick to this if it's what we want to be consistent on...
As a case-in-point, here is the recently converted-to-class Replicator
plugin:
class Replicator
{
private:
bool enabled;
protected:
virtual bool session_init_hook(Session *) { return false; }
virtual bool row_insert_hook(Session *, Table *) { return false; }
virtual bool row_update_hook(Session *, Table *,
const unsigned char *,
const unsigned char *) { return false; }
virtual bool row_delete_hook(Session *, Table *) { return false; }
virtual bool end_transaction_hook(Session *, bool, bool) { return false; }
virtual bool statement_hook(Session *, const char *, size_t) { return
false; }
<snip>
};
If we are sticking to our own naming convention, shouldn't the above be:
class Replicator
{
private:
bool is_enabled;
protected:
virtual bool onSessionInit(Session *) { return false; }
virtual bool onRowInsert(Session *, Table *) { return false; }
virtual bool onRowUpdate(Session *, Table *,
const unsigned char *,
const unsigned char *) { return false; }
virtual bool onRowDelete(Session *, Table *) { return false; }
virtual bool onEndTransaction(Session *, bool, bool) { return false; }
virtual bool onSendStatement(Session *, const char *, size_t) { return
false; }
<snip>
};
Cheers,
- -jay
p.s. Also, let's make sure we put parameter names along with types....
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAknHrA8ACgkQ2upbWsB4UtHeYwCfTuTLhSa4EAPm6hsNDwVrtkhE
5PwAn13nb/ihrM9nynqhMHPNs08FCoFa
=ESj9
-----END PGP SIGNATURE-----
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help : https://help.launchpad.net/ListHelp
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help : https://help.launchpad.net/ListHelp