I have a lot of code like this
var o = new SomeClass().DoSomething(someParam);
Is this a design flaw ?
This class is some kind of a builder class.It should contruct other object.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you don’t need the instance after calling the method, you probably better with a static method on
SomeClassand ends up withand if for any reason, you absolutely need a new instance to execute
DoSomethingthen you could create a static factory method to make the code more readable like :