Silvio Carréra
Oct 23, 2022

--

Very elegant solution. But I think you used reflection just to avoid having a simple Factory with if-else statements.

In case of a factory I think it would be fine to use it with if-else statements. In other cases I prefer to do just if checks and early exit when possible.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Silvio Carréra
Silvio Carréra

Written by Silvio Carréra

I like to write. Game Development and Game Design.

No responses yet

Write a response