Parameters are important for any non trivial program, to help make it generic and data driven. Parameters are usually function arguments but can also be part of the configuration.
0
votes
1answer
182 views
How to encapsulate method parameters in Java?
An HTTP query can be parametrized to a list of pairs like name=value that can be encapsulated in general as Map<String, String> since an HTTP GET query is string pairs. I could need something ...
0
votes
0answers
12 views
Common practice to transfer named parameters in Tcl
Using Tcl8.5, what is the common practice to transfer named variables to a proc/method?
Something that will be similar to defining the class members when instantiating a class object [incr Tcl].
...
1
vote
2answers
192 views
How to deliver 3 different parameters to class in one method (2 of 3 are optional)
I need your help how to implement it nice and well. It's quite a simple problem. I can solve it but I need help on how to do that better.
My class has logic working using three parameters. It gets ...
3
votes
2answers
114 views
Inform caller or just let them deal with exception?
I'm not sure how to proceed in the following situation.
say we have a function as so:
def runsATask(codes):
myDicts = [helperFunc(code) for code in codes]
for item in myDicts:
# some ...
14
votes
3answers
431 views
Why not annotate function parameters?
To make this question answerable, let's assume that the cost of ambiguity in the mind of a programmer is much more expensive then a few extra keystrokes.
Given that, why would I allow my teammates to ...
0
votes
4answers
122 views
Understanding parameters
I have read this statement:
"A parameter is used as a sort of temporary messenger, carrying data originating from outside the constructor or method and making it available inside it."
So, does that ...
3
votes
3answers
552 views
Is it better to have constructors with or without parameters?
Is it better to have constructors with or without parameters and why?
public NewClass( String a, String b, int c) throws IOException
{
//something
}
OR
public NewClass()
{
//something
}
...
2
votes
2answers
651 views
Ruby - when to use instance variables vs parameters between methods?
I'm writing several methods that call other methods.
To pass the information I have a couple of choices:
Pass the information as parameters
Set instance variables so that other methods can access ...
8
votes
5answers
1k views
Multiple arguments in function call vs single array
I have a function that takes in a set of parameters, then applies to them as conditions to an SQL query. However, while I favored a single argument array containing the conditions themselves:
...
2
votes
1answer
234 views
Best practices for refactoring parameter file structure in multiple environments
Background info and what I've tried
Within each of two mostly distinct environments, say 'Research' and 'Production', there is a need for a structured parameter file. The file contains things like ...
4
votes
6answers
286 views
Fields vs method arguments [closed]
I just started writing some new class and it occurred to me that I was adding a lot of method arguments that are not strictly needed. This is following a habit to avoid having state in classes that is ...
0
votes
2answers
133 views
Factory for arrays of objects in python
Ok, the title might be a little misleading.
I have a Window class that draws widgets inside itself in the constructor. The widgets are all of the same type.
So I pass a list of dictionaries, which ...
4
votes
8answers
496 views
Passing an object into a method which changes the object, is it a common (anti-) pattern?
I am reading about common code smells in Martin Fowler's Refactoring book. In that context, I was wondering about a pattern I am seeing in a code base, and wether one could objectively consider it an ...
0
votes
2answers
233 views
UML representation of type being passed as a parameter
I want to draw a UML diagram of my program. Class Barney has a method Yabadaba(Doo d) which takes a parameter of type Doo.
How do I represent that class Doo is used in class Barney in my UML diagram?
...
0
votes
1answer
102 views
Overloading to support multiple related types (especially pointers)
Problem
I was just trying to debug a set of file-manipulation routines I wrote for a program I am working on. One of them kept returning an INVALID_HANDLE error.
Explanation
I figured out what the ...
0
votes
1answer
119 views
Generic params table design
We have a generic parameter table whose important attributes are :
id number auto increment not null
domain varchar (200) not null
classification varchar (200) not null
param_name varchar (200) not ...