0
votes
3answers
106 views

Long vs short scripts? Big vs small scripts? [closed]

As a programmer, I have always wondered whether it is preferable to write (a) short modular functions that are each stored in their own script (i.e., file) or (b) long comprehensive scripts that ...
2
votes
4answers
321 views

How do you decide what code to put into a function?

I started out with a script that was a few hundred lines. Later, I realized I wanted another script that would require much of the same code. I decided to wrap certain areas of the original script ...
3
votes
2answers
460 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 ...
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 ...
3
votes
5answers
792 views

Functions with side-effects in Delphi/Pascal

What is the proper approach to functions that have side-effects in Delphi/Pascal? For example, I could have a boolean function DeleteFile that returns True if the file was deleted and False ...