jeudi 21 septembre 2023

What would be the correct naming for a method that creates and returns an object?

I have a SectionBuilder class that creates a Section as follows

public class SectionBuilder {
    public static func make(…) -> Section {
        return Section(…)
    }
}

Since the class name is Builder, should I rename the make() method to build()?

I didn’t want to do so since that’s not actually a builder that has other methods to set values.

What do you guys think?

Aucun commentaire:

Enregistrer un commentaire