DEV Community

Discussion on: JavaScript Clean Code — Name and Test Heuristics

Collapse
 
tsdmrfth profile image
Fatih Taşdemir

I don't agree with you in some points. In clean code practices a function can be a command or a query. A query function can only query for data and return it. It can not change the application state and a command function can only change state. By this way a reader can guess what the function does exactly. There is also another good rule which says "A function should do only one thing." (setFooIfNotExistAndGetFoo)