The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
1answer
172 views

Static and not-static: programmer quantum theory

Let me illustrate using the PHP language. The discussion here is, how should I do exactly to solve this problem in a clear and unambiguous mode. Imagine that I have a class called Path. This class is ...
17
votes
12answers
3k views

Is method overloading anything more than syntactic sugar? [closed]

Is method overloading a type of polymorphism? To me it seems like simply the differentiation of methods with the same name and different parameters. So stuff(Thing t) and stuff(Thing t, int n) are ...
5
votes
3answers
423 views

Overloading methods that do logically different things, does this break any major principles?

This is something that's been bugging me for a bit now. In some cases you see code that is a series of overloads, but when you look at the actual implementation you realize they do logically different ...
-1
votes
2answers
150 views

what's the point of method overloading? [duplicate]

I am following a textbook in which I have just come across method overloading. It briefly described method overloading as: when the same method name is used with different parameters its called method ...
3
votes
1answer
139 views

Different scoring algorithms for different competition elements

I am creating a scoring system for a competition that is somewhat obscure, but it resembles the Olympics in terms of its high-level structure. Therefore, I will ask my question in terms of an ...
0
votes
3answers
211 views

Overloading Methods With Different Behavior - Style

I have a style question about overloading methods/constructors. I have a constructor which does something very simple, and then calls a method with some side effects. Sometimes however I don't want ...
0
votes
3answers
293 views

When should method overloads be refactored?

When should code that looks like: DoThing(string foo, string bar); DoThing(string foo, string bar, int baz, bool qux); ... DoThing(string foo, string bar, int baz, bool qux, string more, string ...
1
vote
1answer
175 views

Compiler design decision for dynamic method invocation

I asked about Compiler interpretation of overriding vs overloading on StackOverflow, and got good answers, but this led me to another question that I'm not sure is appropriate for SO, but I think is ...
2
votes
1answer
581 views

Javadoc for a static “overloaded” method

My problem is the following: I have an interface that requires its implementations to implement a static method, namely void load(). However, until Java 8, it seems we won't get static methods in ...
1
vote
3answers
1k views

Is function overloading in general considered Evil? [closed]

Recently I found about two new programming languages(Vala and google's GO) which don't support method or function overloading and intend on not supporting them in the future ever! The creators of ...
7
votes
4answers
368 views

How to prevent duplicate data access methods that retrieve similar data?

In almost every project I work on with a team, the same problem seems to creep in. Someone writes UI code that needs data and writes a data access method: AssetDto GetAssetById(int assetId) A week ...
11
votes
2answers
15k views

Why PHP doesn't support function overloading?

I am wondering if one of the key features of a programming language is to have the ability to overload functions via arguments. I think it is essential in-context of the Object oriented programming. ...
7
votes
2answers
410 views

Overload or Optional Parameters

When I have a function that might, or might not receive a certain parameter, is it better to overload the function, or to add optional args? If each one has it's ups and downs - when would I use ...
8
votes
3answers
351 views

does one method overload an other, or are both methods “overloaded”

If i create this method public void foo() And then i create an overloaded version like this public void foo( string bar ) Do we say that the second functions overloads the first, or are both ...
12
votes
1answer
843 views

Why is there no facility to overload static properties in PHP?

Intro PHP allows you to overload method calls and property accesses by declaring magic methods in classes. This enables code such as: class Foo { public function __get($name) { return 42; } } ...
6
votes
3answers
3k views

When is method overloading appropriate?

Suppose I am working on an existing, reasonably large system. I have an object, myObject of class MyClass (for the example's sake, suppose I'm working in Java). myObject is a composition containing a ...
10
votes
4answers
733 views

Should we rename overloaded methods?

Assume an interface containing these methods : Car find(long id); List<Car> find(String model); Is it better to rename them like this? Car findById(long id); List findByModel(String ...
3
votes
6answers
2k views

How to resolve methods with the same name and parameter types?

In many cases, I want to write methods that have the same functionality for different types of inputs. This is easily accomplished by method overloading if the parameter types are different. But ...