メソッドが必要とする可能性のあるすべてのプロパティを持つジェネリックオブジェクトを、メソッドが必要とするものを明示的に宣言するのではなく、アンチパターンの名前とは何ですか?このアンチパターンの名前は何ですか?メソッドシグネチャは嘘つきです
例:
public class BaseRequest
{
User user;
Car car;
CustomerRecords customerRecords;
Folder folder;
// ... etc for 10 - 20 other unrelated parameters
}
public void doSomething(BaseRequest request)
{
User user = request.getUser();
// do stuff with user, ignore all other attributes of request
}
代わりの
public void doSomething(User user)
{
// do stuff with user, since it's nice and clear what we want
}
注 - 私はBaseRequest
に違反シングル責任Princpleに言及していませんよ。代わりに、メソッドのシグネチャがその依存関係について「横たわっている」反パターンの名前を探しています。
また、私が誰かを指すことができるこのパターンの邪悪を簡潔に説明する良いブログ記事がありますか?
創造のすべてのダムが「アンチパターン」として改革されたと確信しているのはなぜですか? – bmargulies
これは@bmarguliesです。 – Bozho