Re: [smartweb-devel] Static sign on auth module less understandable
Brought to you by:
rlogiacco
From: Roberto Lo G. <rlo...@sm...> - 2007-11-14 19:56:41
|
2007/11/14, Gaetano Perrone <gpe...@sm...>: > > I disagree to your sentence > > "the following is the easyest thing boolean loggedin = !User.isGuest();" > > becuase it presumes u uses the auth module to know that this static method > works with the current method executing user. > If anyone retrieves a User object instance why he must ask to a static > method if this User instance is Guest and not simply to the object ifself. > And thermore why i must ask statically something that changes dinamically??? > I'm so confused...as new deveoper approching smartweb framework... > > User user= ....retrieve a User instance... > boolean logged = user.isGuest(); I think you are having the same problem many people has with ThreadLocal concepts. In brief: you are "statically" accessing something stored into the current thread, which is usually thought as "dynamc" but we are talking about two different things as objects are stored into the heap and you are accessing something stored into the stack. So "static" and "dynamic" are non-sense while mixing up two different scopes. Anyway I understand your worries and I had the same problems in the first place, but here we are simply copying the same approach used inside the core Java libraries to make everything easier to understand. I suggest to write down documentation instead to refactor as the problem seems to be on understatement and not on interface fringment or rigidity. |