Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
3 answers
124 views

Adding additional attributes to an Enum object

I have used Enum objects before in PHP as shown here. However, I often find it's a requirement to have further attributes or metadata available on the instances. I came up with the example solution ...
benjaminhull's user avatar
5 votes
4 answers
5k views

Python Constant Class, Different Enum Implementation

So I saw a need for and came up with a class implementation to group constants, which I'm calling a Constant Class. I wondered if there existed other similar implementations or if there is a flaw in ...
Jonathan Veit's user avatar
1 vote
1 answer
81 views

Improving Design for structured Keys

On several occasions I had to use a fixed set of keys (constants in the sense of static final String) with some additional logic (grouping in different keySets). After some more or less lefthanded ...
Krümel Monster's user avatar
20 votes
2 answers
3k views

Enum, constants, or other to represent chess pieces

I'm learning C# and I decided to write a chess program to help me practice the concepts I'm learning in my book. I started the Board class tonight, which is going to handle 1) the board state and 2) ...
RedDragonWebDesign's user avatar
2 votes
4 answers
524 views

Enum or Constant

I'm writing a SDK for a NFC device in .NET so I don't have to import the SDK from C++. Right now I'm working on the ISO14443-3 part which is just simple Halt, Request, and Anticollision commands. The ...
Robert Snyder's user avatar
3 votes
2 answers
131 views

Managing fault types

I have a FaultType enum with more than 100 members: ...
Prasad Kanaparthi's user avatar
3 votes
1 answer
6k views

Class to simulate enums in PHP

I have been reading this thread on Stack Overflow about simulating enums in PHP and it seems that the most common approach is to use class constants. My problem with that is I can't use it for type ...
Anonimista's user avatar