Talk:427 design standard
From CSSEMediaWiki
(Difference between revisions)
m (→Getters and setters) |
|||
Line 11: | Line 11: | ||
:--[[User:Yugan Yugaraja|Yugan]] 06:09, 23 July 2008 (UTC) | :--[[User:Yugan Yugaraja|Yugan]] 06:09, 23 July 2008 (UTC) | ||
− | Agreed, I prefer ''private'' access, One's private bit is private, though it is protected, it is still private. Also, we have agreed to minimize access so private is the most minimum access for one's private bit. --[[User:Johannes Pagwiwoko|Jojo]] 02:48, 30 July 2008 (UTC) | + | Agreed, I prefer ''private'' access to instance variables, One's private bit is private, though it is protected, it is still private. Also, we have agreed to minimize access so private is the most minimum access for one's private bit. --[[User:Johannes Pagwiwoko|Jojo]] 02:48, 30 July 2008 (UTC) |
Revision as of 02:49, 30 July 2008
Added the "Getters and setters" section based on the lecture today. --Yugan 06:09, 23 July 2008 (UTC)
Getters and setters
Here's an alternative set of guidelines our group came up with:
- Always make fields have private access.
- Only write getters and setters as needed.
- External: access to fields using getters and setters.
- Internal: access to fields directly, but only if it's the same object. Use getter and setters if same class, but different objects.
- Getters should be read-only (i.e. Collections should be returned as unmodifiable Collections)
- --Yugan 06:09, 23 July 2008 (UTC)
Agreed, I prefer private access to instance variables, One's private bit is private, though it is protected, it is still private. Also, we have agreed to minimize access so private is the most minimum access for one's private bit. --Jojo 02:48, 30 July 2008 (UTC)