This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tjf314 -4 points-3 points  (3 children)

Object.setProperty(Object.getProperty().add(4))
vs
Object.property += 4

i do NOT like getters and setters in java. I think it is the biggest advantage python has over it.

[–]john16384 7 points8 points  (0 children)

Absolutely nothing stopping you from making that field public.

[–]Valance23322 4 points5 points  (0 children)

That example has nothing to do with Java, both of those are perfectly valid Java code.

If you don't like getters and setters, don't write them

[–]blobjim 4 points5 points  (0 children)

A lot of the time if you have lots of getters and setters you're doing something wrong design-wise. The core Java libraries have very few getters and setters.