Are there any reliable solutions for annotations/reflection/code-metadata in C?
Not all languages support java-like annotations or C#-like attributes or code metadata in general, however that doesn’t mean it is not possible to have in languages that don’t have this.
How to create contracts in python
I am currently learning Python (from Java) and have a question on contracts.
Determining which decorator classes are available via reflection
I’m creating a pizza place application where employees will be able to create orders for customers(pizza and any number of toppings). This is for a school project but the requirements have nothing to do with this question.
In Java, would you sacrifice type safety for a nicer programming interface
When and why would you generally sacrifice typesafety for a nicer programming interface?
Is it a bad habit to (over)use reflection?
Is it a good practice to use reflection if greatly reduces the quantity of boilerplate code?
Writing data driven reflection based tests to ensure design completeness [closed]
Using naming conventions and associated behavioral or structural rules associated with those conventions, it should be possible to write tests for the product that enforce that behaviors and structures associated with names are implemented correctly by reflecting the available target binaries. Furthermore it should also be possible to enforce a by convention design that doesn’t allow for the misuse of naming conventions by means of having names that fall under the naming conventions that don’t follow those same behavioral or structural rules to be used inappropriately (i.e something with the word Locator in the type name that doesn’t implement the service locator pattern.)
Is it bad programming practice to check if a class referenced by its interface is an instance of another class?
I have a class (Timer
) with an array list of Timable
objects. Timeable
is an interface. There is some specific functionality that I need for the Trigger
class (implements Timable
), which has a reference called target
. A lot of methods need to search through the Timer
array for Trigger
objects with a certain target
.
Is it bad programming practice to check if a class referenced by its interface is an instance of another class?
I have a class (Timer
) with an array list of Timable
objects. Timeable
is an interface. There is some specific functionality that I need for the Trigger
class (implements Timable
), which has a reference called target
. A lot of methods need to search through the Timer
array for Trigger
objects with a certain target
.
Using Java Reflection to decouple code modules
I’m involved in a project with several modules. I found that programmers have designed one module to be easily decoupled from its dependent modules using Java Reflection. If other modules need to call a method in this module, the programmers are expecting them to use reflection to call it. This has resulted in a lot of places with hard-coded reflection calls. By hard-coded, I mean the class and method names are permanently fixed as Strings, which kind of defeats the purpose of reflection which is supposed to be for dynamic programming.
Using Java Reflection to decouple code modules
I’m involved in a project with several modules. I found that programmers have designed one module to be easily decoupled from its dependent modules using Java Reflection. If other modules need to call a method in this module, the programmers are expecting them to use reflection to call it. This has resulted in a lot of places with hard-coded reflection calls. By hard-coded, I mean the class and method names are permanently fixed as Strings, which kind of defeats the purpose of reflection which is supposed to be for dynamic programming.