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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Design Issue: Class Library and State

Design Issue: Class Library and State

Scheduled Pinned Locked Moved C#
performancehelpdesignwindows-adminxml
4 Posts 3 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.
  • M Offline
    M Offline
    mcljava
    wrote on last edited by
    #1

    I have an interesting problem that I am looking for some advice on. Basically I have a protocol library, where each PDU is a class. Thus the library is a collection of individual classes that are stateless. Meanwhile, I have a need to aquire some housekeeping info via a one time register function. I'd like for this function to make the housekeeping info persistent or semi-persistent so that thet data would be available to the other classes as they are instantiated. Now, I could use XML to write out persistant data but the overhead in file I/O seems quite underdesirable in a near real time application. I could write a value to the Registry, but again there is a performance hit. Finally I have considered kicking off a thread which the instantiated classes could interrogate but that feels over the top. If only you could create a Shared Memory Region like the good ol' days (just kidding). But if you have tackled a similar problem, or know of an elegant approach please let me know. Thanks in advance! Mike

    C 1 Reply Last reply
    0
    • M mcljava

      I have an interesting problem that I am looking for some advice on. Basically I have a protocol library, where each PDU is a class. Thus the library is a collection of individual classes that are stateless. Meanwhile, I have a need to aquire some housekeeping info via a one time register function. I'd like for this function to make the housekeeping info persistent or semi-persistent so that thet data would be available to the other classes as they are instantiated. Now, I could use XML to write out persistant data but the overhead in file I/O seems quite underdesirable in a near real time application. I could write a value to the Registry, but again there is a performance hit. Finally I have considered kicking off a thread which the instantiated classes could interrogate but that feels over the top. If only you could create a Shared Memory Region like the good ol' days (just kidding). But if you have tackled a similar problem, or know of an elegant approach please let me know. Thanks in advance! Mike

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      mcljava wrote:

      PDU

      What's a PDU? If all this is happening in one application then reading an XML file at start up then holding the data internally isn't too bad. The other classes could then query the central housekeeping class. If it needs to write stuff out to persist it then it could do so when the application is shut down or at regular intervals so it doesn't disrupt the flow of the rest of the application. ColinMackay.net "Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius "If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell

      J 1 Reply Last reply
      0
      • C Colin Angus Mackay

        mcljava wrote:

        PDU

        What's a PDU? If all this is happening in one application then reading an XML file at start up then holding the data internally isn't too bad. The other classes could then query the central housekeeping class. If it needs to write stuff out to persist it then it could do so when the application is shut down or at regular intervals so it doesn't disrupt the flow of the rest of the application. ColinMackay.net "Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius "If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell

        J Offline
        J Offline
        J4amieC
        wrote on last edited by
        #3

        PDU usually refers to a Power Distribution Unit, used to switch between main power and backup generator power seamlessly with no loss of power.

        M 1 Reply Last reply
        0
        • J J4amieC

          PDU usually refers to a Power Distribution Unit, used to switch between main power and backup generator power seamlessly with no loss of power.

          M Offline
          M Offline
          mcljava
          wrote on last edited by
          #4

          Sorry for the confusion, PDU means Protocol Data Unit (i.e. a packet) in data communications and in my library.

          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