Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A few downsides to this approach I can think of off the top of my head:</p> <ul> <li><p><em>(This item applies to the original question before the edit, where the approach was to store JavaScript code (<code>var gender='male'; ...</code>) in the database column)</em> You are executing data. This basically gives people free reign to inject any code they want into your application if they can modify the blob.</p></li> <li><p>It requires the JavaScript to be parsed. If later on you decide you wish to run the game in a different, non-js environment (a native or managed app, for example), you will either have to parse the blob, or convert it later.</p></li> <li><p>The data is not structured, is not editable/retrievable piecemeal, and are of arbitrary length. You have to retrieve and execute the entire blob every time, and in order to save state, you must send and update the entire blob as a single block. If you are using a database it would be much more efficient to save each inventory item as a separate row, for example. When the player uses the item, you can send a single query to update one row and the inventory is immediately changed. With your approach you need to send the entire game state back up to the server.</p> <p>This will be counterproductive if you ever want to use the database engine to search. Think leaderboards, statistics, finding who owns which item, etc.</p> <p>You also can not use the database engine to maintain data integrity (check or foreign key constraints)</p></li> <li><p><em>(This item applies to the original question before the edit, where the approach was to store JavaScript code (<code>var gender='male'; ...</code>) in the database column)</em> You have to generate the code anyway from existing objects, so why do it on the way in? Or frankly, why execute dynamic code in the first place. If you are loading <em>data</em>, then store <em>data</em> (i.e. JSON) and parse it.</p></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload