DEV Community

Discussion on: Code Smell 68 - Getters

Collapse
 
jayjeckel profile image
Jay Jeckel

Method names should start with verbs. width() isn't a width, it is a method that gets a width and should be named appropriately, ie getWidth(). That goes doubly so for area() which not only isn't an area, it isn't even getting an area, it is calculating an area and the name should reflect that, ie calArea(). You using property naming conventions for methods is a bigger smell than anything you're pointing out.

And I don't know what kind of systems you work in, but a Window class that doesn't allow access to its list of children is best described as nearly useless.

Collapse
 
mcsee profile image
Maxi Contieri

what is 'cal' ?

I have asked my child what is 'calArea' and she laughed. She's perfectly aware of what is an area. And she has a friend called 'Cal' btw.

I work in a world class software company and have looooots of windows, we don't access objects since we believe in encapsulation and information hinding principles.
Windows are ok without being accessed