Tagged Questions
6
votes
6answers
457 views
Why do many languages not support named parameters? [closed]
I was just thinking how much easier it would be to read code if, when calling a function, you could write:
doFunction(param1=something, param2=somethingElse);
I can't think of any drawbacks and it ...
0
votes
1answer
69 views
Good practice to use namespace or prefix to indicate what file function is from? [duplicate]
For example, I have the function generate_salt() in encryption.file but the person may not know where generate_salt() is from. Using a namespace like encryption::generate_salt(), or ...
3
votes
2answers
425 views
Programming by Intention, Depth-First or Breadth-First?
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 ...
107
votes
13answers
22k views
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 ...
19
votes
2answers
1k views
Is it a good idea to provide different function signatures that do the same thing?
Here is a C++ class that gets constructed with three values.
class Foo{
//Constructor
Foo(std::string, int, char);
private:
std::string foo;
char bar;
int baz;
};
All of ...