From: Nick on
I've been playing with the new OO features in 2008a, but have no previous experience with OO programming.

One thing that is frustrating me is the fact that the constructor (or another private method) for each class is forced to use the set/get methods which I would like to define only for public access to the class.

For example, if I were to create a class whose constructor created three axes, and then displayed some data on them, I might want to create XLim and YLim properties for that class, and to write a set method that updated all axes in the object whenever XLim and YLim were changed by a user. However, this behaviour wouldn't be necessary within the constructor method, (before the axes even exist) and yet it is impossible to update the default values of XLim and YLim within the constructor without calling these set commands!

One workaround is just to use the constructor to create a default object, and set all other properties externally, i.e.

obj = createObj();
obj.data = data;
obj.XLim = value;
obj.YLim = value;

but this is cumbersome, and unclear to the user who doesn't know which values are strictly necessary.
I'd much rather mimic the standard matlab style:

obj = creatObj(data, 'XLim', value, 'YLim', value')

where I could just require the user to provide a minimal amount of data to the constructor before returning an object.

Am I going about this the wrong way? Any tips or suggestions?