concept public property in category design

appears as: public property, Public properties
Object Design Style Guide

This is an excerpt from Manning's book Object Design Style Guide.

Listing 1.10. Defining and using a public property
class Foo
{
    public const int someNumber;

    public string someString;

    // ...
}

object1 = new Foo();
number = objectl.someNumber;        #1
object2.someString = 'Cliché';      #2
  • Private properties and methods are accessible to instances of the same class. Public properties and methods are accessible to any client of an object.
  • 3.13.1. Use public properties

    Since a DTO doesn’t protect its state and exposes all of its properties, there is no need for getters and setters. This means it’s quite sufficient to use public properties for them. Because DTOs can be constructed in steps and don’t require a minimum amount of data to be provided, they don’t need constructor methods.