you could show us how to avoid issues like you have. You could show us the basic rules:
- avoid magic numbers. Use defines or consts or computed variables instead.
- define a business oriented interface and put the data representation behind, like
Code: Select all
interface IDays
method GetDayByNumber( number as int ) as Day
end interface
class Days implement IDays
private property _Days as Day[]
method IDays.GetDayByNumber( number as int ) as Day ; return _Days[number-1]
end class
- and of course show the intense use of unit tests to verify it works as intended even after the change to collections.
BTW: you can define an indexed access inside the Days class (and IDays interface of course) by an indexed property where you can do the -1 thing. Look for the special property names 'item' or 'self'. With that you can use Days with the same index syntax as real arrays.
Frank