Often times I need to create an encapsulation to hold an array of an Entity. Let’s say we have a class that represents an HTML table.
public class Tables
{
public Table[] Tables;
public Tables(){}
}
public class Table
{
public Header Header;
public Row Row;
public Footer Footer;
public Table(){}
}
Here, my Tables encapsulate a Collection of Table. I want to call my Table[] Object Tables, but this clashes with my Encapsulation. To me, both represent a table. How should I fix my naming?
Secondly, my Table contains a Footer
//A Special type of Row in a Table
public class Footer: Row
{
}
I could solve this by making my Members lower cased. Although, this goes against Microsoft recommended practices for public members.
I could append a Obj to my Member names…once again, not a good practice. Perhaps I’m viewing my OO encapsulations incorrectly.
You should be as descriptive as possible in your naming. What is the feature of your
Tablesclass that requires a new class rather than just an array? If there isn’t anything then just use an array, otherwise include the distinctive feature of your class in the name.