code-smell

Effect of refactoring on program speed

As a programmer I use to follow TDD, beginning by writing a simple version of my code then heavily refactoring it. When refactoring I usually just listen to my code. I search for bad smells and then refactor the code to remove smells. Typically I will introduce new methods to avoid repeating code, move class members around to put them ne...

Does this code smell?

Please educate me if I have code smell (violating SOLID principles, etc) Also how can I make use of IoC to make dependency injection better? Any help, tips, feedback is REALLY appreciated :) EDIT: Should all dependencies be injected from the constructor in the form of strings or should they be interfaces, if possible? For example, Logi...

Is Type Checking a Code Smell in this code?

I have an interface "IPartyCountService" that counts number of customers and number of suppliers. The implementation class "PartyCountService" makes use of type checking to check whether the party is a Customer or a Supplier. My question is: does the implementation class PartyCountService's use of type checking give out code smell? Ple...

Is it bad to use Reflection in production code?

I've got a Validator class which creates an instance of a Validations class, which contains all the validation methods. When a validation is performed, __call in Validator is used to dispatch a call Validator->validate_method to Validations->method. So for instance, there is a method in Validations called length_of. When the following c...

Name for factoring out repeated code into separate function

I'm trying to find research/advice on a particular code refactoring pattern, but I'm finding it hard to locate, since I'm not sure whether there's a good name for it. It's very similar to factoring out repeated code, except the code wasn't repeated in the first place: it was just stashed away in a conditional branch of a larger function...