Category : single-responsibility-principle

When reading from a file, I save the read in as a dictionary like this: with open(‘StudentsPerformance.csv’, ‘r’) as file: read_csv = csv.DictReader(file) # Find the minimum math score min_math_score = 0 for row in read_csv: math_score = int(row[‘math score’]) if math_score < min_math_score: min_math_score = math_score But I would like to iterate through the ..

Read more

I am not good at naming, I good at feeling. Suppose we have this hypothetical function: function computePowerAndPrintResult(int x){ print(x*x); } It screams already in the naming of the function ("And") that something wrong here and personally I never write code like this. Which principle is being violated here? Is it the single-responsibility principle? Source: ..

Read more