Ask someone from another language how they count their tests classes. In Smalltalk you can easily: TestCase allSubclasses size or write other nice statistics scripts about your programs. Reflection can be used to find an appropriate selector when you know the input and the result. I'm sure you know that features available in the finder tool: 3. 4. 7. or according examples from the finder tool like: MethodFinder methodFor: #( (4 3) 7 (0 5) 5 (5 5) 10). Maybe the PragmaCollector is also a nice example: just define a method foo <todo> ... and then: (PragmaCollector filter: [:pragma | #todo = pragma keyword]) reset collected Also have a look at "Teachable" from config browser. It's not directly related to reflection but shows how easy it is to use #doesNotUnderstand and write mocks. One can do other nice tricks - like implement a getter automagically when it is not there, ... Beware - you already know the "true become: false" trick ;)
Hmm, given such examples, it makes me doubt, how to properly answer the question 'what is reflection'.. Because when you saying: SomeClass selectors includes: #foo is it using reflection? but looking from plain perspective it is nothing more than accessing properties stored in object, using methods, provided by object.. and not much different to accessing properties of any other object , like: point x so, what kind of access is clearly 'reflective', and what is not? On 20 August 2013 23:08, Torsten Bergmann <astares@gmx.de> wrote:
Ask someone from another language how they count their tests classes. In Smalltalk you can easily:
TestCase allSubclasses size
or write other nice statistics scripts about your programs.
Reflection can be used to find an appropriate selector when you know the input and the result. I'm sure you know that features available in the finder tool: 3. 4. 7.
or according examples from the finder tool like:
MethodFinder methodFor: #( (4 3) 7 (0 5) 5 (5 5) 10).
Maybe the PragmaCollector is also a nice example: just define a method
foo <todo> ...
and then:
(PragmaCollector filter: [:pragma | #todo = pragma keyword]) reset collected
Also have a look at "Teachable" from config browser. It's not directly related to reflection but shows how easy it is to use #doesNotUnderstand and write mocks. One can do other nice tricks - like implement a getter automagically when it is not there, ...
Beware - you already know the "true become: false" trick ;)
-- Best regards, Igor Stasenko.
participants (2)
-
Igor Stasenko -
Torsten Bergmann