Rank: 943 based on 123 downloads (last 30 days) and 4 files submitted
photo

Bobby Nedelkovski

E-mail
Company/University
The MathWorks

Personal Profile:

Professional Interests:

 

Watch this Author's files

 

Files Posted by Bobby View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
05 Oct 2009 Screenshot Design Pattern: Iterator (Behavioural) A MATLAB® OOP implementation of the Iterator Behavioural Design Pattern Author: Bobby Nedelkovski abstract data type, uml, object oriented progr..., design pattern, behavioural, oop 20 2
  • 5.0
5.0 | 1 rating
05 Oct 2009 Screenshot Data Structure: A Cell Array List Container Provides a useful 1D container for storing an ordered heterogeneous set of elements Author: Bobby Nedelkovski uml, object oriented progr..., abstract data type, oop, cell array, data structure 28 2
28 Sep 2009 Screenshot Clone Handle Object - using MATLAB OOP How to clone an object (deep copy) which inherits reference behaviour from the 'handle' class. Author: Bobby Nedelkovski clone, object, object oriented progr..., copy 29 3
  • 3.0
3.0 | 1 rating
05 Aug 2009 Published M-Files Design Pattern: Singleton (Creational) A MATLAB® OOP implementation of the Singleton Creational Design Pattern Author: Bobby Nedelkovski singleton, uml, object oriented progr..., design pattern, creational, oop 46 0
Comments and Ratings by Bobby View all
Updated File Comments Rating
20 Sep 2009 Design Pattern: Iterator (Behavioural) A MATLAB® OOP implementation of the Iterator Behavioural Design Pattern Author: Bobby Nedelkovski

Thank you for your feedback Kun-Chul.

To provide clarification to the comment "good implementation for the oo design principle: polymorphism!!":

The CellArrayList implementation of the List ADT provides 'polymorphism' at the element level as I've indicated in File Exchange item #25024 by stating that CellArrayList is a storage container for a *heterogeneous* set of elements.

On the other hand, polymorphism at the list object creation level can't be generally enforced since MATLAB is loosly typed. Ideally, to conform with good software engineering practice, it would be beneficial to declare an identifier using an interface/abstract class so you just need to change the instantiating class if you simply want to switch from one implementation of List to another (i.e. you cannot perform "List myList = CellArrayList();" so then you would simply need to modify this line to use another implementation "List myList = AnotherImplList();"). So in this case, polymorphism is not apparent in MATLAB OOP.

On the alternative implementation of method 'locationsOf' (i.e. "locs = find(cellfun('isclass',obj.list,class(elt)));"), I have asserted in the comments for 'locationsOf' in abstract class 'List.m' that it should return the locations of all occurances of a single element in the list; speed shouldn't be necessarily the issue here. Hence why I use a strict equality test in "locs = find(cellfun(@(c)isequal(c,elt),obj.list));" *not* simply checking the element type. For example, if I define a list of the sort "x = [1,2,{3,4;5,6},{7,8;9,10},11]" and test x.locationsOf(2), the 'isequal' implementations yields the correct result of 2. The 'isclass' implementation will yield the relative locations of elements 1,2 and 11 given their data type matches the data type of the input argument. This is then contrary to the "contractual agreement" defined in the comments for 'locationsOf' in the abstract class 'List.m'. Sure, though you are welcome to have specialised methods in your custom subclasses of the List ADT - for example, perhaps an 'isclass' operation could be be encapsulated in a method called 'classTypeLocationsOf'.

Finally, to comment on "I hope Mathworks to develop cell array vectorization for matlab oop...", the idea of this CellArrayList realisation of the List ADT and OOP in general is to hide the low-level detail in implementation of certain functionality (like performing "find(cellarray..." or even for that matter "find(listObj==obj)" as suggested) since the user of CellArrayList only needs to know how to use 'locationsOf'. So the onus is on the developer to create their own implementations of specific class methods using base MATLAB functionality; therefore OOP shouldn't be seen as a replacement for or thought of as superseding base MATLAB functionality since functions like 'cellfun' still have their place.

20 Sep 2009 Data Structure: A Cell Array List Container Provides a useful 1D container for storing an ordered heterogeneous set of elements Author: Bobby Nedelkovski

Thank you for your feedback Kun-Chul.

To provide clarification to the comment "good implementation for the oo design principle: polymorphism!!":

The CellArrayList implementation of the List ADT provides 'polymorphism' at the element level as I've indicated in File Exchange item #25024 by stating that CellArrayList is a storage container for a *heterogeneous* set of elements.

On the other hand, polymorphism at the list object creation level can't be generally enforced since MATLAB is loosly typed. Ideally, to conform with good software engineering practice, it would be beneficial to declare an identifier using an interface/abstract class so you just need to change the instantiating class if you simply want to switch from one implementation of List to another (i.e. you cannot perform "List myList = CellArrayList();" so then you would simply need to modify this line to use another implementation "List myList = AnotherImplList();"). So in this case, polymorphism is not apparent in MATLAB OOP.

On the alternative implementation of method 'locationsOf' (i.e. "locs = find(cellfun('isclass',obj.list,class(elt)));"), I have asserted in the comments for 'locationsOf' in abstract class 'List.m' that it should return the locations of all occurances of a single element in the list; speed shouldn't be necessarily the issue here. Hence why I use a strict equality test in "locs = find(cellfun(@(c)isequal(c,elt),obj.list));" *not* simply checking the element type. For example, if I define a list of the sort "x = [1,2,{3,4;5,6},{7,8;9,10},11]" and test x.locationsOf(2), the 'isequal' implementations yields the correct result of 2. The 'isclass' implementation will yield the relative locations of elements 1,2 and 11 given their data type matches the data type of the input argument. This is then contrary to the "contractual agreement" defined in the comments for 'locationsOf' in the abstract class 'List.m'. Sure, though you are welcome to have specialised methods in your custom subclasses of the List ADT - for example, perhaps an 'isclass' operation could be be encapsulated in a method called 'classTypeLocationsOf'.

Finally, to comment on "I hope Mathworks to develop cell array vectorization for matlab oop...", the idea of this CellArrayList realisation of the List ADT and OOP in general is to hide the low-level detail in implementation of certain functionality (like performing "find(cellarray..." or even for that matter "find(listObj==obj)" as suggested) since the user of CellArrayList only needs to know how to use 'locationsOf'. So the onus is on the developer to create their own implementations of specific class methods using base MATLAB functionality; therefore OOP shouldn't be seen as a replacement for or thought of as superseding base MATLAB functionality since functions like 'cellfun' still have their place.

04 Aug 2009 Clone Handle Object - using MATLAB OOP How to clone an object (deep copy) which inherits reference behaviour from the 'handle' class. Author: Bobby Nedelkovski

This File Exchange item is now under review. WARNING: Neither the original method (leveraging ‘TestClass.m’ with the ‘copyobj’ method as a template for your custom class) nor using Volkmar’s suggestion (inherit the Volkmar’s proposed ‘copyobj’ method by subclassing ‘TestClass.m’) produces a truly ‘deep’ copy of a handle object. Instead, both methods yield ‘deep’ copies of public properties in the custom superclass hierarchy yet they produce ‘shallow’ copies of private and protected properties. This has to do with the depth in scope of private and protected properties to an instance…

Case: Values of private properties declared in any superclass or protected properties declared in any grandparent class or higher cannot be copied. Accessor methods for private and protected properties can be customised – for instance, getMyProperty(obj). If a private property is modified with a custom set method and since this custom method is not part of the property’s meta-data (i.e. “GetMethod = []” in its corresponding “meta.property” object), one cannot copy the value of the private property using simple assignment with Dynamic Expressions. Moreover, you cannot temporarily modify the property’s “GetMethod=getMyProperty(obj)” nor “GetAccess=Public” meta-data fields to assume necessary control to copy private properties.

I am currently investigating possibilities in producing a truly ‘deep’ copy of a handle object. Please feel free to email any suggestions to bobby.nedelkovski@mathworks.com.au.

Comments and Ratings on Bobby's Files View all
Updated File Comment by Comments Rating
20 Sep 2009 Design Pattern: Iterator (Behavioural) A MATLAB® OOP implementation of the Iterator Behavioural Design Pattern Author: Bobby Nedelkovski Nedelkovski, Bobby

Thank you for your feedback Kun-Chul.

To provide clarification to the comment "good implementation for the oo design principle: polymorphism!!":

The CellArrayList implementation of the List ADT provides 'polymorphism' at the element level as I've indicated in File Exchange item #25024 by stating that CellArrayList is a storage container for a *heterogeneous* set of elements.

On the other hand, polymorphism at the list object creation level can't be generally enforced since MATLAB is loosly typed. Ideally, to conform with good software engineering practice, it would be beneficial to declare an identifier using an interface/abstract class so you just need to change the instantiating class if you simply want to switch from one implementation of List to another (i.e. you cannot perform "List myList = CellArrayList();" so then you would simply need to modify this line to use another implementation "List myList = AnotherImplList();"). So in this case, polymorphism is not apparent in MATLAB OOP.

On the alternative implementation of method 'locationsOf' (i.e. "locs = find(cellfun('isclass',obj.list,class(elt)));"), I have asserted in the comments for 'locationsOf' in abstract class 'List.m' that it should return the locations of all occurances of a single element in the list; speed shouldn't be necessarily the issue here. Hence why I use a strict equality test in "locs = find(cellfun(@(c)isequal(c,elt),obj.list));" *not* simply checking the element type. For example, if I define a list of the sort "x = [1,2,{3,4;5,6},{7,8;9,10},11]" and test x.locationsOf(2), the 'isequal' implementations yields the correct result of 2. The 'isclass' implementation will yield the relative locations of elements 1,2 and 11 given their data type matches the data type of the input argument. This is then contrary to the "contractual agreement" defined in the comments for 'locationsOf' in the abstract class 'List.m'. Sure, though you are welcome to have specialised methods in your custom subclasses of the List ADT - for example, perhaps an 'isclass' operation could be be encapsulated in a method called 'classTypeLocationsOf'.

Finally, to comment on "I hope Mathworks to develop cell array vectorization for matlab oop...", the idea of this CellArrayList realisation of the List ADT and OOP in general is to hide the low-level detail in implementation of certain functionality (like performing "find(cellarray..." or even for that matter "find(listObj==obj)" as suggested) since the user of CellArrayList only needs to know how to use 'locationsOf'. So the onus is on the developer to create their own implementations of specific class methods using base MATLAB functionality; therefore OOP shouldn't be seen as a replacement for or thought of as superseding base MATLAB functionality since functions like 'cellfun' still have their place.

20 Sep 2009 Data Structure: A Cell Array List Container Provides a useful 1D container for storing an ordered heterogeneous set of elements Author: Bobby Nedelkovski Nedelkovski, Bobby

Thank you for your feedback Kun-Chul.

To provide clarification to the comment "good implementation for the oo design principle: polymorphism!!":

The CellArrayList implementation of the List ADT provides 'polymorphism' at the element level as I've indicated in File Exchange item #25024 by stating that CellArrayList is a storage container for a *heterogeneous* set of elements.

On the other hand, polymorphism at the list object creation level can't be generally enforced since MATLAB is loosly typed. Ideally, to conform with good software engineering practice, it would be beneficial to declare an identifier using an interface/abstract class so you just need to change the instantiating class if you simply want to switch from one implementation of List to another (i.e. you cannot perform "List myList = CellArrayList();" so then you would simply need to modify this line to use another implementation "List myList = AnotherImplList();"). So in this case, polymorphism is not apparent in MATLAB OOP.

On the alternative implementation of method 'locationsOf' (i.e. "locs = find(cellfun('isclass',obj.list,class(elt)));"), I have asserted in the comments for 'locationsOf' in abstract class 'List.m' that it should return the locations of all occurances of a single element in the list; speed shouldn't be necessarily the issue here. Hence why I use a strict equality test in "locs = find(cellfun(@(c)isequal(c,elt),obj.list));" *not* simply checking the element type. For example, if I define a list of the sort "x = [1,2,{3,4;5,6},{7,8;9,10},11]" and test x.locationsOf(2), the 'isequal' implementations yields the correct result of 2. The 'isclass' implementation will yield the relative locations of elements 1,2 and 11 given their data type matches the data type of the input argument. This is then contrary to the "contractual agreement" defined in the comments for 'locationsOf' in the abstract class 'List.m'. Sure, though you are welcome to have specialised methods in your custom subclasses of the List ADT - for example, perhaps an 'isclass' operation could be be encapsulated in a method called 'classTypeLocationsOf'.

Finally, to comment on "I hope Mathworks to develop cell array vectorization for matlab oop...", the idea of this CellArrayList realisation of the List ADT and OOP in general is to hide the low-level detail in implementation of certain functionality (like performing "find(cellarray..." or even for that matter "find(listObj==obj)" as suggested) since the user of CellArrayList only needs to know how to use 'locationsOf'. So the onus is on the developer to create their own implementations of specific class methods using base MATLAB functionality; therefore OOP shouldn't be seen as a replacement for or thought of as superseding base MATLAB functionality since functions like 'cellfun' still have their place.

18 Sep 2009 Design Pattern: Iterator (Behavioural) A MATLAB® OOP implementation of the Iterator Behavioural Design Pattern Author: Bobby Nedelkovski Kun-Chul

good implementation for the oo design principle: polymorphism!!

I also used cell array for the objects container ( list container)
for the objects from different classes (but, those different classes inhereted from a same super class)

cell list class is more useful and powerful for the object list container.

however, try this code for the 'locationOf' method (much faster):
locs = find(cellfun('isclass',obj.list,class(elt))
, since cellfun is slow when suing function handle
(but, know the limitation of the code above:
if obj.list contains the object from a same class, then 'find' function returns matching index array.

I hope Mathworks to develop cell array vectorization for matlab oop

for example, objList is cell array contain

find(objList==obj) %this function does not support for cell array

while find(objArray==obj) is supported when objArray is array container of the object from a same class.

18 Sep 2009 Data Structure: A Cell Array List Container Provides a useful 1D container for storing an ordered heterogeneous set of elements Author: Bobby Nedelkovski Kun-Chul

good implementation for the oo design principle: polymorphism!!

I also used cell array for the objects container ( list container)
for the objects from different classes (but, those different classes inhereted from a same super class)

cell list class is more useful and powerful for the object list container.

however, try this code for the 'locationOf' method (much faster):
locs = find(cellfun('isclass',obj.list,class(elt))
, since cellfun is slow when suing function handle
(but, know the limitation of the code above:
if obj.list contains the object from a same class, then 'find' function returns matching index array.

I hope Mathworks to develop cell array vectorization for matlab oop

for example, objList is cell array contain

find(objList==obj) %this function does not support for cell array

while find(objArray==obj) is supported when objArray is array container of the object from a same class.

 

04 Aug 2009 Clone Handle Object - using MATLAB OOP How to clone an object (deep copy) which inherits reference behaviour from the 'handle' class. Author: Bobby Nedelkovski Nedelkovski, Bobby

This File Exchange item is now under review. WARNING: Neither the original method (leveraging ‘TestClass.m’ with the ‘copyobj’ method as a template for your custom class) nor using Volkmar’s suggestion (inherit the Volkmar’s proposed ‘copyobj’ method by subclassing ‘TestClass.m’) produces a truly ‘deep’ copy of a handle object. Instead, both methods yield ‘deep’ copies of public properties in the custom superclass hierarchy yet they produce ‘shallow’ copies of private and protected properties. This has to do with the depth in scope of private and protected properties to an instance…

Case: Values of private properties declared in any superclass or protected properties declared in any grandparent class or higher cannot be copied. Accessor methods for private and protected properties can be customised – for instance, getMyProperty(obj). If a private property is modified with a custom set method and since this custom method is not part of the property’s meta-data (i.e. “GetMethod = []” in its corresponding “meta.property” object), one cannot copy the value of the private property using simple assignment with Dynamic Expressions. Moreover, you cannot temporarily modify the property’s “GetMethod=getMyProperty(obj)” nor “GetAccess=Public” meta-data fields to assume necessary control to copy private properties.

I am currently investigating possibilities in producing a truly ‘deep’ copy of a handle object. Please feel free to email any suggestions to bobby.nedelkovski@mathworks.com.au.

Top Tags Applied by Bobby
object oriented programming, oop, uml, abstract data type, adt
Files Tagged by Bobby View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
05 Oct 2009 Screenshot Design Pattern: Iterator (Behavioural) A MATLAB® OOP implementation of the Iterator Behavioural Design Pattern Author: Bobby Nedelkovski abstract data type, uml, object oriented progr..., design pattern, behavioural, oop 20 2
  • 5.0
5.0 | 1 rating
05 Oct 2009 Screenshot Data Structure: A Cell Array List Container Provides a useful 1D container for storing an ordered heterogeneous set of elements Author: Bobby Nedelkovski uml, object oriented progr..., abstract data type, oop, cell array, data structure 28 2
28 Sep 2009 Screenshot Clone Handle Object - using MATLAB OOP How to clone an object (deep copy) which inherits reference behaviour from the 'handle' class. Author: Bobby Nedelkovski clone, object, object oriented progr..., copy 29 3
  • 3.0
3.0 | 1 rating
05 Aug 2009 Published M-Files Design Pattern: Singleton (Creational) A MATLAB® OOP implementation of the Singleton Creational Design Pattern Author: Bobby Nedelkovski singleton, uml, object oriented progr..., design pattern, creational, oop 46 0
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com