Clean Code 笔记(3)Function Structure


Do you know why swith statement casuse such harm to software structure,did you know if statement have same problem.In this episode we are going to talk about how to get rid of most of them, and how to deal with the rest of them.Did you know assagnment staement also harmful.Have you ever seen a function full of error checks ,null checks that you couldn't tell what it was doing.Or how about try catch.


sun metaphor.


How many arguments should a function have.They are hard to read,hard to understand.we should treat them as a liabilty not a asset

Three arguments Max.

as fewer as prossiable. one is ok, two is ok, three is usaully too many. remenber order.why aren't they a object

No boolean arguments

write two function, one for ture , other for false.passing two boolean is even worse,do four things.