Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Design and Architecture
  4. How do you specify states? State Pattern, Enums or ...?

How do you specify states? State Pattern, Enums or ...?

Scheduled Pinned Locked Moved Design and Architecture
regexquestiondiscussion
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Keld Olykke
    wrote on last edited by
    #1

    I'd like to gain an overview of the whens and whys about state specifications/implementations. How do you go OOP when specifying states? Or do you prefer an enum? ints? ... References are also appreciated. I am very mixed about this topic, so you will get no religious opinions from here. Thanks! Keld Ølykke

    R 1 Reply Last reply
    0
    • K Keld Olykke

      I'd like to gain an overview of the whens and whys about state specifications/implementations. How do you go OOP when specifying states? Or do you prefer an enum? ints? ... References are also appreciated. I am very mixed about this topic, so you will get no religious opinions from here. Thanks! Keld Ølykke

      R Offline
      R Offline
      RobCroll
      wrote on last edited by
      #2

      I'll go for enum over int every time because there probably isn't going to be billions of states and by strongly typing the values, it makes the design a lot more robust and maintainable. MyState.Enabled as opposed to 1 is a lot easier to work with.

      "You get that on the big jobs."

      K 1 Reply Last reply
      0
      • R RobCroll

        I'll go for enum over int every time because there probably isn't going to be billions of states and by strongly typing the values, it makes the design a lot more robust and maintainable. MyState.Enabled as opposed to 1 is a lot easier to work with.

        "You get that on the big jobs."

        K Offline
        K Offline
        Keld Olykke
        wrote on last edited by
        #3

        Thx

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups