Skip to content

Conversation

@HampuCristian
Copy link
Collaborator

No description provided.

@HampuCristian HampuCristian requested a review from radu103 May 12, 2023 19:46
public class CarValidator {

public static Boolean validateCar(Car car) throws CarValidatorException {
validateCarMakerOrModel(car.getMaker(), "maker");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't do that :) 2 different functions maybe with reuse of code from a common private function


public static void validateCarMakerOrModel(String name, String type) throws CarValidatorException {
switch(type){
case "maker":{
Copy link
Owner

@radu103 radu103 May 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the switch you have more lines than having 2 different independent functions. SOLID, S - Single Responsability

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants