Is it OK to split long functions and methods into smaller ones even though they won't be called by anything else? [duplicate]
Lately I've been trying to split long methods into several short ones. For example: I have a process_url() function which splits URLs into components and then assigns them to some objects via their ...
Consider a parameterless (edit: not necessarily) function that performs a single line of code, and is called only once in the program (though it is not impossible that it'll be needed again in the ...
I am working on a C++ project where I have a bunch of math functions that I initially wrote to use as part of a class. As I've been writing more code, though, I've realized I need these math functions ...
I've noticed a few functions I work with have 6 or more parameters, whereas in most libraries I use it is rare to find a function that takes more than 3. Often a lot of these extra parameters are ...
When you are defining a function/variable/etc and are not sure what to name it, what do you name it? How do you come up with a name? If you use a temporary name as a place-card until you give it it's ...
I've seen an increasing trend in the programming world saying that it is good practice to separate code blocks into their own functions. Obviously, if that code block is reusable, you should do that. ...
Functions are not only used to minimize duplication of code - they are also used to split up a long function into smaller ones to increase readability, as well as making the code self-commenting. Yet ...
Say I have the following graph of dependencies between procedures/functions/methods: o / \ v e / \ / \ r f l w That is, function o first calls function v, and then ...
Which code is better: // C++ void handle_message(...some input parameters..., bool& wasHandled) void set_some_value(int newValue, int* oldValue = nullptr) // C# void handle_message(...some ...