My view is, all methods should be public to make them easy to "unit test".
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
Ilja Preuss wrote:http://c2.com/cgi/wiki$?MethodsShouldBePublic
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
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
Ilja Preuss wrote:
- there is a big difference between a public and a published method: http://martinfowler.com/ieeeSoftware/published.pdf
Ilja Preuss wrote:In my not so humble opinion:
- wanting to test a method directly that is not naturally part of the public API of a class is a smell. Most likely, that method belongs to a different class, where it would naturally be public.
ankur rathi wrote:
Ilja Preuss wrote:In my not so humble opinion:
- wanting to test a method directly that is not naturally part of the public API of a class is a smell. Most likely, that method belongs to a different class, where it would naturally be public.
Do you say that a class will never have private methods which need tests?
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
Max Rahder wrote:(By the way... Obviously, you can't create a jUnit test for a private method.)
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
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |