The methods tag has no wiki summary.
3
votes
1answer
118 views
Better use on the name of variables
I have a method that looks like this:
Public Function NormalizeStreetAddress(country As Namespace.Country,
streetAddress As Namespace.StreetAddress) _
...
4
votes
5answers
167 views
Group method parameter or individual parameter?
I would like to ask on method parameters design consideration. I am usually deciding between using individual variables as parameters versus grouping them to a class or dictionary as one parameter.
...
4
votes
3answers
101 views
Using “prevent execution of method” flags
First of all I want to point out my concern with some pseudocode (I think you'll understand better)
Assume you have a global debug flag, or class variable named "debug",
class a :
var debug = ...
2
votes
3answers
169 views
Should a method do one thing and be good at it?
"Extract Till You Drop" is someting I've read in Uncle Bob's blog, meaning that a method should do one thing alone be good at it.
What is that one thing? When should you stop extracting methods?
...
19
votes
4answers
681 views
What is the difference between a function and a lambda?
I'm a little bit confused about 'function' and 'lambda'. I've seen some examples showing that the scheme keyword lambda works very similarly to the JavaScript keyword function, but I really don't ...
4
votes
11answers
339 views
Which is better programming convention in Java for methods? [closed]
If I had this program:
public class heartPrint {
public static void drawHeart() {
System.out.println(" _ _");
System.out.println("/ \\/ \\");
System.out.println("\\ /");
...
7
votes
4answers
341 views
Which popular object-oriented languages support readonly methods?
I thought that many object-oriented languages have a reserved keyword for methods which do not modify the state of an object. These methods often have names that start with get. AFAIK a "getter" is ...
4
votes
1answer
551 views
What's the difference between static and dynamic binding? [closed]
We are learning about methods in class, and I am having trouble especially with the concept of static vs. dynamic.
Wikipedia says this:
Methods can be bound to a class at compile time (static ...
4
votes
5answers
192 views
Prefer class members or passing arguments between internal methods?
Suppose within the private portion of a class there is a value which is utilized by multiple private methods. Do people prefer having this defined as a member variable for the class or passing it as ...
5
votes
5answers
232 views
Is it good or bad form to name a function after the workaround it fixes?
Lets say you have to write some code to fix a bug that on first glance by another engineer would seem weird or unnecessary.
Would it be good or bad form to put the code in a method named for example ...
2
votes
7answers
361 views
Pass in single settings object vs multiple setter methods?
Working with C++. Suppose I have a class BoxFilter. The class is used to filter boxes which have properties such as height, width, depth, weight, etc. The filter might have something like MaxWidth ...
41
votes
6answers
2k views
Refactoring into lots of methods - is this considered clean or not?
So, I watched as my colleague complained a bit about a project he has inherited from someone who is, shall we say, not very experienced as a programmer (intern left to his own devices on a project).
...
10
votes
4answers
334 views
Where does “method” as a special term in OOP originate?
"Method" is a special term in Object-Oriented Programming. Does anyone know when the word began to be used in this particular sense, and in connection with what programming language or other branch of ...
2
votes
5answers
183 views
Sending Whole Data Object As Argument Or Just Required Fields?
Let's say I have a class that just stores data:
ClassData
Field1
Field2
Field3
Now let's say I have a function that uses Field1 and Field2:
public void DoStuff(string field1, string ...
4
votes
3answers
164 views
Does the single responsibility principal promote flexibility?
Does the single responsibility principal promote flexibility? If not what are the other methods to make your classes more flexible?
By flexibility I mean, a class is able to function correctly at any ...