Profile

Cover photo
hisao m
Lives in Japan
1,231,067 views
AboutPostsPhotosYouTube

Stream

hisao m

Shared publicly  - 
1
Add a comment...

hisao m

Shared publicly  - 
1
Add a comment...

hisao m

Shared publicly  - 
1
Dios Todopoderoso's profile photo
 
mysql?
Add a comment...

hisao m

Discussion  - 
 
 
It drives me nuts when people initialize objects with null.
For example:
SomeClass someObject = null;
What is your opinion about this?
Is there any reason to initialize with null?
2
1
Sihle Manqele's profile photoshashi kiran's profile photo
 
Nulls must be abolished completely in OO languages. See this: http://www.yegor256.com/2014/05/13/why-null-is-bad.html
Add a comment...

hisao m

Discussion  - 
 
 
It drives me nuts when people initialize objects with null.
For example:
SomeClass someObject = null;
What is your opinion about this?
Is there any reason to initialize with null?
1
Jens Hohl's profile photoMichał Kłeczek's profile photoMike Ayers's profile photoBrooks Hagenow's profile photo
9 comments
 
It doesn't do any harm for member variables. Like calling super() in a constructor. Whether you code it or not it happens if you are not calling any other super constructors. You are just being verbose if you type it.

I am assuming you meant member variables but if you mean local variables, there are plenty of examples where you need to initialize to null explicitly if you can't immediately initialize to anything else. Which then you might initialize member variables to null explicitly just for consistency.
Add a comment...

hisao m

Discussion  - 
 
 
It drives me nuts when people initialize objects with null.
For example:
SomeClass someObject = null;
What is your opinion about this?
Is there any reason to initialize with null?
1
Add a comment...

hisao m

Shared publicly  - 
1
Add a comment...

hisao m

Shared publicly  - 
1
Add a comment...

hisao m

Shared publicly  - 
1
Add a comment...
 
 
It drives me nuts when people initialize objects with null.
For example:
SomeClass someObject = null;
What is your opinion about this?
Is there any reason to initialize with null?
2
Nagesh C's profile photoPietro Palladino's profile photoAryak Pande's profile photo
3 comments
 
well it doesnt realy make sense but its not THAT ridiculous
Add a comment...

hisao m

Discussion  - 
 
 
It drives me nuts when people initialize objects with null.
For example:
SomeClass someObject = null;
What is your opinion about this?
Is there any reason to initialize with null?
1
wally thurston's profile photo
 
i am a c programmer by heart -- if not init to null then not sure what you have.  I am not 100% sure about java functions, but I would rather be save than sorry.
Add a comment...

hisao m

Discuss  - 
 
 
It drives me nuts when people initialize objects with null.
For example:
SomeClass someObject = null;
What is your opinion about this?
Is there any reason to initialize with null?
3
Christian Smolka's profile photo
 
There is only one good reason to do so: when you want explicitly say that at the beginning of the computation the value is null. This might be more readable to unexperienced programmers in terms of self speeking code. But to be honest, the most time I saw this it was either a lack of design or knowledge.
Add a comment...
Story
Tagline
Brasileiro no Japão. Brazilian in Japan.日本に住んでいるブラジル人です。
Basic Information
Gender
Male
Places
Map of the places this user has livedMap of the places this user has livedMap of the places this user has lived
Currently
Japan
Previously
Brazil