Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options questions only not deleted user 110860

Reflection is the ability of a computer program to examine, introspect, and modify its own structure and behavior at runtime.

6 votes
6 answers
835 views

In creating a "registry", which is worse: using reflection or violating open/closed principle?

return commandMap.get(input).createCommand(args); Use reflection: Class.forName("library.commands." + input).getConstructor(args.getClass()).newInstance(args); The command classes would then have the … Some of use think #3 should not be used, because reflection should only be used as a last resort, and it seems too "hacky". However, none of us have any better ideas. …
The Guy with The Hat's user avatar