• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to preserve Data state

 
Gytis Jakutonis
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I want to present to design decisions, considering database layer:
1. Data class uses static RandomAccessFile, static LockManager and static DatabaseInfo(records count etc.). This approach is quite simple and leaves space for easy exctensioning from IO into NIO. But the main idsadvantage is that Data uses static(shared) used to control IO, locking, database records. This leaves developer ability to change these statics outside Data and cause application crash or corrupt underlying database.
2. Data class uses some sort of DBManager, which exposes almost identical interface as Data has with additional utilities/arguments, and wraps raf, locking etc. inside as private members. This leads to secure code, but futher extensions(IO -> NIO) are complicated, since Data has no knowledge of raf. To introduce NIO in such design Data has to be overriden together with DBManager.
----
So maybe somebody can give more pros and cons on these approaches, since I'm not sure which one should I use. Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic