Talk:Blogs:JaroslavTulach:Practical Design:FixModifiers

From APIDesign

(Difference between revisions)
Jump to: navigation, search
(Comment provided by Somo - via ArticleComments extension)
Line 26: Line 26:
--Somo 11:42, 26 March 2009 (CET)
--Somo 11:42, 26 March 2009 (CET)
 +
 +
Find "toolbox" and click "black on white". Or, if you want the selection to persist, create an account, log in and change your preferred skin.
 +
 +
--[[User:JaroslavTulach|JaroslavTulach]] 13:41, 26 March 2009 (UTC)
 +
</div>
</div>

Revision as of 13:41, 26 March 2009

Comments on Blogs:JaroslavTulach:Practical Design:FixModifiers <comments />


Ezward said ...

How about access modifiers for function arguments. Java is a pass-by-reference language. Therefore, anything I pass in may be modified by function I am calling. Also, the reference may be null. I would like a modifier that specifies that an argument may not be null. I would also like a modifier that specifies that an argument is read-only: it may not be modified.

--Ezward 02:05, 26 March 2009 (CET)

Thanks for your comment. The rules for function arguments would be slightly different than for method visibility.

As concern the check for null, I know JSR 305: Annotations for Software Defect Detection is about to provide ways to annotate parameters with @NotNull. NetBeans project is already using it, as I noted in TheYearOfAnnotations2009.

As the immutability goes: Java does not have the C++ const keyword which de-facto switches between two states each object can have (mutable and immutable). To achieve this in Java one needs to split the concerns into two classes. One serving as mutable handle to internal data, one as read-only facade to it.

This is interesting topic. I slightly touched it in the book's Chapter 7, Give the Creator of an Object More Rights, but I guess I shall expand the topic on the website once. Thanks for inspiration.

--JaroslavTulach 05:13, 26 March 2009 (UTC)

Somo said ...

If we are at "clarity", how about using a background/foreground color combination that makes your text easier to read? (my eyes hurt already after trying to read just a few seconds :) ).

--Somo 11:42, 26 March 2009 (CET)

Find "toolbox" and click "black on white". Or, if you want the selection to persist, create an account, log in and change your preferred skin.

--JaroslavTulach 13:41, 26 March 2009 (UTC)

Personal tools
buy