Make defensive copies
Upcoming SlideShare
Loading in...5
×
 

Make defensive copies

on

  • 529 views

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

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

Statistics

Views

Total Views
529
Views on SlideShare
518
Embed Views
11

Actions

Likes
0
Downloads
0
Comments
0

1 Embed 11

http://oracleidc.diycomputerscience.com 11

Accessibility

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Make defensive copies Make defensive copies Presentation Transcript

  • 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 invariants of an object
  • 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