Is it better to make a function small in javascript?

I recently read a book ( CleanCode )

in this book,

FUNCTION SHOULD ONE. THEY SHOULD BE THIS GOOD. THEY SHOULD DO IT ONLY.

and the function should be small.

But I think the function is in javascript.

If I split a large function into small things, the code gets longer, and it takes longer to render.

Is it better to make a function small even in javascript?

what is your opinion

+3
source share
7 answers

Microoptimization is not worth it. Maintaining health is much more important. You can use JavaScript minifier to actually serve the code in the browser .

+7

, , . , , , .

+4

.

. . , - - , , , , .

, , . . , , , , , , .

(, , ) .

+3

" , ". , , , OO proselytizers . ? . , , . , . - - , , .

. , , , , - . (1) , (2), , " ".

+2

, " " ( ) , .

, ( ) , .

+1

Javascript, functions double , , . ginormous, , , /, , .

, ( ) , .

+1

,...

He does not say "do little things," he says "do only one thing" and "a little function."

This does not mean single-line, to do “one good”, it can easily be 10-50 lines and still be short and “single”.

+1
source

Source: https://habr.com/ru/post/1737078/


All Articles