Does reflection use unOOPish reflection?

What are the risks of using reflection? Does everything go against OOP?

I started using it easily in a C # project, and now I find it practical in many scenarios.

Thanks.

+3
source share
7 answers

To answer the question in the title: no, not a priori. For example, reflection can be extremely convenient when introducing plants to create objects of different (but related) types.

However, these are all implementation details, and they usually should be hidden behind a common interface. Reflection also tends to be rather slow, so excessive use is not recommended. Basically, use it when there is no other (good) solution, and nowhere else.

. / , , .

+10

- , .

, . , . .

, , . , ..

+11

. , OO-, , -. , OO, AOP (- ). -, .

, :

  • , .
  • ,
  • -
  • /

, /, .

+4

OO, Smalltalk, . , , . .

+2

, ... API- Java ( ), JavaBeans. , .

, , , , - , . , , .

0

OO . (, Smalltalk, ), (, ++, ). , , .

, - - Smalltalk Squeaking .

0

, , , - , , . , , , Python, , . , , . , . , , , , .

0

Source: https://habr.com/ru/post/1702991/


All Articles