Avishkar Nikale wrote:Can we say that a method objective should dictate the same?
1) Lets say a factory class depending on various conditions creates a object
& assigns it to the return reference.
The return statement usually is at the end of the method.
2) If it is a execution of a business process it might make more sense to return if the
process cannot continue further.
? ? ?
Rob Prime wrote:I generally disagree with using only one exit point. However, I also agree in adapting to the project style. If that style is one exit point I would force myself to adapt.
Rob Prime wrote:As Robert C.Martin would say clean code reads like well-written prose.
Paul Clapham wrote:...However if you use a StringBuilder instead of a String to combine the parts, you will find it has an append() method which is perfect for the parameters of the characters() method. It would be better to do it that way.