Always make code declarations explicit and consistent to improve readability and maintainability. This includes specifying all property attributes, using const for immutable parameters, and avoiding misleading naming conventions.
Key practices:
Example of explicit property declaration:
// Good - explicit attributes
@property (nonatomic, readwrite, assign) CGFloat flexGrow;
// Avoid - relying on defaults
@property (nonatomic) CGFloat flexGrow;
Example of consistent const usage:
// Good - const parameters
WIN_EXPORT void YGSetExperimentalFeatureEnabled(const YGConfigRef config,
const YGExperimentalFeature feature,
const bool enabled);
// Avoid - missing const
WIN_EXPORT void YGSetExperimentalFeatureEnabled(YGConfigRef config,
YGExperimentalFeature feature,
bool enabled);
This approach reduces ambiguity, makes code intentions clear, and helps prevent accidental modifications while improving overall code consistency.
Enter the URL of a public GitHub repository