Function is a block of code which performs a specific task.
3
votes
2answers
344 views
Setting $_POST variables as a means of passing data / Not passing parameters in functions
I've got a legacy PHP web application wherein almost each and every function makes references to $_POST variables - retrieving their values, AND setting them (or setting new POST variables) as a means ...
8
votes
6answers
2k views
Feature vs. Function
Often I hear PMs (Project Managers) talk about feature and function. And I'm just so puzzled to differentiate them. Sometimes I think of a feature to be equivalent to a user story. Something like "As ...
3
votes
8answers
362 views
Wrapping simple statement in a function in java?
I was working on neo4j graph database in java. To get the reference node of this db:
GraphDatabaseService graphDb=new EmbeddedGraphDatabase(DB_PATH);
Node Root=graphDb.getReferenceNode()
I ...
10
votes
2answers
580 views
Design: Object method vs separate class's method which takes Object as parameter?
For example, is it better to do:
Pdf pdf = new Pdf();
pdf.Print();
or:
Pdf pdf = new Pdf();
PdfPrinter printer = new PdfPrinter();
printer.Print(pdf);
Another example:
Country m = new ...
2
votes
4answers
619 views
Is function memoization really only for primitives?
I was thinking about this for quite some time. Is function memoization really only for primitives?
I currently have this piece of code:
Public Shared Function Mize(Of TArg1 As Structure, ...
5
votes
3answers
635 views
Good use of wrapper functions?
What do you consider good use of wrapper functions? When are they useful abstractions and in what cases harmful and unnecessary complexity?
10
votes
5answers
1k views
Why are PHP function signatures so inconsistent?
I was going through some PHP functions and I could not help notice the following:
<?php
function foo(&$var) { }
foo($a); // $a is "created" and assigned to null
$b = array();
foo($b['b']);
...
4
votes
3answers
684 views
Static methods or static functions?
I was just reading http://stackoverflow.com/questions/155609/what-is-the-difference-between-a-method-and-a-function and all of a sudden, the thing came to my mind was the static methods.
As static ...
11
votes
8answers
2k views
Is there an optimal number of lines of code per function? [closed]
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 ...
3
votes
18answers
946 views
What do you name functions/variables/etc when you can't think of a good name?
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 ...