Skip to content

AhmedTarekHasan/FlaggedEnumerations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Flagged Enumerations: How To Represent Features Combinations Into One Field

Represent features like [Read, Write, Modify, …] and their combinations into a single field.


Sometimes when building your Software system and while designing a set of modules, you find that every module of these modules could -or couldn’t- support some features of a predefined list of features. At the end, there should be some field or property which maps each module to its supported features.


For example, let’s say that we are working on a game where every character in the game would -or wouldn’t- be able to:
▶ Walk
▶ Run
▶ Speak
▶ Scream
▶ Fight
▶ …


A character might support the features Walk, Run, and Speak only. Another character might support the features Walk, Scream, and Fight only. And so on,…


Now, let’s say that you want to have only one field or property on the Character class to represent these features so that at any time using the value of this property you can know all the singular features supported by a certain Character instance.


How would you do this? Someone might say: Use Flagged Enumerations, it is easy.


Yes, this is right, but, do you know the concept that is already used in Flagged Enumerations? This is what this article is about.


If you are interested into reading more about this topic, you can read the rest of the article.


If you want to support me:

▶ Subscribe to Medium using my referral link
▶ Subscribe to Medium Newsletter
▶ Subscribe to LinkedIn Newsletter
▶ Follow me on Medium
▶ Follow me on Twitter
▶ Follow me on LinkedIn


Authors: