On 12 oct. 2010, at 20:40, Alexandre Bergel wrote:
Most tools expect things to be something more than some empty entities.
I know this. But I am just wondering whether this is really what we want.
For DSM, I already posted a fix for the test:
model := MooseModel new. model add: (FAMIXNamespace new name: 'name1'); add: (FAMIXNamespace new name: 'name2'); add: (FAMIXNamespace new name: 'name3').
allActionMorphs := self allActionMorphsIn: model allNamespaces mooseMenu.
For FamixMethod, #allPackages can not be computed because no package are defined in the stub model. So just add one.
This looks odd to me. allPackages should return an empty collection, not raises an error. It is easy to make it work. Getting a good design a bit more tricky :-)
Did you take a look at the error?
It's "A set can not contain nil value" and we got nil because #parentPackage is not initialized
Now the implementation of #allPackages is: FAMIXPackageGroup withAll: (self entities collectAsSet: [:m | m parentPackage])
I don't want to add a nil check in this method. On the contrary, if one day a nil appears in this place, I would like an error to pop up so that I can investigate why the model seems inconsistent.
Alexandre
The following raises an error. Is this intended?
| group fClass | fClass := FAMIXClass new. group := FAMIXMethodGroup new. group add: (FAMIXMethod new name: 'name1'; parentType: fClass); add: (FAMIXMethod new name: 'name2'; parentType: fClass); add: (FAMIXMethod new name: 'name3'; parentType: fClass). group allPackages
allPackages cannot be computed.
On 12 oct. 2010, at 20:04, Alexandre Bergel wrote:
Hi!
Is it okay to assume that some FAMIX object may leave outside a model? There is the following method:
DSMCell>>configurationForNamespace
self accesses: (self from mooseModel sourceLanguage = #Smalltalk ifTrue: [ self from outgoingReferencesTo: self to ] ifFalse: [ (self from outgoingReferencesTo: self to) union: (self from accessTo: self to) ]). ... ^ self dependencies
What do you think about adding: self mooseModel ifNil: [ ^ self dependencies ]
It would make the DSM more robust. I tried to open a DSM on a namespace group defined as:
group := FAMIXNamespaceGroup new. group add: (FAMIXNamespace new name: 'name1'); add: (FAMIXNamespace new name: 'name2'); add: (FAMIXNamespace new name: 'name3').
It raises an error.
Alexandre
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
This looks odd to me. allPackages should return an empty collection, not raises an error. It is easy to make it work. Getting a good design a bit more tricky :-)
Did you take a look at the error?
It's "A set can not contain nil value" and we got nil because #parentPackage is not initialized
Yes I had a look at it. Of course, there is a reason why the error got raised.
Now the implementation of #allPackages is: FAMIXPackageGroup withAll: (self entities collectAsSet: [:m | m parentPackage])
I don't want to add a nil check in this method. On the contrary, if one day a nil appears in this place, I would like an error to pop up so that I can investigate why the model seems inconsistent.
I do not have a better implementation to propose. Probably adding a check for nil value is not the way to go. But again, when I send #allPackages, I expect to have an empty collection if none are found. Not to raise an error.
I will add a package to make the test happy.
Cheers, Alexandre
The following raises an error. Is this intended?
| group fClass | fClass := FAMIXClass new. group := FAMIXMethodGroup new. group add: (FAMIXMethod new name: 'name1'; parentType: fClass); add: (FAMIXMethod new name: 'name2'; parentType: fClass); add: (FAMIXMethod new name: 'name3'; parentType: fClass). group allPackages
allPackages cannot be computed.
On 12 oct. 2010, at 20:04, Alexandre Bergel wrote:
Hi!
Is it okay to assume that some FAMIX object may leave outside a model? There is the following method:
DSMCell>>configurationForNamespace
self accesses: (self from mooseModel sourceLanguage = #Smalltalk ifTrue: [ self from outgoingReferencesTo: self to ] ifFalse: [ (self from outgoingReferencesTo: self to) union: (self from accessTo: self to) ]). ... ^ self dependencies
What do you think about adding: self mooseModel ifNil: [ ^ self dependencies ]
It would make the DSM more robust. I tried to open a DSM on a namespace group defined as:
group := FAMIXNamespaceGroup new. group add: (FAMIXNamespace new name: 'name1'); add: (FAMIXNamespace new name: 'name2'); add: (FAMIXNamespace new name: 'name3').
It raises an error.
Alexandre
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev