Re: [smartweb-devel] Static sign on auth module less understandable
Brought to you by:
rlogiacco
From: Roberto Lo G. <rlo...@sm...> - 2007-11-14 12:51:29
|
2007/11/14, Gaetano Perrone <gpe...@sm...>: > I'm doubtful about the static isGuest() method in User class: > In my opinion a more elegant solution is a not static method declaration: > > User user = User.get(); > boolean loggedin =!user.isGuest(); > I'm waiting for your opinion... I think an additional non-static method could be added but I don't see the need for it: if you want to know if a user is a guest you could simply boolean loggedin = (User.get() != User.GUEST); but in my honest opinion the following is the easyest thing boolean loggedin = !User.isGuest(); as this form shortens the statement a lot and is a bit less error prone |