What Name for This Method?

Table of Contents

What Name for This Method?

public class OptionsAwareObject {  
    private Options options;  
      
    public void updateOptions(String fontName, int fontSize) {  
       options.setFontName(fontName);  
       options.setFontSize(fontSize);  
    }  
}  
   
class Options {  
    private int foregroundColor;  
    private int backgroundColor;  
    private String fontName;  
    private int fontSize;  
    // ...
}

Is updateOptions a good name for this method? Of course not! updateOptions is a general name that suggests a comprehensive update of options. Meanwhile, we are only updating font-related information. The responsibility of the method is thus the change of font-related options. A better name would be:

public void updateFontOptions(String fontName, int fontSize) {  //...

(Text translated and moved from original old blog automatically by AI. May contain inaccuracies.)

Related Posts

The Scrum You Don't Know

But we don’t have a Product Owner! The Product Owner is unavailable! We are working on several projects at the same time! Our deadlines are getting delayed. Testers do not have time to test our code.

Read More

Why I Hate These Standups...

Why I Hate These Standups…

I often hear it… that they are a waste of time, just distractions from work, adding no real value…

Read More

Simple, Complicated, Complex and Chaotic Systems, in Other Words Cynefin. And How Does It Relate to Software Development?

Intro

You might have already come across terms such as complex systems, complicated systems, or complex adaptive systems; especially, if you have read Management 3.0 by Jurgen Appelo or heard about Ken Schwaber’s ideas about the applicability of Scrum. It might sound intriguing, but finding logic in it is difficult without some background theory. This is the point at which Dave Snowden’s Cynefin concept comes in handy. This concept is based on complex systems theory, anthropology, evolutionary psychology, and, last but not least, cognitive psychology.

Read More