Short answer: never.
In fact, if you use an object to simply store data, but the object itself does not do any logic, and you never want to receive from this object, then it is normal for public fields. Sometimes I do similar things in C ++:
struct A { int a; float b; string c; A():a(0),b(0.0) {} A(int a_, float b_, string c_):a(a_),b(b_),c(c_) {} };
But besides initializing the constructors, it is nothing but a C-structure. If your class does something more than this, you should never use public (or even protected) fields.
As for the properties, it depends on what language you use. For example, in Delphi, the main purpose of properties is to provide public interfaces for fields and can provide them with getters / seters, while still working syntactically as a variable.
petersohn
source share