Thursday, January 1, 2015

My naming convention

I developed it because it really helps. To me, this is the ergonomics of coding. But, I have yet to demonstrate the same good results in other people's projects ...

A non-comprehensive non-formal guide:

[functions inside class/struct/namespace]
f- mutator, non-static, trivial
u- mutator, non-static, non-trivial*
g- accessor, non-static, trivial
k- accessor, non-static, non-trivial
s- mutator, static, trivial
w- mutator, static, non-trivial
q- accessor, static, trivial
x- accessor, static, non-trivial

*(requires calculation, might cause side-effect (such as (but not limited to - ) change of other member variables, change of global variables)

[functions outside class/struct/namespace] (Notice that it is virtually symmetrical with the ones above)
_f_- mutator, non-static, trivial
_u_- mutator, non-static, non-trivial
_g_- accessor, non-static, trivial
_k_- accessor, non-static, non-trivial
_s_- mutator, static, trivial
_w_- mutator, static, non-trivial
_q_- accessor, static, trivial
_x_- accessor, static, non-trivial

p- - parameter
l- - local variable 
-b- - of boolean type
-c- - a threaded function, which runs asynchronously
o_- - macro
_h- - throws exception

m- - member, non-static
n- - member, static
c- - member, const, static
t- - type
-t- - template
tu- - type, union
tv- - type, polymorphic
ta- - type, empty, non-instantiatable, used as an interface
-r- - recursive (calls itself)

[Computer graphics]
to- - type, polymorphic, tangible instantiatable object, obeys engine's physics
th- - type, polymorphic, intangible instantiatable object, defies engine's physics
tk- - type, component, not polymorphic

[Data type]
t1u - 1 byte, unsigned integer
t1s - 1 byte, signed integer
t2u - 2 bytes, unsigned integer
t2s - 2 bytes, signed integer
t4u - 4 bytes, unsigned integer
t4s - 4 bytes, signed integer
t8u - 8 bytes, unsigned integer
t8s - 8 bytes, signed integer
t4f - 4 bytes, float
t8f - 8 bytes, float
tpu - address, unsigned (size_t)
tps - address, signed (ssize_t)
t1k - 1 byte, character
t2k - 2 bytes, character (char16_t)
t4k - 4 bytes, character (char32_t)
twk - wchar_t
tuk - TCHAR (an ASCII char or wchar_t, depending on user's setting)
tSQ - t1k const*
tUQ - tuk const*

No comments:

Post a Comment