Relative Content

Tag Archive for dry

Unit testing and reusing extracted class

Currently I have 3 service classes, they all have a similar pattern, and I need to make a 4th service class which amalgamates the functionality of the other three.

DRY principles vs local-only variable scope in functions (PHP motivated question)

I’m new to programming and in particular new to PHP. I often find that DRY is directly opposed to the principle of keeping variables local in PHP functions. Sometimes I think that it’s easier to violate DRY to be able to readily access large arrays than it is to pass these arrays or their relevant subcomponents as parameters in functions.

How to insert code in a method in a derived class [duplicate]

This question already has an answer here: Derive from a base class but not include a condition in the base class’s method (1 answer) Closed 6 years ago. I have a base class with a method called Update: Start Update Code block 1 (An If statement) Code block 2 (Setting a variable based on the […]