Data Access Object or Inline Methods
I am still very new to Actionscript and have an okay working knowledge of Flex. I am working on an AIR application that runs a SQLite database underneath. The database is only 3 tables (projects, items and types). I was wondering if Actionscript best practices are to use a data access object or layer to store all of my database functions or to just run them inline as needed. I would assume an access layer woul开发者_Python百科d be best for interacting with the database for usability, but I can't seem to find much documentation for SQLite in AIR.
It depends a bit on the complexity of your application, but in general I would propose using an abstraction over the database access. The key is to create an interface that your application will talk to and then provide a SQLite implementation. The benefit is that you can easily create a stub or mock implementation for testing and you can create new implementation that talk to other technologies. The Spring ActionScript framework has some good utilities to achieve this.
I responded to a similar question here.
精彩评论