Originally posted by Gerald Davis:
These static methods are called factory methods.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Mohit Sinha:
Hi All
From this forum I gathered that its better to have all object creation code inside static methods.
Cheers, Sathya Srinivasan - SCJP 1.2, SCWCD 1.2, SCMAD 1.0
Co-Author of Whizlabs SCMAD Certification Exam Simulator and SCMAD Exam Guide Book
Co-Author of OCP Java SE 8 Programmer II Exam Guide
Regards,
Pho
Co-Author of OCP Java SE 8 Programmer II Exam Guide
The future is here. It's just not evenly distributed yet. - William Gibson
Sonny Gill LinkedIn
Tweets
Originally posted by Pradeep Bhat:
Isn't Fatory method pattern a creational pattern? :roll:
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Co-Author of OCP Java SE 8 Programmer II Exam Guide
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Originally posted by Stan James:
but how do you know when it's safe to hardcode class creation and when it might be useful to substitute a subclass or a family of subclasses later?
Cheers, Sathya Srinivasan - SCJP 1.2, SCWCD 1.2, SCMAD 1.0
Co-Author of Whizlabs SCMAD Certification Exam Simulator and SCMAD Exam Guide Book
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |