Quick style question... I'm doing a code review fo...
# announcements
c
Quick style question... I'm doing a code review for a friend. For a const value, why might I prefer a top-level property vs. putting that same property inside a named object? I think the latter seems stylistically better in terms of code management, but I want to hear what others think.
y
IMPO it depends on how many these consts you have and how they are related to each other and to a class itself. Named objects are more applicable if we have a group of related constants.
👍 1
s
For private constants I prefer top level for no other reason thats its simpler. Public constants I prefer to keep scoped in ie. a companion or named object as you mention
👍 2