Better way to access to class attribute