flash - Is using a global user variable a bad practice? -
i need have access logged in user troughout flash application. therefor i'm concidering making 'user' variable global.
i try avoid global variables, seems quite suitable in case , i'm not first concider active user global. know systems drupal uses global variable logged in user.
i want know if stackoverflow thinks of bad practice or if there better alternatives.
if use global variable, creating dependency on variable in modules use it. so, example, if wanted reuse of modules in project, need take use of global variable account.
having said that, don't particularly find bad design have global variable user-id. if wanted reuse of modules use it, want deal users anyways, , have global variable in new application too.
there dependency-injection frameworks solve you. whether add value specific project or not depends on many other considerations, , you.
Comments
Post a Comment