0

What are the three reasons for the principle of keeping functions small?

27th Apr 2019, 8:26 PM
Wanangwah
Wanangwah - avatar
8 Answers
+ 6
I like the concept of 'one unit, one task'. Let your function do exactly one clearly defined thing that can be expressed in a telling, shortish function name and doesn't need an overly large interface.
27th Apr 2019, 10:43 PM
HonFu
HonFu - avatar
+ 6
My methods/functions have not much to do: * do something with a value * return it or print it If the method needs a lot of calculations or other stuff then I write a method for the method. I think this keeps the code readable. Diego Lol :D
27th Apr 2019, 10:53 PM
Denise Roßberg
Denise Roßberg - avatar
+ 5
Where is it claimed that it is 3?
27th Apr 2019, 9:08 PM
Jason Mackjoo
Jason Mackjoo - avatar
+ 4
For readability and effectiveness
27th Apr 2019, 8:39 PM
Jason Mackjoo
Jason Mackjoo - avatar
+ 4
Why not four? Why not two?
27th Apr 2019, 9:04 PM
HonFu
HonFu - avatar
+ 3
Why not forty-two?
27th Apr 2019, 9:08 PM
Diego
Diego - avatar
+ 3
Diego, that would with necessity lead to less objections!
27th Apr 2019, 9:09 PM
HonFu
HonFu - avatar
+ 1
Jason, asking for three doesn't mean they are only three, they might be more. To me, it's the same as to say, "Give me five coding languages?" And you know that out of thirteen, you only give five. By the way, the three I can give are, readability, understandability and testability
28th Apr 2019, 6:40 AM
Wanangwah
Wanangwah - avatar