0
Make Defensive Copies           Parag Shah http://www.diycomputerscience.com
Even though Java is a safe language, it is stillpossible for programmers to make safe mistakes     and destroy the invaria...
When to not make defensiveWhen a collaborator is doing an explicit hand-off of the object in the constructorWhen it is ver...
Make defensive copies
Make defensive copies
Make defensive copies
Make defensive copies
Make defensive copies
Upcoming SlideShare
Loading in...5
×

Make defensive copies

368

Published on

This presentation explains why and how we should make defensive copies of method parameters in Java.

Published in: Technology, News & Politics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
368
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Make defensive copies"

  1. 1. Make Defensive Copies Parag Shah http://www.diycomputerscience.com
  2. 2. Even though Java is a safe language, it is stillpossible for programmers to make safe mistakes and destroy the invariants of an object
  3. 3. When to not make defensiveWhen a collaborator is doing an explicit hand-off of the object in the constructorWhen it is very expensive to make copiesModel objects... eg: Hibernate pojos
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

Ă—